second-order factor model works in AMOS, not in lavaan

1,144 views
Skip to first unread message

Galla Placidia

unread,
Jun 15, 2013, 11:28:06 AM6/15/13
to lav...@googlegroups.com
Hello all,

I am trying to fit a second-order model.

model4factorH <- '
 # measurement model
 # latent variable definitions
 f1 =~ PCLR1+PCLR2+PCLR4+PCLR5
 f2 =~ PCLR6+PCLR7+PCLR8+PCLR16
 f3 =~ PCLR3+PCLR9+PCLR13+PCLR14+PCLR15
 f4 =~ PCLR10+PCLR12+PCLR18+PCLR19+PCLR20
                       
                        # latent variables regressions
                        psychopathy =~ f1+f2+f3+f4
 
'
 
fit2a <- cfa(model4factorH, estimator="ML", data=eeg, std.lv=TRUE, start=fit1a, mimic="EQS")
 summary(fit2a, fit.measures=TRUE)


The data are from 18 items of a psychopathy measure. Some psychologists believe this measure has 4 factors with 6 correlations amongst themselves; others posit a four facet model with one second order factor.

I fit both models in AMOS and they converged - the 4 factor -- first order model, having the better fit. The first-order model was well estimated by lavaan (got basically the same estimates). But the second-order model does not work.


Warning message:
In estimateVCOV(lavaanModel, samplestats = lavaanSampleStats, options = lavaanOptions,  :
  lavaan WARNING: could not compute standard errors!






And in fact, some of the parameter estimates are pretty flaky -- several orders of magnitude different from the AMOS ones. I even used the parameters of the first order model as starting values, but it still would not work for me.

Strictly speaking, one should use tetrachoric correlations here, since the items of the measure or on a 3 point ordinal scale. That's why I want to use lavaan. But the tetrachoric version does not converge at all for the second-order model. It works fine for the first order model and gives a better fit, as one would expect.

So in a sense, the second-order model probably does not deserve to work in this case ... but I am a bit disturbed by the fact that AMOS produces something and lavaan does not. I would like to run tetrachorics on both models and test for the superiority of the first order model so as to replicate existing studies on the data I have.

Have I set up my parameters incorrectly?

yrosseel

unread,
Jun 15, 2013, 1:53:30 PM6/15/13
to lav...@googlegroups.com
On 06/15/2013 05:28 PM, Galla Placidia wrote:

> I fit both models in AMOS and they converged - the 4 factor -- first
> order model, having the better fit. The first-order model was well
> estimated by lavaan (got basically the same estimates). But the
> second-order model does not work.

Interesting. Could you send me your full R script + data (or at least
the covariance matrix), and perhaps also the AMOS output?

Yves.

Galla Placidia

unread,
Jul 4, 2013, 3:12:12 PM7/4/13
to lav...@googlegroups.com
Follow up. I realized that the AMOS model was not specified in the same way as the lavaan model. When I corrected the AMOS model, I got the same behaviour. False alarm.

Kenny Yahir

unread,
Dec 17, 2014, 2:52:04 AM12/17/14
to lav...@googlegroups.com
Hi all,

I'm working at a project about SEM in lavaan, but I have a few questions like, Why can't fit a second-order model?

i.e. Let  x1 ,... xn be variables which describes something and they have links with factors f_1,...,f_k , now these factors are connected with 
g1,g2 .. gp (really, just are 3). So the model is as follow:

first-order latent variables

f1 =~ x1 + x4 + ...
f2 =~ x2 + x6 + ...
.
.
.
f7 =~ x20 + x30 + ...

f1~~f2 + f3
f7~~ f8 +f9
...

second-order latent variables

g1 =~ f1 + f2 + ... 
g2 =~ f3 + ..
g3 =~ f5 + f7

with a regression

Y ~ g1 + g2 + g3

where Y represents the score of a test.

Other question, if remove the second-order factors I obtain some results in the regression, but I don't know how to interpret these values.

could someone help me?

Yves Rosseel

unread,
Dec 17, 2014, 4:24:35 AM12/17/14
to lav...@googlegroups.com
On 12/17/2014 08:52 AM, Kenny Yahir wrote:
> I'm working at a project about SEM in lavaan, but I have a few questions
> like, Why can't fit a second-order model?

There is no reason: lavaan can fit second-order factor models just fine.

> i.e. Let x1 ,... xn be variables which describes something and they
> have links with factors f_1,...,f_k , now these factors are connected with
> g1,g2 .. gp (really, just are 3). So the model is as follow:
>
> first-order latent variables
>
> f1 =~ x1 + x4 + ...
> f2 =~ x2 + x6 + ...
> .
> .
> .
> f7 =~ x20 + x30 + ...
>
> f1~~f2 + f3
> f7~~ f8 +f9
> ...
>
> second-order latent variables
>
> g1 =~ f1 + f2 + ...
> g2 =~ f3 + ..
> g3 =~ f5 + f7
>
> with a regression
>
> Y ~ g1 + g2 + g3
>
> where Y represents the score of a test.

In principle, this should work. We may help you better if you show us
your full R script, and if you also provide a snippet of your data. What
goes wrong? Do you get a warning/error?

With simulated data, this setup runs just fine:

library(lavaan)

# create data
pop.model <- '
f1 =~ x1 + x2 + x3
f2 =~ x4 + x5 + x6
f3 =~ x7 + x8 + x9
f4 =~ x10 + x11 + x12
f5 =~ x13 + x14 + x15
f6 =~ x16 + x17 + x18
f7 =~ x19 + x20 + x21
f8 =~ x22 + x23 + x24
f9 =~ x25 + x26 + x27

g1 =~ f1 + f2 + f3
g2 =~ f4 + f5 + f6
g3 =~ f7 + f8 + f9

Y ~ 0.5?g1 + 0.8?g2 + 1.5?g3
'
Data <- simulateData(pop.model, sample.nobs = 10000)
fit <- sem(pop.model, data = Data)


> Other question, if remove the second-order factors I obtain some results
> in the regression, but I don't know how to interpret these values.

They are ordinary regression coefficients. They give you the (predicted)
change in the dependent for a one-unit change in the predictor (say,
g1), if you keep the other predictors constant.

Yves.

Kenny Yahir

unread,
Dec 18, 2014, 3:45:32 PM12/18/14
to lav...@googlegroups.com
Here I send my data base and my script, about what you sent me I checked it and it already works but I can't identify what is the problem with my model that's what I asked for your help. 

Thanks for your attention. 

Kenny.
Creencias.R
DatosCalif.RData

Yves Rosseel

unread,
Dec 19, 2014, 4:01:38 AM12/19/14
to lav...@googlegroups.com
On 12/18/2014 09:45 PM, Kenny Yahir wrote:
> Here I send my data base and my script, about what you sent me I checked
> it and it already works but I can't identify what is the problem with my
> model

It is not your model. It is the data. There are two key problems:

1) your data is categorical (1/2/3/4)
2) some factors have indicators that have almost nothing in common (eg f4)

So, I would recommend building your model factor by factor, and treating
the indicators as 'ordered' variables:

fit <- sem(modelo2,data = datos, ordered = names(datos), verbose = TRUE)

This will take longer, but will work for your data. You will get lots of
warnings() about empty cells (in the bivariate frequency tables).
Inspect those tables one by one.

Only use first-order factors at first. Later, you can add the
second-order factors. And then, when the measurement part fits well, you
can add the regression.

Yves.
Reply all
Reply to author
Forward
0 new messages