Binary exogenous categorical variable in growth model factor vs numeric

90 views
Skip to first unread message

Nora

unread,
Apr 18, 2024, 1:56:41 AM4/18/24
to lavaan
Dear all, I run a growth model with an exogenous categorical variable (cat) coded 0/1 and get different values for my fitmeasures (cfi, tli,rmsea, chisq) when it is coded as a factor and a numeric variable. I receive no errors from Lavaan while running the model.
Do anyone know why this happens, and what format would be correct?

For context: 
growth_model <-  
  '
i1 =~ 1*ytime1 + 1*ytime2 + 1*ytime3
s1 =~ 0*ytime1 + 1.5*ytime2 + 3.5*ytime3
ytime1 ~~ ytime1
ytime2 ~~ ytime2
ytime3 ~~ ytime3
i1 ~~ i1
s1 ~~ s1
i1 ~~ s1
ytime1 ~ 0*1 + cat 
ytime2 ~ 0*1 + cat 
ytime3 ~ 0*1 + cat
i1 ~ 1
s1 ~ 1
'
model<-growth(growth_model, data=df)
fitMeasures(model)

Shu Fai Cheung (張樹輝)

unread,
Apr 19, 2024, 7:35:33 AM4/19/24
to lavaan
I believe your model is not invariant to the scaling of cat. When coded as a factor, the values are 1 and 2, which are used directly by lavaan.

You can try changing the numneric coding of cat to 1 and 2. I believe the fit measures willl be identical to those with cat coded as a factor.

You can also try changing the values of cat to, say, 2 and 3. I believe you will get another set of fit measures.

You may need to check your model specification.

-- Shu Fai

Reply all
Reply to author
Forward
Message has been deleted
Message has been deleted
0 new messages