Hi folks,
This is a rather complex request made in the spirit of both (1) reproducible workflows and (2) (to a related point) reducing the influence of human error.
The analysis that I'm running requires that I conduct two separate but related CFAs. The purpose of the first CFA is to estimate certain model parameters (e.g., unstandardized factor loadings and residual variances). Once these have been estimated, a subsequent baseline CFA is run whereby the aforementioned parameters are constrained to those values identified in in the first CFA.
Here is some code to help you see what I'm trying to do:
CFA <–
'factor1 =~ x1 + x2 + x3
factor2 =~ x4 + x5 + x6
'
fit <– cfa(baseline)
summary(fit)
(note: "ufl" means "unstandardized factor loading"; "urv" means "unstandardized residual variance")
Baseline<–
'factor1 =~ ufl1*x1 + ufl2*x2 + ufl3*x3
factor2 =~ x4 + x5 + x6
#Constraint residual variances
x1 ~~ urv1*x1
x2 ~~ urv2*x2
x3 ~~ urv3*x3
'
My question is simply this: how do I write a code that will extract the desired an place them into the lavaan model?
Thanks in advance for your help!
Chris