Single Common Factor Model with Some Residual Errors Correlated
Posted on

Attachment | Size |
---|---|
forum_openmx_code.txt | 2.15 KB |
Forums
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 = sigma2*sigma3*rho, cov24=sigma2*sigma4*rho, 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?
mxAlgebra
mxPath(from='variable1', to='variable2', arrows=2, free=FALSE, labels='cov12[1,1]')
mxAlgebra(sigma1/sigma2*rho, name='cov12)
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].Log in or register to post comments
I tried something similar
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.
Log in or register to post comments
add mxMatrix(name=rho)
so I think you just need to add
rho = mxMatrix(name="rho_mat", type="Full", nrow=1, ncol=1, free=T, values=.3, label="rho")
Log in or register to post comments