A question on constraining intercept of measured items between group in a second-order CFA model

1,023 views
Skip to first unread message

chest...@gmail.com

unread,
Nov 8, 2013, 8:06:54 AM11/8/13
to lav...@googlegroups.com
Dear all,

It is my first time using lavaan and I already have fantastic experience. The output is pretty much the same as Mplus and I see a very good support group here. I am actually switching from Mplus to lavaan, due to the open source feature of lavaan and the excellent support group.

I have a question about constraining intercepts with lavaan. I tried to use group.equal code to constrain factor loadings and it works great. However, for some strange reason, I cannot use group.equal code to constrain intercept of observed variable. Below is my code:

Code:

myModel = "

  # lambda (factor loadings for all measured variables)
  LC =~ 1*Q3 + Q5 + Q9 + Q10 + Q11 + Q12 + Q13 + Q15 + Q18 + Q19 + Q20
  DD =~ 1*Q2 + Q4 + Q6 + Q7 + Q8 +Q14
  EU =~ 1*Q1 + Q16 + Q17

  # beta (causal paths)
  IAT =~ 1*LC + DD + EU
  "


fit.5 = cfa(
    myModel, data = IAT_gp2, estimator = "MLR", test = "Satorra.Bentler",
    meanstructure = TRUE, group="Gender", group.label = c("1", "2"),
    group.equal = c("loadings", "intercepts")
    )

coef(fit.5)


Below is the output:

> fit.5 = cfa(
+ myModel, data = IAT_gp2, estimator = "MLR", test = "Satorra.Bentler",
+ meanstructure = TRUE, group="Gender", group.label = c("1", "2"),
+ group.equal = c("loadings", "intercepts")
+ )
Error in solve.default(E) :
  system is computationally singular: reciprocal condition number = 2.87082e-19
