You are here

How to change labels for multiple submodels

3 posts / 0 new
Last post
rlucas's picture
Offline
Joined: 11/17/2009 - 20:34
How to change labels for multiple submodels

My question probably reflects my inexperience scripting in R, but I thought I'd give it a shot here.

I am using OpenMx to test a two-wave multigroup model, with 17 groups. The same construct is measured with three indicators at each of the two waves, and I want to test a series of more restrictive measurement invariance assumptions (both across waves and across groups). I have a script to create an overall model with a submodel for each group. In this initial model, I created unique labels for loadings, variances, correlations, and means for each group, so that there are different estimates for each group. Now I want to be able to systematically change those labels to reflect the constraints that I want to make (e.g., Model 2 would equate the loadings for the indicators at Wave 1 to those at Wave 2; Model 3 would equate the loadings to be equal across groups). However, because there are so many groups, I would like to automate this with some sort of loop, rather than going in and changing each label for each submodel.

For instance, my A matrix is an 8 X 8 matrix, with the loadings for the Wave 1 indicators in rows 1, 2, and 3 of column 7 and the loadings for the Wave 2 indicators in rows 4, 5, and 6 in column 8. So to constrain the loadings at Wave 2 to be equal to those at Wave 1, I would need to have the same label in [1,7] as in [4,8], etc. I'm just not sure how to create a loop to do this for each of the submodels (or to do it some other way). Any suggestions for making this type of change to multiple submodels simultaneously?

Ryne's picture
Offline
Joined: 07/31/2009 - 15:12
omxSetParameters will make

omxSetParameters will make you very happy. You can give in an existing parameter in a given model (which may include submodels) and change its values, label and freedom. Remember to start with the most free model: changing different parameters to have the same label is easy, but changing one repeated label to have different labels in different parts of the model is a pain.

Like all OpenMx functions, you can view the help file with ?omxSetParameters. It should be pretty straight forward.

ryne

rlucas's picture
Offline
Joined: 11/17/2009 - 20:34
Perfect! That will

Perfect! That will definitely do what I need it to do. Thanks!