measurementInvarianceCat()?

351 views
Skip to first unread message

ya

unread,
May 11, 2015, 10:19:14 AM5/11/15
to lav...@googlegroups.com
Dear list,

I am playing with the measurementInvarianceCat() in semTools package, and got weird results and lots of warnings. Could you give me some advice about it please? Thank you very much. Please find my syntax and error massage below:

> mod="
+ #measurement model
+ bul1=~bul1_1+bul2_1+bul3_1
+ bul2=~bul1_2+bul2_2+bul3_2
+ "
> library(semTools)
> measureInvar=measurementInvarianceCat(mod,data=grades1to9,missing="pairwise",group="Boy",strict=T,
+ ordered=c("bul1_1","bul2_1","bul3_1",
+           "bul1_2","bul2_2","bul3_2"
+           )
+                                      )

#################### Measurement invariance tests ####################

#################### Model 1: configural invariance:
chisq.scaled           df       pvalue   cfi.scaled rmsea.scaled          bic 
          NA            8           NA           NA           NA           NA 

#################### Model 2: weak invariance (equal loadings):
chisq.scaled           df       pvalue   cfi.scaled rmsea.scaled          bic 
          NA            8           NA           NA           NA           NA 

[Model 1 versus model 2]
     delta.chisq         delta.df    delta.p.value        delta.cfi delta.cfi.scaled 
              NA               NA               NA                0               NA 

#################### Model 3: strong invariance (equal loadings + thresholds):
chisq.scaled           df       pvalue   cfi.scaled rmsea.scaled          bic 
          NA            8           NA           NA           NA           NA 

[Model 1 versus model 3]
     delta.chisq         delta.df    delta.p.value        delta.cfi delta.cfi.scaled 
              NA               NA               NA                0               NA 

[Model 2 versus model 3]
     delta.chisq         delta.df    delta.p.value        delta.cfi delta.cfi.scaled 
              NA               NA               NA                0               NA 

#################### Model 4: strict invariance (equal loadings + thresholds + residuals):
chisq.scaled           df       pvalue   cfi.scaled rmsea.scaled          bic 
          NA           14           NA           NA           NA           NA 

[Model 1 versus model 4]
     delta.chisq         delta.df    delta.p.value        delta.cfi delta.cfi.scaled 
              NA               NA               NA                0               NA 

[Model 2 versus model 4]
     delta.chisq         delta.df    delta.p.value        delta.cfi delta.cfi.scaled 
              NA               NA               NA                0               NA 

[Model 3 versus model 4]
     delta.chisq         delta.df    delta.p.value        delta.cfi delta.cfi.scaled 
              NA               NA               NA                0               NA 

#################### Model 5: equal loadings + thresholds + residuals + means:
chisq.scaled           df       pvalue   cfi.scaled rmsea.scaled          bic 
     577.153       16.000        0.000        0.970        0.055           NA 

[Model 1 versus model 5]
     delta.chisq         delta.df    delta.p.value        delta.cfi delta.cfi.scaled 
              NA               NA               NA                0               NA 

[Model 2 versus model 5]
     delta.chisq         delta.df    delta.p.value        delta.cfi delta.cfi.scaled 
              NA               NA               NA                0               NA 

[Model 3 versus model 5]
     delta.chisq         delta.df    delta.p.value        delta.cfi delta.cfi.scaled 
              NA               NA               NA                0               NA 

[Model 4 versus model 5]
     delta.chisq         delta.df    delta.p.value        delta.cfi delta.cfi.scaled 
              NA               NA               NA                0               NA 
