measurementInvarianceCat() model with constrained latent covariances

23 views
Skip to first unread message

christophe...@nicholls.edu

unread,
Jun 30, 2018, 10:12:18 AM6/30/18
to lavaan
Hello,

Is it possible to easily build a fit.object into the measurementInvarianceCat() function that constrains the latent covariances? I'm particularly interested in how latent covariances might be moderated by condition and would like a straightforward line of code that highlights this.

Thanks in advance,

Chris

Terrence Jorgensen

unread,
Jun 30, 2018, 3:48:10 PM6/30/18
to lavaan
Is it possible to easily build a fit.object into the measurementInvarianceCat() function that constrains the latent covariances?

Not in that function, but you can just update one of the models it returns.

mi <- measurementInvarianceCat(...)
fit
.latcov <- update(mi$fit.loadings, group.equal = c("loadings","lv.variances","lv.covariances"))


Terrence D. Jorgensen
Postdoctoral Researcher, Methods and Statistics
Research Institute for Child Development and Education, the University of Amsterdam

christophe...@nicholls.edu

unread,
Jul 4, 2018, 3:17:37 PM7/4/18
to lavaan
Thanks Terrence.

I followed your suggestion. That is:

fit.latcov <- update(mi$fit.loadings, group.equal = c("loadings","lv.variances","lv.covariances"))

I have a followup question. Is the output for the fit.latcov object supposed to be the same as the output for the mi$loadings object? Here is what occurs for me:

print(fit.latcov)
lavaan 0.6-2.1261 optimization ended normally (750 iterations)

  Optimization method                           NLMINB
  Number of free parameters                        724
  Number of equality constraints                   142
  Number of observations per group         
  0                                                117
  1                                                184

  Estimator                                       DWLS
  Model Fit Test Statistic                    5425.172
  Degrees of freedom                              3266
  P-value (Chi-square)                           0.000

Chi-square for each group:

  0                                           2516.448
  1                                           2908.724

print(mi$fit.loadings)
$fit.loadings
lavaan 0.6-2.1261 optimization ended normally (750 iterations)

  Optimization method                           NLMINB
  Number of free parameters                        724
  Number of equality constraints                   142
  Number of observations per group         
  0                                                117
  1                                                184

  Estimator                                       DWLS
  Model Fit Test Statistic                    5425.172
  Degrees of freedom                              3266
  P-value (Chi-square)                           0.000

Chi-square for each group:

  0                                           2516.448
  1                                           2908.724

Does the update() function actually update the original mi object? 

I'll run this on my own to verify things.

Chris

christophe...@nicholls.edu

unread,
Jul 5, 2018, 11:13:06 AM7/5/18
to lavaan
Taking a look at the results from re-running my model, using the function the update() function that you suggested doesn't change my results. Perhaps I did something wrong?

Chris

On Saturday, June 30, 2018 at 9:12:18 AM UTC-5, christophe...@nicholls.edu wrote:

Terrence Jorgensen

unread,
Jul 9, 2018, 10:02:47 AM7/9/18
to lavaan
Taking a look at the results from re-running my model, using the function the update() function that you suggested doesn't change my results. Perhaps I did something wrong?

No, you didn't.  I just forgot how that function works.  It does not create lavaan syntax, it creates a parameter table.  lavaan's group.equal= argument is only applied while creating the parameter table from syntax, so the method I suggested will not work.  Sorry.  

I'm in the middle of redesigning the measurement invariance suite in semTools, not only to be more general (e.g., any arbitrary combination of constraints across groups and/or occasions for 1 or more factors) but also to write lavaan syntax that can be easily edited by users with particular special cases.  And I also want to allow constraints on latent (co)variances.  When I have a working model of the syntax-writing function, I will probably contact you about testing it for me.

Until then, you can actually run measurementInvarianceCat() a second time with the argument group.equal = c("lv.variances","lv.covariances") so that those constraints are imposed when building the parameter tables.  Then you can extract the $fit.loadings model from that output (which will have constrained latent (co)variances), and compare it to the $fit.loadings model from the original output (without the additional constraints).
Reply all
Reply to author
Forward
0 new messages