I have a simple, one factor CFA model.
I wanted to extract from Fit object linear coefficients l_i and correction term corr such that
factor = sum(l_i*x_i) + corr,
where i is a "item" subscript and x_i are the results for item i.
I use MLM to fit the model. All my items have continuous scale.
Some time ago with a bit of help from here I got such a code:
VAR.ETA <- lavInspect(Fit, "cov.lv
MM <- lavInspect(Fit, "est")
LAMBDA <- MM$lambda
implied <- lavInspect(Fit, "implied")
Sigma.hat <- implied$cov
Sigma.hat.inv <- solve(Sigma.hat)
# factor score matrix
A <- VAR.ETA %*% t(LAMBDA) %*% Sigma.hat.inv
tA <- t(A)
# center Z - vector of responses
Zc <- t( t(Z) - colMeans(Z))
# factor scores
FS <- Zc %*% tA
But the result does'n match the lavPredict() result.
Do you know what am I doing wrong?
With all the best,