# Formula to compute factor scores (used for CFA in lavaan, to be applied in Excel)

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

• 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. – ttnphns Mar 18 '15 at 12:16
• Thanks @ttnphns - totally expected it to be quite laborious, but don't really have a choice here. – Alex Lomizov Mar 18 '15 at 12:51
• @AlexLomizov try ?lavPredict – 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.