means vector

8 replies [Last post]
mspiegel's picture
Offline
Joined: 07/31/2009

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.

mspiegel's picture
Offline
Joined: 07/31/2009
Based on the comments from

Based on the comments from today's developer meeting, the means vector will always be stored as a 1 x n matrix. This change will be made before the next closed beta release, OpenMx v. 0.1.3 which will happen on Monday.

mspiegel's picture
Offline
Joined: 07/31/2009
As of revision 774, the means

As of revision 774, the means vector is always stored as a 1 x n matrix.

Steve's picture
Offline
Joined: 07/30/2009
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?

mspiegel's picture
Offline
Joined: 07/31/2009
>

> 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.

Ryne's picture
Offline
Joined: 07/31/2009
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.

Steve's picture
Offline
Joined: 07/30/2009
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.

tbates's picture
Offline
Joined: 07/31/2009
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?

tbates's picture
Offline
Joined: 07/31/2009
n*1 is the opposite of what

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

http://openmx.psyc.virginia.edu/thread/40-means-vector-mxdata-row-matrix...

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.