# Comparing factor scores

75 views

### Reza Norouzian

Sep 26, 2019, 12:41:09 PM9/26/19
to lavaan
When using `predict` for a fitted model in package `lavaan`, we can obtain the factor scores (fscores). However, by default these fscores are all made to have a mean of `0` (i.e., centered).

However, I want to compare fscores from two factors to see their difference. How can I compare the fscores of lavaan package?

Here is reproducible data and R code:

set.seed(0)
``````  D <- mapply(sample, 6, rep(18, 6), T) # DATA
colnames(D) <- paste0("v", 1:6)

library(lavaan)                     # MODEL
m1 <- " f1 = ~v1+v2+v3
f2 = ~v4+v5+v6 "

fit1 <- cfa(m1, data = D)            # RUN lavaan

fscore <- data.frame(predict(fit1))  # Get fscores

round(c(f1.mean = mean(fscore\$f1), f1.sd = sd(fscore\$f1), f2.mean = mean(fscore\$f2), f2.sd = sd(fscore\$f2)), 3)

#> f1.mean   f1.sd   f2.mean   f2.sd   ## Notice both f1 and f2 have a mean of ZERO. ``````
`    0.000    0.511    0.000    2.141  # How to compare f1 with f2`

### Balal Ezanloo

Sep 27, 2019, 3:43:39 AM9/27/19
to lavaan
Hi

I think you have to run measurement invarince (MI) to compare your groups' means. for example look at https://groups.google.com/forum/#!searchin/lavaan/invariance\$20test|sort:date/lavaan/O_dRFM2XtwM/WypNClyfBgAJ

### Balal Ezanloo

Sep 27, 2019, 3:53:57 AM9/27/19
to lavaan
Invarince can be done in different forms that are:

1- Conﬁgural Invariance
2- Weak Invariance
3- Strong Invariance
4- Strict Invariance
5- Invariance of the Factor Variance-Covariance Matrixes
6- Latent Mean Invariance                                                 # this is what you want

HTH

### Yves Rosseel

Sep 27, 2019, 8:41:28 AM9/27/19
The means of factor scores correspond to the (estimated) means of the
latent variables in the model.

In a single group analysis (which is what you seem to be doing), the
means for all latent variables are (by default) fixed to zero. As a
result, the factor scores also have zero means.

There are two things that puzzle me in your question:

1) if your goal is to compare latent means, you don't need factor scores
at all; you can estimate the latent means in your model directly

2) in a single-group, single-timepoint setting, the means of latent
variables are arbitrary, so there seems no point trying to compare them.

But perhaps we misunderstood your goal. Can you give us more background
on what you wish to accomplish?

Yves.