Attachment | Size |
---|---|
forum_openmx_code.txt | 2.15 KB |
I want to fit a single common factor model to seven different types of measurements of the same thing. However, 6 of the methods I expect to have residual errors that are positively correlated. I expect the intercorrelations to be the same among these 6 methods (fortunately) so I want to build in this assumption. There would be too many correlations to estimate separately. So I want to assume rho is the same and need to constrain, say, cov23 = sigma2sigma3rho, cov24=sigma2sigma4rho, etc. But I don't see how to do this using mxConstraints. If I include all the covariances cov23, cov24 etc. in mxPath statements, and build in the constraints directly, it tells me it doesn't know what rho is. If I code it as shown in the attached file, it estimates a model that is unidentified - every time I run it the parameter estimates change drastically. There is no way as far as I can see to code the mxPath statements so that the covariances equal the standard deviations multiplied by rho.
How can force it to estimate a common correlation rho so that the model is identified?
You can set a path to be the result of an algebra. For example,
This sets the two-headed arrow path between variable1 and variable2 to be equal to
sigma1/sigma2*rho
. The square brackets in the labels for the path are important. They let OpenMx know that it's not a typical free parameter label, but rather the result of an algebra. Also, you could set up an algebra that produced a 4x4 matrix of the things you needed and just index the first row and second column in the typical R fashion as [1,2].I tried something similar before, but it did not work. I've attached my code based on your example.
When I run it using either mxRun or mxTryHard, I get this error:
> fit.all.cov.deep2 <- mxRun(model.all.cov.deep2)
Error: Unknown reference 'rho' detected in the entity 'cov23' in model 'model_all_cov_deep2'
I received this same error in my first coding attempt and then tried the code in my previous post.
How can I fix this? Thanks.
In OpenMx algebras etc, variables (like rho) need to be declared in a matrix or other object before they can be used.
so I think you just need to add