I'm trying to create a function to calculate SRMR, but I'm not sure how to do this when there are missing data. Does anyone have suggestions about what observed covariance matrix to use when there are missing data (or does anyone know what mplus or amos use to get SRMR with missing data)?

Also (and I'm sure this is much easier), how can I get the predicted covariance matrix among observed variables in OpenMx? I'm sure this is obvious, but I couldn't figure out how to pull this out of the output.

Thanks!

You can get the expected covariance matrix among observed variables from the output slot of a model. You can view all of the output using:

Ah, of course. I am already estimating the saturated model to get other fit indexes, but didn't think to use the results from that for the observed covariance matrix. So you've answered both my questions; thanks!

Regarding the mxEval(covariance, model) syntax to obtain the implied covariance matrix, I used the sample multiple regression model path specification approach with raw and summary (i.e., the covariance matrix) data. To my surprise, mxEval(covariance, model) worked differently. In particular, applying this to the raw data led to the implied (which is the actual since the model is just identified) covariance matrix. However, applying this to the summary input example did not produce anything (except a message that says

> mxEval(covariance, multiRegFit)

Error: Trying to evaluate 'covariance' in model 'Multiple Regression Path Specification' generated the error message: object

'covariance' not found

I can verify it is not here via:

> names(multiRegFit)

[1] "A" "S" "F" "M" "objective" "data"

Yet, the implied covariance matrix is in the raw data model fitted in the same way.

Should this be the case?

Also, is there an easy way to obtain the squared multiple correlation coefficient (i.e., R^2) for endogenous variables. For example, in these multiple regression examples, how would one easily obtain R^2? One could do something like:

(Observed Variance of DV - model implied error variance)/Observed Variance of DV.

However, this approach isn't optimal - is there a way?

Thanks,

Ken

In the OpenMx 1.1 release, there is a unified method for accessing the expected covariance and expected means matrices for a RAM model, regardless of the data source. This method is

`model$objective@expCov`

or`model$objective@expMean`

. This is because in OpenMx 1.1 the expected covariance and expected means matrices are no longer MxMatrix or MxAlgebra objects, and therefore they cannot be accessed using the mxEval() function. Feel free to use the 1.1-beta release to test this out.The short answer is that in OpenMx 1.0, there is no method for accessing the expected covariance and expected means matrices for a RAM model with summary data. Tim Brick may know of some secret method, but I suspect that information is never passed to the frontend.

There is a little more information on this topic at the news item: http://openmx.psyc.virginia.edu/2011/05/phasing-out-ram-fiml-transformation.

Thanks - this works nicely in the 1.1-beta!

I think my other question got buried. Is there a straightforward way to obtain R^2 for endogenous variables?

Thanks,

Ken

If the endogenous variables are observed, then one could compare the MLE of the residual variance (RVZ) when the paths from other variables in the model are fixed to zero to that when they are free parameters (RVF). 1-(RVF/RVZ) should give you R^2.