one-factor CFA, 4 indicators, correlation matrix
Posted on

Hello! As the subject line states, I want to run a one-factor CFA with four indicators; however, when I run the model in OpenMx, I get -2 degrees of freedom. That makes sense because there are 6 correlations (given 4 indicators), and if I fix the factor variance to 1.0, I have to estimate 4 loadings and 4 error variances = 8 estimates, and we all know that 6 correlations - 8 estimates = -2 df.
However, we can constrain the estimation such that lambda-squared + error variance = 1.0 for each variable - how do I do this (I thought it would be automatic by virtue of using correlation, but probably a good thing that it is not)? Thanks! Fred
You seem to be using a
That said, constraining variances to 1 is relatively straightforward, and has global applications beyond your problem. You can use mxConstraints if you wish, but I'll recommend another technique. If you were specifying residuals as a matrix, then you can instead define your residual matrix as an identity matrix minus the squared loadings. If your loading matrix is 4 x 1, then use this:
mxMatrix("YourModel",
...
mxMatrix("Iden", 4, 4, name="I"),
mxAlgebra(I-vec2diag(loadings%x%2), name="residuals"),
...
)
If loadings^2 + residual = 1, then residual = 1 - loadings^2.
First, I'll make an identity matrix, which provides the 1s for the variances to sum to. Then I subtract the squared loadings. I'll square with kronecker exponentiation (%^%, which just becomes elementwise exponentiation when the second argument is a scalar like 2). That leaves me with a 4 x 1 matrix of squared loadings; using the vec2diag function turns that column of squared loadings into a matrix with those squared loadings on the diagonal and zeros elsewhere). When I subtract that new matrix from the identity matrix, I'm left with a diagonal matrix with my constrained residual variance terms on the diagional. Use that algebra the same way you would use a residual matrix.
If you're using paths instead of matrices, I again strongly strongly urge you to use the standardizeRAM function and to analyze covariances rather than a correlation matrix.
Log in or register to post comments
In reply to You seem to be using a by Ryne
Ryan - This is extremely
Log in or register to post comments
In reply to You seem to be using a by Ryne
Ryan - Again, thanks for your
I attempted to incorporate the restriction that residual = 1-loadings^2, but can't get things to mesh: e.g., (1) Matrices S and A have the last row and column that is 'extra' in that it pertains to the latent factor. I assume I cannot just say mxAlgebra(I-(S%x%2), name="residuals")...or can I? (2) Is the specification in mxAlgebra a constraint that gets passed into the MxObjective function?
Being so new to OpenMx, making direct suggestions based on the attached program might be quicker than figuring out my questions. Thanks! Fred
Log in or register to post comments
In reply to Ryan - Again, thanks for your by foswald
appreciate any thoughts on
Log in or register to post comments
In reply to appreciate any thoughts on by foswald
Here are two versions. In the
1.) free parameters can be treated as 1 x 1 matrices in algebra expressions. The free parameter "l1" can be treated as though it is its own matrix even though it's an element in the A matrix.
2.) labels can be used to populate values from one matrix to another. In the attached code, I constrain the residual variance for item 1 to be equal to the first row and first column of the result of mxAlgebra "e1". That algebra expression defines the residual variance for the first variable as 1 - loading squared, so the only element (by definition, the [1,1] element) is the residual variance.
This spec adds six lines to the code you provided because there are six variables. If you had 100 variables, this solution would not be tenable. I also provided a more LISREL-like specification of the exact same model, which allows for a more parsimonious specification of the constraints.
These two methods are only a few of the many, many ways you could make this constraint (which again could be avoided by using covariance data rather than the information-losing bias-inducing correlation matrix). Explore the program and decide which method makes the most sense for your particular model.
-ryne
Log in or register to post comments
In reply to Here are two versions. In the by Ryne
Once again, amazingly helpful
Log in or register to post comments
In reply to Here are two versions. In the by Ryne
Ryne - Sorry to have
Log in or register to post comments
In reply to Ryne - Sorry to have by foswald
Ah, two problems. I forgot a
ryne
Log in or register to post comments
In reply to Ah, two problems. I forgot a by Ryne
Indeed - thanks again, Ryne!
Log in or register to post comments