0
$\begingroup$

I am attempting a stats assignment that has got me stumped. The original question was to fit a SEM model in lavaan (I am using R) using FIML, where two latent variables (extraversion and neuroticism) predict the latent variable of job satisfaction. I did the following syntax no problem:

model_demo <- '
       # measurement model
       extraversion =~ x1 + x2 + x3 + x4
       neuroticism =~ x5 + x6 + x7 + x8
       jobsatisfaction =~ y1 + y2 + y3 + y4
       # structural model
       jobsatisfaction ~ extraversion
       jobsatisfaction ~ neuroticism
       # residual correlations
       x2 ~~ x6
       x4 ~~ x8

      '

fit_demo <- sem(model_demo, missing = 'FIML', data=mt)
summary(fit_demo, fit.measures=TRUE, standardized=TRUE)

However, the follow up is asking the question of which individual attribute matters more for employee job satisfaction: being extraverted or not neurotic. Where their hypothesis is that extraversion and neuroticism are equally important, just that extraversion is positive and neuroticism is negative. And then asked us to specify the this constraint using a simple equation about the regression coefficients of job satisfaction on extraversion and neuroticism.

I have tried to apply equality constraints done in class:

model_demo4 <- '
       # measurement model
       extraversion =~ x1 + b1*x2 + b2*x3 + b3*x4
       neuroticism =~ x5 + b4*x6 + b5*x7 + b6*x8
       jobsatisfaction =~ y1 + y2 + y3 + y4
       # structural model
       jobsatisfaction ~ extraversion
       jobsatisfaction ~ neuroticism
       # residual correlations
       x2 ~~ x6
       x4 ~~ x8

fit_demo4 <- sem(model_demo4, missing = 'FIML',data=mt) summary(fit_demo4, fit.measures=TRUE, standardized=TRUE)

Finally, how would you then run a wald test to get the chi squared for a model comparison between the original model and the constrained model?

I tried:

lavTestWald(fit_demo, fit_demo4) 

and got an error message Error in nchar(constraints) : no method for coercing this S4 class to a vector

Any and all advice is welcomed in helping me understand constraints in this model but most importantly how to run a wald test to compare models. Thank you in advance!

$\endgroup$
1
  • $\begingroup$ You should add the self-study tag to this question. $\endgroup$ Commented Oct 31, 2016 at 18:41

1 Answer 1

1
$\begingroup$

I don't see any equality constraints in your second model.

I would add parameter labels like:

   jobsatisfaction ~ a * extraversion
   jobsatisfaction ~ b * neuroticism

Estimate that model, and then add:

a := -b

These models will be nested and you can do a chi-square difference test.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.