I’m hoping someone can help me out with an R problem. I want to run a CFA, but set the factor loading to a value obtained from another CFA. And I want to do this by using a variable name, and not actually type out the number.
So, here’s the code that does not work but describes what I want to do:
BasicCFAModel <- ' construct =~ V1 + V2 + V3 + V4'
BasicCFAModelResults <- cfa(BasicCFAModel, data=DataMatrix)
l1 <- BasicCFAModelResults@Fit@est[1]
l2 <- BasicCFAModelResults@Fit@est[2]
l3 <- BasicCFAModelResults@Fit@est[3]
l4 <- BasicCFAModelResults@Fit@est[4]
So, this works, and I get my 4 desired lambda values, called l1, l2, l3, and l4,
But this is what won’t work:
NewModel <- ' f1 =~ Lambda1V1 + Lambda2V2 + Lambda3V3 + Lambda4V4
Lambda1 == l1
Lambda2 == l2
Lambda3 == l3
Lambda4 == l4
'
NewModelResults <- cfa(NewModelResults, data=DataMatrix)
Likewise, this also doesn’t work
NewModel <- ' f1 =~ l1V1 + l2V2 + l3V3 + l4V4
'
NewModelResults <- cfa(NewModelResults, data=DataMatrix)
This will run, but it estimates the values of l1, l2, l3, l4 as normal (i.e., it does not constrain them to equal the values computed earlier).
Any suggestions?