I'm asked by my client to recreate cfa model in excel; with all the formulas in the cells.

I used lavaan and R to fit the model. It's a simple step to get factor scores in lavaan using predict(fit). Can it be recreated in excel?

Input: (1) excel columns with indicator variables; (2) cfa model estimates and covariances from lavaan output

Desired output: excel column with factor score, using Excel formulas

  • 2
    $\begingroup$ Factor scores are computed by the matrix of coefficients described here. It is linear algebra notation, but - if are familiar with such notation - you could implement it in Excel, though it may turn to be laborous. I can't say whether lavaan adds any nuances/modifications in its computations. $\endgroup$ – ttnphns Mar 18 '15 at 12:16
  • $\begingroup$ Thanks @ttnphns - totally expected it to be quite laborious, but don't really have a choice here. $\endgroup$ – Alex Lomizov Mar 18 '15 at 12:51
  • $\begingroup$ @AlexLomizov try ?lavPredict $\endgroup$ – AdamO Jul 12 '16 at 15:31

Since the factor scores are a linear function of the observables, once you've calculated them once, you can simply use lm to fit a linear regression between the fitted scores and the observables. The regression will give your an $R^2$ of $1$ and you can just read off the linear coefficients. You can then recreate the scores directly from the observations in excel or elsewhere.

You only need the horribly complicated linear algebra to calculate them the first time - so as long as you are not refitting the model in excel, you can just use the linear form directly.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.