Computing factor scores manually

35 views
Skip to first unread message

MOL

unread,
Feb 20, 2019, 6:39:50 AM2/20/19
to lavaan
Hi

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,

MO
Reply all
Reply to author
Forward
0 new messages