I’m working on a unique CFA model in R using lavaan. The tricky part is setting the unique error of observed variables to be the sum of two correlations of unique items.
For example, the error of y1,2 should equal the sum of its covariances with y1,3 and y*2,3.
How can I set this up in lavaan syntax? Here’s what I’ve got so far:
cfa_model <- '
F1 =~ a*x1 + b*x2 + c*x3
F2 =~ d*x4 + e*x5 + f*x6
# Need help with this part
# x1 ~~ (x1~~x2 + x1~~x3)*x1
# x2 ~~ (x2~~x1 + x2~~x3)*x2
# x3 ~~ (x3~~x1 + x3~~x2)*x3
'
Any ideas on how to correctly specify these error terms as sums of covariances?
hey jack27, ur model looks pretty complex! have u tried using the := operator in lavaan? it might help define those custom error terms. something like:
e1 := x1~~x2 + x1~~x3
x1 ~~ e1*x1
might work for each variable. just an idea, let me know if u need more clarification!
This directly constrains each error variance to be the sum of its relevant covariances. It’s more concise than using separate := statements and should achieve what you’re after. Remember to check model identification carefully, as this setup might lead to convergence issues depending on your data structure.
What do you think about this approach? Have you tried something similar already? I’m really curious to hear more about why you’re setting up the error terms this way - it seems like a unique modeling strategy!