\m2v operator?
Posted on
svrieze
Joined: 01/03/2010
Forums
Hello,
What would be the R or OpenMx equivalent of the \m2v operator in Classic Mx?
Related question: if I define in R my own function that performs this operation, can I use that function within the mxAlgebra command?
-Scott
Apologies, I believe I've
For \m2v(X) one can use as.vector(t(X)).
-Scott
Log in or register to post comments
In reply to Apologies, I believe I've by svrieze
If I remember correctly,
Log in or register to post comments
In reply to If I remember correctly, by mspiegel
The wiki page is up to date
Log in or register to post comments
Hello again, Related
Related question: how can I use colMeans() in an mxAlgebra command?
In some releases it appears that colMeans was a legitimate function within mxAlgebra (http://openmx.psyc.virginia.edu/docs/OpenMx/0.2.1-922/_static/Rdoc/mxAlgebra.html).
In the latest manual it is not listed as a viable function under the mxAlgebra command (http://openmx.psyc.virginia.edu/docs/OpenMx/latest/_static/Rdoc/mxAlgebra.html).
Thanks for the quick and helpful replies,
-Scott
Log in or register to post comments
In reply to Hello again, Related by svrieze
Yes. colMeans used to be
col1 <- mxAlgebra(sum(A[,1]) / 3, name = "col1")
col2 <- mxAlgebra(sum(A[,2]) / 3, name = "col2")
col3 <- mxAlgebra(sum(A[,3]) / 3, name = "col3")
colMean <- mxAlgebra(rbind(col1, col2, col3), name = "colMean")
Log in or register to post comments
In reply to Yes. colMeans used to be by mspiegel
Or with a bit more generality
v <- mxMatrix("Full", 1, dim(A@values)[1], values=1/dim(A@values)[1], name="v")
colMean <- mxAlgebra(v %*% A, name="colMeansOfA")
Log in or register to post comments
In reply to Or with a bit more generality by neale
And similarly for row means v
v <- mxMatrix("Full", 1, dim(A@values)[2], values=1/dim(A@values)[2], name="v")
rowlMean <- mxAlgebra(A %*% v, name="rowMeansOfA")
Log in or register to post comments
In reply to And similarly for row means v by Steve
I don't have access to R at
Log in or register to post comments
In reply to Hello again, Related by svrieze
Opened a ticket for colMeans
Log in or register to post comments
In reply to Opened a ticket for colMeans by mspiegel
Agreed these functions
ceiling, floor, trunk, round
dim
rowMeans, colMeans
cov2cor)
Would be useful. There are some gotchas with cov2cor - it fails when diagonal elements are non-positive. I guess it will end up with NaNs in the rows and cols of any non-pos elements. In classic Mx it would throw an error which was inconvenient. NaN is much better.
Log in or register to post comments
In reply to Agreed these functions by neale
Extra vote for a speedy
Log in or register to post comments