There were 50 or more warnings (use warnings() to see the first 50)
> warnings()
Warning messages:
1: In lav_data_full(data = data, group = group, group.label = group.label,  ... :
  lavaan WARNING: some cases are empty and will be removed:
  2 3 7 8 10 11 12 13 15 16 18 19 20 23 25 27 29 32 33 34 36 38 39 40 41 44 45 47 58 64 65 67 71 75 76 78 79 99 102 103 105 114 118 119 121 122 123 124 127 128 132 139 142 146 150 153 155 156 158 159 162 163 164 167 168 169 173 176 177 179 180 183 184 185 187 188 194 196 197 199 204 208 211 216 218 222 225 226 228 231 232 233 234 235 236 237 240 241 243 244 248 250 253 254 260 262 264 265 266 267 269 275 276 277 279 281 285 287 288 293 294 295 296 298 300 301 302 304 305 307 309 311 313 314 316 318 319 321 325 326 330 331 333 337 338 341 347 355 356 357 365 366 370 374 376 377 379 380 381 382 385 389 391 395 397 398 399 401 404 406 407 409 410 411 413 414 418 419 421 422 423 424 426 427 428 431 432 433 436 437 438 439 442 443 445 446 448 450 451 456 458 461 462 463 466 471 475 478 479 482 488 492 494 495 496 498 499 501 502 503 504 505 507 508 509 511 512 513 514 515 516 519 521 522 526 527 530 533 535 536 541 543 547 548 553 55 [... truncated]
2: In lav_data_full(data = data, group = group, group.label = group.label,  ... :
  lavaan WARNING: some cases are empty and will be removed:
  4 6 9 21 22 24 26 28 30 31 35 37 42 43 48 49 52 53 56 60 61 62 63 66 68 69 70 72 73 74 80 82 84 88 89 90 91 92 94 97 100 101 104 107 109 112 113 117 125 126 131 133 134 135 136 137 138 140 141 143 144 145 147 148 149 151 152 154 160 161 165 170 172 174 175 178 181 189 190 191 195 198 200 201 203 207 209 210 212 213 214 215 219 220 221 223 224 229 230 238 239 242 245 246 247 249 251 252 255 256 258 259 261 263 268 270 271 272 273 274 278 280 282 283 284 286 290 291 292 297 303 306 308 310 312 320 322 323 324 327 328 329 334 335 336 339 340 342 343 344 345 348 350 351 352 353 354 358 359 360 361 362 363 364 367 368 369 371 372 373 375 378 383 384 386 387 388 390 392 393 394 396 400 402 403 405 408 412 415 416 417 420 425 429 430 434 435 440 441 444 447 449 452 453 454 457 459 460 464 465 467 468 470 473 474 476 477 483 484 485 487 489 490 497 500 506 510 517 518 520 523 524 525 528 532 534 537 538 539 540 542 545 546 549 550 551 [... truncated]
3: In pc_cor_TS(fit.y1 = FIT[[i]], fit.y2 = FIT[[j]], method = optim.method,  ... :
  lavaan WARNING: empty cell(s) in bivariate table of bul3_1 x bul1_1
4: In pc_cor_TS(fit.y1 = FIT[[i]], fit.y2 = FIT[[j]], method = optim.method,  ... :
  lavaan WARNING: empty cell(s) in bivariate table of bul3_2 x bul1_1
5: In pc_cor_TS(fit.y1 = FIT[[i]], fit.y2 = FIT[[j]], method = optim.method,  ... :
  lavaan WARNING: empty cell(s) in bivariate table of bul1_2 x bul2_1
6: In pc_cor_TS(fit.y1 = FIT[[i]], fit.y2 = FIT[[j]], method = optim.method,  ... :
  lavaan WARNING: empty cell(s) in bivariate table of bul2_2 x bul2_1
7: In pc_cor_TS(fit.y1 = FIT[[i]], fit.y2 = FIT[[j]], method = optim.method,  ... :
  lavaan WARNING: empty cell(s) in bivariate table of bul3_2 x bul2_1
8: In pc_cor_TS(fit.y1 = FIT[[i]], fit.y2 = FIT[[j]], method = optim.method,  ... :
  lavaan WARNING: empty cell(s) in bivariate table of bul1_2 x bul3_1
9: In pc_cor_TS(fit.y1 = FIT[[i]], fit.y2 = FIT[[j]], method = optim.method,  ... :
  lavaan WARNING: empty cell(s) in bivariate table of bul2_2 x bul3_1
10: In pc_cor_TS(fit.y1 = FIT[[i]], fit.y2 = FIT[[j]], method = optim.method,  ... :
  lavaan WARNING: empty cell(s) in bivariate table of bul3_2 x bul3_1


ya

yrosseel

unread,
May 11, 2015, 11:25:47 AM5/11/15
to lav...@googlegroups.com
On 05/11/2015 04:18 PM, ya wrote:
> Dear list,
>
> I am playing with the measurementInvarianceCat() in semTools package

You need to downgrade to lavaan 0.5-17. The current version of lavaan
(0.5-18) does not work with a few functions (including
measurementInvarianceCat) of the semTools package. An update of semTools
will fix this.

But having said this, I would urge you to first do the invariance steps
manually. A very nice description (including lavaan syntax) is given here:

http://www.myweb.ttu.edu/spornpra/catInvariance.html


Yves.

ya

unread,
May 11, 2015, 9:26:38 PM5/11/15
to lav...@googlegroups.com
Dear Yves,

Thank you very much for the information.

I have done the invariance steps manually using lavaan 0.5-18. It worked nicely.

Best regards,


ya
--
You received this message because you are subscribed to the Google Groups "lavaan" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lavaan+un...@googlegroups.com.
To post to this group, send email to lav...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

ya

unread,
May 15, 2015, 6:38:43 AM5/15/15
to lavaan
Dear list,

I have a follow up question when I compare output between configural and weak invariance model from lavaan and semTools. Could you give me some advice please? Thank you very much.

I found that the chi square for the weak invariance model in lavaan is smaller than that for the configural invariance model, which should not be. The df are fine in configural, weak, and strong invariance model using lavaan, semTools, and Mplus. I have compared the parameter estimates between configural and weak invariance model from lavaan output, the only difference I can locate is in the factor loadings part, that they were not equal in the configural invariance model but were constrained to be equal across groups in the weak invariance model. So my question is: did I miss anything in the lavaan model specification? Please find the lavaan and semTools code below:

mod="
#measurement model
bul1=~bul1_1+bul2_1+bul3_1+bul4_1+bul5_1+bul6_1
bul2=~bul1_2+bul2_2+bul3_2+bul4_2+bul5_2+bul6_2
bul3=~bul1_3+bul2_3+bul3_3+bul4_3+bul5_3+bul6_3
"

#configural invariance model:
> fitconfiginvar=sem(mod,data=grades1to9,missing="pairwise",group="Boy", 
+ ordered=c("bul1_1","bul2_1","bul3_1","bul4_1","bul5_1","bul6_1",
+ "bul1_2","bul2_2","bul3_2","bul4_2","bul5_2","bul6_2",
+ "bul1_3","bul2_3","bul3_3","bul4_3","bul5_3","bul6_3")
+ )
There were 50 or more warnings (use warnings() to see the first 50)
> summary(fitconfiginvar,fit.measures=T,standardized=T)
lavaan (0.5-17) converged normally after 64 iterations

Used Total
Number of observations per group
0 15666 17627
1 15395 18007

Estimator DWLS Robust
Minimum Function Test Statistic 2443.052 3153.321
Degrees of freedom 264 264
P-value (Chi-square) 0.000 0.000
Scaling correction factor 0.795
Shift parameter for each group:
0 41.258
1 40.544
for simple second-order correction (Mplus variant)

Chi-square for each group:

0 1292.929 1666.788
1 1150.123 1486.532

Model test baseline model:

Minimum Function Test Statistic 227098.254 87151.952
Degrees of freedom 306 306
P-value 0.000 0.000

User model versus baseline model:

Comparative Fit Index (CFI) 0.990 0.967
Tucker-Lewis Index (TLI) 0.989 0.961

Root Mean Square Error of Approximation:

RMSEA 0.023 0.027
90 Percent Confidence Interval 0.022 0.024 0.026 0.027
P-value RMSEA <= 0.05 1.000 1.000

Weighted Root Mean Square Residual:

WRMR 3.295 3.295

Parameter estimates:

Information Expected
Standard Errors Robust.sem 

# weak invariance model:
> fitweakinvar=sem(mod,data=grades1to9,missing="pairwise",group="Boy",group.equal=c("loadings"), 
+ ordered=c("bul1_1","bul2_1","bul3_1","bul4_1","bul5_1","bul6_1",
+ "bul1_2","bul2_2","bul3_2","bul4_2","bul5_2","bul6_2",
+ "bul1_3","bul2_3","bul3_3","bul4_3","bul5_3","bul6_3")
+ )
There were 50 or more warnings (use warnings() to see the first 50)
> summary(fitweakinvar,fit.measures=T,standardized=T)
lavaan (0.5-17) converged normally after 31 iterations

Used Total
Number of observations per group
0 15666 17627
1 15395 18007

Estimator DWLS Robust
Minimum Function Test Statistic 2576.839 2668.714
Degrees of freedom 279 279
P-value (Chi-square) 0.000 0.000
Scaling correction factor 1.004
Shift parameter for each group:
0 51.777
1 50.881
for simple second-order correction (Mplus variant)

Chi-square for each group:

0 1402.735 1448.642
1 1174.104 1220.072

Model test baseline model:

Minimum Function Test Statistic 227098.254 87151.952
Degrees of freedom 306 306
P-value 0.000 0.000

User model versus baseline model:

Comparative Fit Index (CFI) 0.990 0.972
Tucker-Lewis Index (TLI) 0.989 0.970

Root Mean Square Error of Approximation:

RMSEA 0.023 0.023
90 Percent Confidence Interval 0.022 0.024 0.023 0.024
P-value RMSEA <= 0.05 1.000 1.000

Weighted Root Mean Square Residual:

WRMR 3.384 3.384

Parameter estimates:

Information Expected
Standard Errors Robust.sem 

# measurementInvarianceCat() in semTools package
> measureInvar=measurementInvarianceCat(mod,data=grades1to9,missing="pairwise",group="Boy",strict=T,
+ ordered=c("bul1_1","bul2_1","bul3_1","bul4_1","bul5_1","bul6_1",
+ "bul1_2","bul2_2","bul3_2","bul4_2","bul5_2","bul6_2",
+ "bul1_3","bul2_3","bul3_3","bul4_3","bul5_3","bul6_3")
+ )

#################### Measurement invariance tests ####################

#################### Model 1: configural invariance:
chisq.scaled df pvalue cfi.scaled rmsea.scaled bic
3153.322 264.000 0.000 0.967 0.027 NA

#################### Model 2: weak invariance (equal loadings):
chisq.scaled df pvalue cfi.scaled rmsea.scaled bic
3463.783 279.000 0.000 0.963 0.027 NA

[Model 1 versus model 2]
delta.chisq delta.df delta.p.value delta.cfi delta.cfi.scaled
422.004 15.000 0.000 0.003 0.003

#################### Model 3: strong invariance (equal loadings + thresholds):
chisq.scaled df pvalue cfi.scaled rmsea.scaled bic
3489.870 330.000 0.000 0.964 0.025 NA

[Model 1 versus model 3]
delta.chisq delta.df delta.p.value delta.cfi delta.cfi.scaled
1107.766 66.000 0.000 0.004 0.003

[Model 2 versus model 3]
delta.chisq delta.df delta.p.value delta.cfi delta.cfi.scaled
466.498 51.000 0.000 0.001 0.000  



ya

ya

unread,
May 15, 2015, 11:40:21 AM5/15/15
to lav...@googlegroups.com
Dear list,

One more question:

Has anyone tried the strict invariance model? My strong invariance model and strict invariance model produced exactly the same output. The residual variance of the indicators were not constrained to be equal across groups although the group.equal=c("loadings","thresholds","residuals") was included in the code. Please find the code for the strong and the strict invariance model below:


mod="
#measurement model
bul1=~bul1_1+bul2_1+bul3_1+bul4_1+bul5_1+bul6_1
bul2=~bul1_2+bul2_2+bul3_2+bul4_2+bul5_2+bul6_2
bul3=~bul1_3+bul2_3+bul3_3+bul4_3+bul5_3+bul6_3
"

fitstronginvar=sem(mod,data=grades1to9,missing="pairwise",group="Boy",group.equal=c("loadings","thresholds"),

ordered=c("bul1_1","bul2_1","bul3_1","bul4_1","bul5_1","bul6_1",
          "bul1_2","bul2_2","bul3_2","bul4_2","bul5_2","bul6_2",
          "bul1_3","bul2_3","bul3_3","bul4_3","bul5_3","bul6_3")
                )
summary(fitstronginvar,fit.measures=T,standardized=T)

fitstrictinvar=sem(mod,data=grades1to9,missing="pairwise",group="Boy",group.equal=c("loadings","thresholds","residuals"),

ordered=c("bul1_1","bul2_1","bul3_1","bul4_1","bul5_1","bul6_1",
          "bul1_2","bul2_2","bul3_2","bul4_2","bul5_2","bul6_2",
          "bul1_3","bul2_3","bul3_3","bul4_3","bul5_3","bul6_3")
                )
summary(fitstrictinvar,fit.measures=T,standardized=T)


Please give me some suggestions. Thank you very much.

yrosseel

unread,
May 19, 2015, 2:43:33 AM5/19/15
to lav...@googlegroups.com
On 05/15/2015 12:37 PM, ya wrote:
> I found that the chi square for the weak invariance model in lavaan is
> smaller than that for the configural invariance model, which should not
> be.

The *robust* (=scaled) chi-square test statistic is indeed smaller in
the weak invariance model, but the original/unscaled test statistic is
larger:

configural: original = 2443, scaled = 3153
weak: original = 2576, scaled = 2668

That is because the correction is (partly) model-based, and therefore
may change from model to model. So this can happen.

However, this does NOT affect the scaled difference test, which starts
from the original test statistics.

Yves.

yrosseel

unread,
May 19, 2015, 2:44:51 AM5/19/15
to lav...@googlegroups.com
On 05/15/2015 05:35 PM, ya wrote:
> Dear list,
>
> One more question:
>
> Has anyone tried the strict invariance model? My strong invariance model
> and strict invariance model produced exactly the same output.

In the default parameterization ('delta'), the residuals are not free
parameter in the model. To test for strict invariance in the categorical
setting, you need parameterization="theta".

Yves.

ya

unread,
May 19, 2015, 4:13:05 AM5/19/15
to lavaan
Dear Yves,

Thank you very much for the response. I have added the parameterization="theta" into the code,  however, the results showed that the residual variances for the indicators are just fixed at 1 in all groups instead of constrained to be equal and freely estimated. How to freely estimate them? Please find my code below:

fitstrictinvar=sem(mod,data=grades1to9,missing="pairwise",group="Boy",group.equal=c("loadings","thresholds","residuals"),parameterization="theta",
ordered=c("bul1_1","bul2_1","bul3_1","bul4_1","bul5_1","bul6_1",
"bul1_2","bul2_2","bul3_2","bul4_2","bul5_2","bul6_2",
"bul1_3","bul2_3","bul3_3","bul4_3","bul5_3","bul6_3")
)
summary(fitstrictinvar,fit.measures=T,standardized=T)



ya
 
From: yrosseel
Date: 2015-05-19 09:44
To: lavaan
Subject: Re: measurementInvarianceCat()?

yrosseel

unread,
May 19, 2015, 4:32:35 AM5/19/15
to lav...@googlegroups.com
On 05/19/2015 10:12 AM, ya wrote:
> Dear Yves,
>
> Thank you very much for the response. I have added the
> parameterization="theta" into the code, however, the results showed
> that the residual variances for the indicators are just fixed at 1 in
> all groups instead of constrained to be equal and freely estimated. How
> to freely estimate them? Please find my code below:
>
> fitstrictinvar=sem(mod,data=grades1to9,missing="pairwise",group="Boy",group.equal=c("loadings","thresholds","residuals"),parameterization="theta",

remove "residuals" from the group.equal= argument.

Yves.

ya

unread,
May 19, 2015, 5:54:30 AM5/19/15
to lavaan
Dear Yves,

Now I have the code like this:

fitstrictinvar=sem(mod,data=grades1to9,missing="pairwise",group="Boy",group.equal=c("loadings","thresholds"),parameterization="theta",
+ ordered=c("bul1_1","bul2_1","bul3_1","bul4_1","bul5_1","bul6_1",
+           "bul1_2","bul2_2","bul3_2","bul4_2","bul5_2","bul6_2",
+           "bul1_3","bul2_3","bul3_3","bul4_3","bul5_3","bul6_3")
+                 )

although the residual variance in the second group is freely estimated now, they were not constrained to be equal across groups. Besides, when using the above code, the chi square and df were: 


Estimator                                       DWLS      Robust
  Minimum Function Test Statistic             3457.354    3489.869
  Degrees of freedom                               330         330 

whereas in the strong invariance model: 

> fitstronginvar=sem(mod,data=grades1to9,missing="pairwise",group="Boy",group.equal=c("loadings","thresholds"),
+ ordered=c("bul1_1","bul2_1","bul3_1","bul4_1","bul5_1","bul6_1",
+           "bul1_2","bul2_2","bul3_2","bul4_2","bul5_2","bul6_2",
+           "bul1_3","bul2_3","bul3_3","bul4_3","bul5_3","bul6_3")
+                 )
There were 50 or more warnings (use warnings() to see the first 50)
> summary(fitstronginvar,fit.measures=T,standardized=T)
lavaan (0.5-18) converged normally after  96 iterations
 
  Estimator                                       DWLS      Robust
  Minimum Function Test Statistic             3457.353    3489.870
  Degrees of freedom                               330         330

As you can see, the df are exactly the same, the chi square are very similar.

Did I just fit the same strong invariance model with different parameterization? Then how to fit the strict invariance model?


ya
 
From: yrosseel
Date: 2015-05-19 11:32
To: lavaan
Subject: Re: measurementInvarianceCat()?

ya

unread,
May 19, 2015, 2:18:22 PM5/19/15
to lav...@googlegroups.com
Dear list,

I have another follow up question:

Now I am in the latent parameter comparison phase. I am testing the equality of latent variance and covariance matrix across groups. So far, I got the normal outcomes for the weak invariance model and the latent variance-covariance matrix invariance model, and I tried to compare the chi square between these models:

#weak invariance model:
> fitweakinvar=sem(mod,data=grades1to9,missing="pairwise",group="Boy",group.equal=c("loadings"),

+ ordered=c("bul1_1","bul2_1","bul3_1","bul4_1","bul5_1","bul6_1",
+           "bul1_2","bul2_2","bul3_2","bul4_2","bul5_2","bul6_2",
+           "bul1_3","bul2_3","bul3_3","bul4_3","bul5_3","bul6_3")
+                 )

# latent vcov invariance model:
> fitlatentvcov=sem(mod,data=grades1to9,missing="pairwise",group="Boy",group.equal=c("loadings","lv.variances","lv.covariances"),

+ ordered=c("bul1_1","bul2_1","bul3_1","bul4_1","bul5_1","bul6_1",
+           "bul1_2","bul2_2","bul3_2","bul4_2","bul5_2","bul6_2",
+           "bul1_3","bul2_3","bul3_3","bul4_3","bul5_3","bul6_3")
+                 )

Both models terminated normally, but I got the following error when I compare them:

> anova(fitweakinvar,fitlatentvcov)
Error in solve.default(A %*% P.inv %*% t(A)) : 
  Lapack routine dgesv: system is exactly singular: U[1,1] = 0
 
Could you give me some suggestions please? Thank you very much.


ya
 
From: ya
Date: 2015-05-19 12:53
To: lavaan
Subject: Re: Re: measurementInvarianceCat()?

yrosseel

unread,
May 20, 2015, 2:40:51 AM5/20/15
to lav...@googlegroups.com
On 05/19/2015 11:53 AM, ya wrote:
> Dear Yves,
>
> Now I have the code like this:
>
> fitstrictinvar=sem(mod,data=grades1to9,missing="pairwise",group="Boy",group.equal=c("loadings","thresholds"),parameterization="theta",
> + ordered=c("bul1_1","bul2_1","bul3_1","bul4_1","bul5_1","bul6_1",
> + "bul1_2","bul2_2","bul3_2","bul4_2","bul5_2","bul6_2",
> + "bul1_3","bul2_3","bul3_3","bul4_3","bul5_3","bul6_3")
> + )
>
> although the residual variance in the second group is freely estimated
> now, they were not constrained to be equal across groups.

But you have just fitted the strong invariance model. The "residuals"
are not included in group.equal=, so the residuals will be freely
estimated in the second group.


To fit the strict invariance model, you need to set the theta
parameterizationm, and add "residuals" to the group.equal= argument.
Then, the residuals will be constrained to be equal across groups. But
they will all take on the value of the first/reference group, and this
is 1.0!

Yves.


yrosseel

unread,
May 20, 2015, 2:43:00 AM5/20/15
to lav...@googlegroups.com
On 05/19/2015 08:17 PM, ya wrote:
> > anova(fitweakinvar,fitlatentvcov)
> Error in solve.default(A %*% P.inv %*% t(A)) :
> Lapack routine dgesv: system is exactly singular: U[1,1] = 0

Ah, this is a bug in 0.5-18. It works in 0.5-17, and it works again in
the dev version 0.5-19.850 (or higher).

Yves.

ya

unread,
May 20, 2015, 3:32:32 AM5/20/15
to lavaan
Dear Yves, 

Thank you very much for the information. 

Now I am on the phase of comparing latent covaraince across groups. The latent variance were not equal across groups (chi square < 2.2e-16 ***). Does lavaan creat phantom variables internally or do I need to creat them manually? Is the operateor "=~" the right one for creating phantom variables?

Best regards,


ya
 
From: yrosseel
Date: 2015-05-20 09:42
To: lavaan
Subject: Re: measurementInvarianceCat()?

ya

unread,
May 21, 2015, 4:13:02 AM5/21/15
to lavaan
Dear list,

I am comparing a single group longitudinal weak and strong invariance model with categorical indicators, I have a question about the difference of DF between the two models. The weak invariance model has 45 df, while the strong invariance model has 77 df. I understand the difference of 36 df because of the invariance of the thresholds, but it seems the difference is only 32 df. Where are the 4 df located? Please find the code below and give me some suggestions. Thank you very much. 

weak invariance model:

longweakinv="
bul1=~bul1_1+a1*bul2_1+a2*bul3_1+a3*bul4_1;
bul2=~bul1_2+a1*bul2_2+a2*bul3_2+a3*bul4_2;
bul3=~bul1_3+a1*bul2_3+a2*bul3_3+a3*bul4_3;
bul1_1~~bul1_2;bul1_1~~bul1_3;bul1_2~~bul1_3; bul2_1~~bul2_2;bul2_1~~bul2_3;bul2_2~~bul2_3;
bul3_1~~bul3_2;bul3_1~~bul3_3;bul3_2~~bul3_3; bul4_1~~bul4_2;bul4_1~~bul4_3;bul4_2~~bul4_3
"
fitlongweakinv=sem(longweakinv,data=grades1to9,missing="pairwise",
ordered=c("bul1_1","bul2_1","bul3_1","bul4_1",
"bul1_2","bul2_2","bul3_2","bul4_2",
"bul1_3","bul2_3","bul3_3","bul4_3")
)
summary(fitlongweakinv,fit.measures=T,standardized=T) 

Strong invariance model:

longstronginv="
bul1=~bul1_1+a1*bul2_1+a2*bul3_1+a3*bul4_1;
bul2=~bul1_2+a1*bul2_2+a2*bul3_2+a3*bul4_2;
bul3=~bul1_3+a1*bul2_3+a2*bul3_3+a3*bul4_3;
bul1_1|c1*t1+c2*t2+c3*t3+c4*t4; bul1_2|c1*t1+c2*t2+c3*t3+c4*t4; bul1_3|c1*t1+c2*t2+c3*t3+c4*t4;
bul2_1|d1*t1+d2*t2+d3*t3+d4*t4; bul2_2|d1*t1+d2*t2+d3*t3+d4*t4; bul2_3|d1*t1+d2*t2+d3*t3+d4*t4;
bul3_1|e1*t1+e2*t2+e3*t3+e4*t4; bul3_2|e1*t1+e2*t2+e3*t3+e4*t4; bul3_3|e1*t1+e2*t2+e3*t3+e4*t4;
bul4_1|f1*t1+f2*t2+f3*t3+f4*t4; bul4_2|f1*t1+f2*t2+f3*t3+f4*t4; bul4_3|f1*t1+f2*t2+f3*t3+f4*t4;
bul1_1~~bul1_2;bul1_1~~bul1_3;bul1_2~~bul1_3; bul2_1~~bul2_2;bul2_1~~bul2_3;bul2_2~~bul2_3;
bul3_1~~bul3_2;bul3_1~~bul3_3;bul3_2~~bul3_3; bul4_1~~bul4_2;bul4_1~~bul4_3;bul4_2~~bul4_3
"
fitlongstronginv=sem(longstronginv,data=grades1to9,missing="pairwise",
ordered=c("bul1_1","bul2_1","bul3_1","bul4_1",
"bul1_2","bul2_2","bul3_2","bul4_2",
"bul1_3","bul2_3","bul3_3","bul4_3")
)
summary(fitlongstronginv,fit.measures=T,standardized=T)



ya
 
From: ya
Date: 2015-05-20 10:31
To: lavaan
Subject: Re: Re: measurementInvarianceCat()?
Reply all
Reply to author
Forward
0 new messages