In addition: Warning message:
In estimateVCOV(lavaanModel, samplestats = lavaanSampleStats, options = lavaanOptions,  :
  lavaan WARNING: could not compute standard errors!

> coef(fit.5)

> coef(fit.5)
     LC=~Q5      LC=~Q9     LC=~Q10     LC=~Q11     LC=~Q12     LC=~Q13     LC=~Q15     LC=~Q18     LC=~Q19     LC=~Q20
      0.921       0.911       1.115       1.530       1.486       1.176       1.298       1.500       1.039       1.307
     DD=~Q4      DD=~Q6      DD=~Q7      DD=~Q8     DD=~Q14     EU=~Q16     EU=~Q17     IAT=~DD     IAT=~EU      LC~~LC
      0.884       1.244       0.755       0.939       0.993       1.182       1.104       0.835       1.195      -0.015
     DD~~DD      EU~~EU    IAT~~IAT      Q3~~Q3      Q5~~Q5      Q9~~Q9    Q10~~Q10    Q11~~Q11    Q12~~Q12    Q13~~Q13
      0.161       0.048       0.424       1.255       1.257       0.853       1.118       0.700       1.281       1.333
   Q15~~Q15    Q18~~Q18    Q19~~Q19    Q20~~Q20      Q2~~Q2      Q4~~Q4      Q6~~Q6      Q7~~Q7      Q8~~Q8    Q14~~Q14
      0.533       1.052       0.965       0.921       0.771       0.994       0.597       0.961       0.296       0.798
     Q1~~Q1    Q16~~Q16    Q17~~Q17        Q3~1        Q5~1        Q9~1       Q10~1       Q11~1       Q12~1       Q13~1
      1.609       1.638       1.160       2.071       2.271       1.900       2.300       2.643       3.014       2.329
      Q15~1       Q18~1       Q19~1       Q20~1        Q2~1        Q4~1        Q6~1        Q7~1        Q8~1       Q14~1
      2.156       2.386       2.000       2.070       2.057       1.826       1.971       1.929       1.786       1.743

       Q1~1       Q16~1       Q17~1   LC~~LC.g2   DD~~DD.g2   EU~~EU.g2 IAT~~IAT.g2   Q3~~Q3.g2   Q5~~Q5.g2   Q9~~Q9.g2
      2.714       2.811       2.443      -0.019       0.147       0.136       0.488       1.184       0.730       1.170
Q10~~Q10.g2 Q11~~Q11.g2 Q12~~Q12.g2 Q13~~Q13.g2 Q15~~Q15.g2 Q18~~Q18.g2 Q19~~Q19.g2 Q20~~Q20.g2   Q2~~Q2.g2   Q4~~Q4.g2
      0.720       0.797       1.180       0.797       0.581       0.861       0.953       0.896       0.565       0.826
  Q6~~Q6.g2   Q7~~Q7.g2   Q8~~Q8.g2 Q14~~Q14.g2   Q1~~Q1.g2 Q16~~Q16.g2 Q17~~Q17.g2     Q3~1.g2     Q5~1.g2     Q9~1.g2
      0.404       1.648       0.514       0.691       0.789       0.734       0.872       2.152       2.066       2.075
   Q10~1.g2    Q11~1.g2    Q12~1.g2    Q13~1.g2    Q15~1.g2    Q18~1.g2    Q19~1.g2    Q20~1.g2     Q2~1.g2     Q4~1.g2
      1.967       2.533       2.848       2.000       1.978       2.130       1.946       2.054       1.826       1.707
    Q6~1.g2     Q7~1.g2     Q8~1.g2    Q14~1.g2     Q1~1.g2    Q16~1.g2    Q17~1.g2
      1.891       2.141       1.750       1.641       2.826       2.913       2.424



If you look at the item intercepts between group 1 and 2, they are not the same, even though I hav alrady used the constrain. Can someone tell me what is wrong with my setup?

Thank you!

Chester Kam



Alex Schoemann

unread,
Nov 8, 2013, 1:54:25 PM11/8/13
to lav...@googlegroups.com
The issue is with your higher order factor (IAT). By default latent means in both groups are set to 0 to identify and set the scale of the means. When you use group.equal to equate intercepts, the latent means are fixed to 0 in the first group for scale setting and free to vary in all other groups. With a higher order factor the mean structure must have its scale set in the first and second group. I think if you set the mean of IAT to 0 in your syntax (IAT ~0*1) you should be able to fit the model.

Alex

chest...@gmail.com

unread,
Nov 9, 2013, 2:51:59 AM11/9/13
to lav...@googlegroups.com
I'll try. Thanks!

Chester
Message has been deleted
Message has been deleted

chest...@gmail.com

unread,
Nov 9, 2013, 11:39:18 AM11/9/13
to lav...@googlegroups.com

Hi,

In an attempt to compare the intercepts of the first-order factor between male and female, I tried to follow Alex's advice by constraining the higher-level factor (IAT) to have the mean of 0. Strangely, this time, lavaan programme tried to estimate the intercepts of the first-order factor in BOTH male and female, instead of constraining the intercepts of the reference group (male) to be zero. As a result, the model cannot estimate the standard errors and other important results.

Thanks so much!

Chester

Below is my syntax:

myModel = "

  # lambda (factor loadings for all measured variables)
  LC =~ 1*Q3 + Q5 + Q9 + Q10 + Q11 + Q12 + Q13 + Q15 + Q18 + Q19 + Q20
  DD =~ 1*Q2 + Q4 + Q6 + Q7 + Q8 +Q14
  EU =~ 1*Q1 + Q16 + Q17

  # beta (causal paths)
  IAT =~ 1*LC + DD + EU

  # alpha (latent variable intercept)
  LC ~ 1
  DD ~ 1
  EU ~ 1
  IAT ~ 0*1
  "

fit.6 = cfa(


    myModel, data = IAT_gp2, estimator = "MLR", test = "Satorra.Bentler",
    meanstructure = TRUE, group="Gender", group.label = c("1", "2"),
    group.equal = c("loadings", "intercepts")
    )

summary(fit.6)

OUTPUT (with important parts highlighted in red):

lavaan (0.5-14) converged normally after  57 iterations

  Number of observations per group        
  1                                                 70
  2                                                 92

  Estimator                                         ML
  Minimum Function Test Statistic              508.283
  Degrees of freedom                               367 (the df should be 370 if the intercepts of the first-order factor in the reference group are all set to zeros)
  P-value (Chi-square)                           0.000

Chi-square for each group:

  1                                            276.698
  2                                            231.585

Parameter estimates:

  Information                                 Expected
  Standard Errors                             Standard

Group 1 [1]:

                   Estimate  Std.err  Z-value  P(>|z|)
Latent variables:
  LC =~
    Q3                1.000
    Q5                0.938
    Q9                0.901
    Q10               1.141
    Q11               1.547
    Q12               1.505
    Q13               1.202
    Q15               1.317
    Q18               1.526
    Q19               1.047
    Q20               1.316
  DD =~
    Q2                1.000
    Q4                0.881
    Q6                1.236
    Q7                0.736
    Q8                0.931
    Q14               0.988
  EU =~
    Q1                1.000
    Q16               1.181
    Q17               1.101
  IAT =~
    LC                1.000
    DD                0.850
    EU                1.212

Intercepts:
    LC                0.082
    DD                0.057
    EU               -0.032
    IAT               0.000

    Q3                2.100
    Q5                2.123
    Q9                1.960
    Q10               2.066
    Q11               2.547
    Q12               2.889
    Q13               2.094
    Q15               2.029
    Q18               2.206
    Q19               1.948
    Q20               2.035
    Q2                1.903
    Q4                1.746
    Q6                1.914
    Q7                2.005
    Q8                1.750
    Q14               1.673
    Q1                2.788
    Q16               2.877
    Q17               2.428

Variances:
    Q3                1.268
    Q5                1.263
    Q9                0.873
    Q10               1.138
    Q11               0.699
    Q12               1.280
    Q13               1.351
    Q15               0.533
    Q18               1.053
    Q19               0.967
    Q20               0.927
    Q2                0.781
    Q4                0.994
    Q6                0.598
    Q7                0.978
    Q8                0.297
    Q14               0.798
    Q1                1.609
    Q16               1.641
    Q17               1.165
    LC               -0.015
    DD                0.163
    EU                0.046
    IAT               0.414



Group 2 [2]:

                   Estimate  Std.err  Z-value  P(>|z|)
Latent variables:
  LC =~
    Q3                1.000
    Q5                0.938
    Q9                0.901
    Q10               1.141
    Q11               1.547
    Q12               1.505
    Q13               1.202
    Q15               1.317
    Q18               1.526
    Q19               1.047
    Q20               1.316
  DD =~
    Q2                1.000
    Q4                0.881
    Q6                1.236
    Q7                0.736
    Q8                0.931
    Q14               0.988
  EU =~
    Q1                1.000
    Q16               1.181
    Q17               1.101
  IAT =~
    LC                1.000
    DD                0.850
    EU                1.212

Intercepts:
    LC               -0.027
    DD               -0.023
    EU                0.022
    IAT               0.000

    Q3                2.100
    Q5                2.123
    Q9                1.960
    Q10               2.066
    Q11               2.547
    Q12               2.889
    Q13               2.094
    Q15               2.029
    Q18               2.206
    Q19               1.948
    Q20               2.035
    Q2                1.903
    Q4                1.746
    Q6                1.914
    Q7                2.005
    Q8                1.750
    Q14               1.673
    Q1                2.788
    Q16               2.877
    Q17               2.428

Variances:
    Q3                1.192
    Q5                0.731
    Q9                1.194
    Q10               0.725
    Q11               0.797
    Q12               1.180
    Q13               0.801
    Q15               0.580
    Q18               0.862
    Q19               0.955
    Q20               0.901
    Q2                0.567
    Q4                0.826
    Q6                0.404
    Q7                1.675
    Q8                0.515
    Q14               0.690
    Q1                0.790
    Q16               0.733
    Q17               0.874
    LC               -0.019
    DD                0.149
    EU                0.136
    IAT               0.476

I have also tried the set the syntax as the following but lavaan tried to set the intercepts of the first-order factor to be the same in both male and female groups:


myModel = "

  # lambda (factor loadings for all measured variables)
  LC =~ 1*Q3 + Q5 + Q9 + Q10 + Q11 + Q12 + Q13 + Q15 + Q18 + Q19 + Q20
  DD =~ 1*Q2 + Q4 + Q6 + Q7 + Q8 +Q14
  EU =~ 1*Q1 + Q16 + Q17

  # beta (causal paths)
  IAT =~ 1*LC + DD + EU

  # alpha (latent variable intercept)
  LC ~ c(0, aa)*1
  DD ~ c(0, bb)*1
  EU ~ c(0, dd)*1
  IAT ~ 0*1
  "

Selected Output:

Group 1 Intercepts:

    LC       (aa)     0.029

    DD       (bb)     0.022

    EU       (dd)    -0.002

    IAT               0.000

 

Group 2 Intercepts:

    LC       (aa)     0.029

    DD       (bb)     0.022

    EU       (dd)    -0.002

    IAT               0.000

yrosseel

unread,
Nov 9, 2013, 11:45:04 AM11/9/13
to lav...@googlegroups.com

> # alpha (latent variable intercept)
> LC ~ c(0, aa)*1
> DD ~ c(0, bb)*1
> EU ~ c(0, dd)*1
> IAT ~ 0*1

Let me zoom in on this piece of syntax. It will not work as intended.
You can not 'mix' labels and constants in the same modifier.

If you want to both 'label' and 'fix' some parameters in different
groups, you can use syntax like:

LC ~ c(aa1, aa2)*1 + c(0,NA)*1
DD ~ c(bb1, bb2)*1 + c(0,NA)*1
EU ~ c(dd1, dd2)*1 + c(0,NA)*1

In other words: you need to use two modifiers with the same variable
name (here, the constant '1')

Yves.

chest...@gmail.com

unread,
Nov 9, 2013, 8:38:04 PM11/9/13
to lav...@googlegroups.com
That works! Thanks!

Chester
Reply all
Reply to author
Forward
0 new messages