\stnd cov2cor?

Posted on
Picture of user. smedland Joined: 08/04/2009

Hi
I'm looking for the OpenMx equivilent to the mx \stnd function. Searching the page the cov2cor() function within mxAlgebra pops up a couple of times but looks to have been discontinued(?) in the more recent releases - any similar function currently availble or implemented in the near future?
thanks
Sarah

Replied on Fri, 06/25/2010 - 00:45
Picture of user. smedland Joined: Aug 04, 2009

the work arround (below) is hanging and taking forever - any ideas on speeding this up?

mxAlgebra( expression= solve(sqrt(I*expCovMZ)) %*% expCovMZ %*% solve(sqrt(I*expCovMZ)), name="expCorMZ" )

Replied on Fri, 06/25/2010 - 08:54
Picture of user. mspiegel Joined: Jul 31, 2009

In reply to by smedland

We don't perform automatic common subexpression elimination, so the matrix inverse is computed twice. Use the following:

inverse <- mxAlgebra(solve(sqrt(I * expCovMZ)), name = "inverse")
expCorMZ <- mxAlgebra(inverse %*% expCovMZ %*% inverse, name = "expCorMZ")

Replied on Wed, 07/14/2010 - 11:57
Picture of user. neale Joined: Jul 31, 2009

In reply to by mspiegel

Yes, workshop participants are struggling in the absence of cov2cor. There's a need for it to be somewhat robust, e.g., if there's a zero or negative value in diagonal element a[i,i] then elements [i,] and [,i] of the result should be NA rather than throwing an error (though a warning may be appropriate).