Hello,
I would like to save factor scores as a data frame to export them as txt. later.
This has worked for a less complex cfa-model, not for MGCFA of higher order.
This would be my code:
#2nd order CFA
pa3dim22.1 <- 'anti =~ anti1 + anti2 + anti3 + anti5
souv =~ souv1 + souv2 + souv3 + souv4
hom =~ homli2 + homli1 + homli3 + homre1
pop =~ anti+souv+hom'
#metric invariance
fit.pa3dim22.3 <- cfa(pa3dim22.1, data=d4c, group="country", group.equal=c("loadings"))
predict(fit.pa3dim22.3)
fscores= as.data.frame(predict(fit.pa3dim22.3))
write.table(fscores, "Factor_Scores_CH.txt", quote=F, sep="\t", row.names=F)
The error message that I get would be this:
Error in data.frame(c(-0.651082034559646, -0.979662281594498, -0.164683697288618, :
Argumente implizieren unterschiedliche Anzahl Zeilen: 649, 640, 1260, 847
[translated: arguments imply different number of rows]
The following could be part of the problem: What I see is that a less complex model is an object of type "formal class lavan", the MGCFA is this typ: "large lavaan 1.1 MB".
I would appreciate any help!
Thank you!
Anne