# means vector

9 posts / 0 new
Offline
Joined: 07/31/2009 - 15:24
means vector

The means vector is now always converted into an n x 1 matrix. The argument to mxData continues to accept an R numeric vector (in fact, I don't think the mxData function currently will accept a matrix for the means argument). But the means are now always stored as an n x 1 matrix. We had some sloppiness in the R interface where sometimes it was n x 1 and sometimes it was 1 x n. I updated the test suite in light of these changes, but I did not update the /docs. UPDATE: I modified docs/source/OpenMxTutorial.rst and some more web documentation to reflect this change http://openmx.psyc.virginia.edu/dev/changeset/760.

Offline
Joined: 07/31/2009 - 14:25
n*1 is the opposite of what

n*1 is the opposite of what was described in this thread

It's not a major deal, I guess, but 1*n is how means are always presented and the means summarize columns of data, not rows.

Offline
Joined: 07/30/2009 - 14:03
I agree with Tim Bates on

I agree with Tim Bates on this one.

Mx v1 used a 1xn

If I'm summarizing my data matrix X, I would write

apply(X, 2, mean)

and although that results in an undimensioned vector, I think of it as a 1xn.

What is the logic for nx1?

Offline
Joined: 07/31/2009 - 15:24
>
> dim(as.matrix(c(1,2,3,4,5)))
[1] 5 1

Also the back-end calculations "work" if the means vector is a n x 1 matrix. Of course they would also "work" on a 1 x n matrix, but only if the transpose operation is applied.

Offline
Joined: 07/30/2009 - 14:03
Transpose in the backend or

Transpose in the backend or transpose in the user's mind, which is less trouble overall?

Now, perhaps we should take a poll before I blithely state that the majority of user's are going to see an nx1 means matrix as being the transpose of what they intuitively expect.

Offline
Joined: 07/31/2009 - 14:25
hi steve and mike, Clearly

hi steve and mike,
Clearly transpose in the user's mind is more trouble for the user... As it is intended that there are several orders of magnitude more user's than programmers, and they will each write dozens of means matrices, while the program code is written once, I'd say that means it is less trouble for the code to transpose.
tim

How do you add a poll?

Offline
Joined: 07/31/2009 - 15:12
I thought part of the appeal

I thought part of the appeal of 1xn is that the column names of the means vector match the column names of raw data. I understand that vectors are typically approached as column vectors, but I'm for being consistent with usage here.

Offline
Joined: 07/31/2009 - 15:24