# SRMR with missing data

7 posts / 0 new Offline
Joined: 11/17/2009 - 20:34
SRMR with missing data

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! Offline
Joined: 07/31/2009 - 15:12
You can get the expected

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:

model@output

The output has a lot of slots, including those for matrices, algebras, likelihoods, hessians and other fun convergence and computational issues. Expected covariances and means are in the algebras slot, and can be referenced either like this (the right way):

<code>
mxEval(covariance, model)
mxEval(means, model)

Or like this (the inefficient but works if you're just manually viewing them way):
<code>
model@output$algebras$'Your Model Name'.covariance
model@output$algebras$'Your Model Name'.mean

One caveat for the expected covariance and means matrices is that they are the expected matrices for the last row of the data. When you don't use definition variables, every row of the data has the same expected covariance and means matrices, so that's fine. When you have definition variables, then every value of the definition variable creates a different expected covariance matrix, so what is returned is one of the many expected covariance matrices that were used.

As far as the observed covariance goes, there isn't a closed-form way to find this matrix. This is why we use things like full information methods. Unless you're absolutely sure that missingness is completely at random (i.e., you're using a planned missingness design which is responsible for all of the missing data), you'll have to estimate the saturated model directly. Offline
Joined: 11/17/2009 - 20:34
Ah, of course. I am already

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! Offline
Joined: 08/04/2009 - 16:01
implied covariance matrix

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

I can verify it is not here via:
> names(multiRegFit)
 "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 Offline
Joined: 07/31/2009 - 15:24
In the OpenMx 1.1 release,

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. Offline
Joined: 08/04/2009 - 16:01
Thanks

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 Offline
Joined: 07/31/2009 - 15:14
Perhaps

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.