means vector

Posted on
Picture of user. mspiegel 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.

Replied on Thu, 08/27/2009 - 19:19
Picture of user. tbates Joined: Jul 31, 2009

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

http://openmx.psyc.virginia.edu/thread/40-means-vector-mxdata-row-matrix-or-column-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.

Replied on Thu, 08/27/2009 - 20:14
Picture of user. Steve Joined: Jul 30, 2009

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?

Replied on Thu, 08/27/2009 - 20:31
Picture of user. mspiegel Joined: Jul 31, 2009

In reply to by Steve

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

Replied on Thu, 08/27/2009 - 21:13
Picture of user. Steve Joined: Jul 30, 2009

In reply to by mspiegel

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.

Replied on Fri, 08/28/2009 - 07:11
Picture of user. tbates Joined: Jul 31, 2009

In reply to by Steve

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?

Replied on Fri, 08/28/2009 - 09:27
Picture of user. Ryne Joined: Jul 31, 2009

In reply to by mspiegel

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.

Replied on Fri, 08/28/2009 - 14:58
Picture of user. mspiegel Joined: Jul 31, 2009

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.