Chapter 31 Week 6 - Class

Start with your last model from Question 11 of the THE. Note that ‘Depression’ and ‘use of narcotic substances’ are completely independent in the model, i.e. they are not predicted by anything. Usually we would estimate a covariance between them, otherwise the model restricts the covariance to be zero. However, to replicate the original results, it is important to NOT estimate this covariance (fix it to zero).

31.0.1 Question 1

We can modify this general model for all cases into a multi-group model with two groups (males and females). Why is this a good method to study moderation? (or in other words, what are the two research questions we can investigate with a multi-group model?)

Click for explanation

Because we can investigate 1) whether the model itself is different for boys and girls and 2) whether the size of regression coefficients differ

31.0.2 Question 2

Estimate a multi-group model, with gender as grouping variable. In case you forgot how to do this, see the first of the class exercise from week 4. Look at the fit of the model, what do you find?

Click for explanation
model <- "
suirisk ~ hopeless + depression + subabuse
hopeless ~ depression + selfesteem
selfesteem ~ depression
subabuse ~~ 0*depression
"

fit <- sem(model, data, 
                   group = "gender")
summary(fit, fit.measures = TRUE)
## lavaan 0.6-9 ended normally after 71 iterations
## 
##   Estimator                                         ML
##   Optimization method                           NLMINB
##   Number of model parameters                        32
##                                                       
##   Number of observations per group:                   
##     males                                          192
##     females                                        329
##                                                       
## Model Test User Model:
##                                                       
##   Test statistic                                75.329
##   Degrees of freedom                                 8
##   P-value (Chi-square)                           0.000
##   Test statistic for each group:
##     males                                       26.329
##     females                                     49.000
## 
## Model Test Baseline Model:
## 
##   Test statistic                               829.489
##   Degrees of freedom                                20
##   P-value                                        0.000
## 
## User Model versus Baseline Model:
## 
##   Comparative Fit Index (CFI)                    0.917
##   Tucker-Lewis Index (TLI)                       0.792
## 
## Loglikelihood and Information Criteria:
## 
##   Loglikelihood user model (H0)              -6897.478
##   Loglikelihood unrestricted model (H1)      -6859.814
##                                                       
##   Akaike (AIC)                               13858.956
##   Bayesian (BIC)                             13995.140
##   Sample-size adjusted Bayesian (BIC)        13893.565
## 
## Root Mean Square Error of Approximation:
## 
##   RMSEA                                          0.180
##   90 Percent confidence interval - lower         0.144
##   90 Percent confidence interval - upper         0.218
##   P-value RMSEA <= 0.05                          0.000
## 
## Standardized Root Mean Square Residual:
## 
##   SRMR                                           0.124
## 
## Parameter Estimates:
## 
##   Standard errors                             Standard
##   Information                                 Expected
##   Information saturated (h1) model          Structured
## 
## 
## Group 1 [males]:
## 
## Regressions:
##                    Estimate  Std.Err  z-value  P(>|z|)
##   suirisk ~                                           
##     hopeless          0.025    0.056    0.454    0.650
##     depression        0.111    0.020    5.644    0.000
##     subabuse          0.121    0.041    2.977    0.003
##   hopeless ~                                          
##     depression        0.161    0.024    6.640    0.000
##     selfesteem       -0.166    0.033   -4.973    0.000
##   selfesteem ~                                        
##     depression       -0.514    0.037  -13.811    0.000
## 
## Covariances:
##                    Estimate  Std.Err  z-value  P(>|z|)
##   depression ~~                                       
##     subabuse          0.000                           
## 
## Intercepts:
##                    Estimate  Std.Err  z-value  P(>|z|)
##    .suirisk           1.592    0.204    7.787    0.000
##    .hopeless          7.420    1.221    6.075    0.000
##    .selfesteem       36.189    0.373   97.030    0.000
##     depression        6.391    0.558   11.460    0.000
##     subabuse          3.089    0.194   15.943    0.000
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)
##    .suirisk           2.277    0.232    9.798    0.000
##    .hopeless          3.399    0.347    9.798    0.000
##    .selfesteem       15.860    1.619    9.798    0.000
##     depression       59.707    6.094    9.798    0.000
##     subabuse          7.206    0.735    9.798    0.000
## 
## 
## Group 2 [females]:
## 
## Regressions:
##                    Estimate  Std.Err  z-value  P(>|z|)
##   suirisk ~                                           
##     hopeless          0.045    0.041    1.104    0.270
##     depression        0.050    0.015    3.282    0.001
##     subabuse          0.059    0.014    4.138    0.000
##   hopeless ~                                          
##     depression        0.148    0.017    8.482    0.000
##     selfesteem       -0.221    0.026   -8.612    0.000
##   selfesteem ~                                        
##     depression       -0.372    0.031  -11.841    0.000
## 
## Covariances:
##                    Estimate  Std.Err  z-value  P(>|z|)
##   depression ~~                                       
##     subabuse          0.000                           
## 
## Intercepts:
##                    Estimate  Std.Err  z-value  P(>|z|)
##    .suirisk           1.981    0.132   14.970    0.000
##    .hopeless          8.896    0.875   10.172    0.000
##    .selfesteem       33.640    0.305  110.183    0.000
##     depression        6.073    0.418   14.525    0.000
##     subabuse          0.939    0.355    2.646    0.008
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)
##    .suirisk           2.749    0.214   12.826    0.000
##    .hopeless          4.045    0.315   12.826    0.000
##    .selfesteem       18.685    1.457   12.826    0.000
##     depression       57.514    4.484   12.826    0.000
##     subabuse         41.461    3.233   12.826    0.000

31.0.3 Question 3

Mehta et al. (1998) state that their model can be improved post-hoc by adding and removing a path to this model. Follow their procedure, and first add a path for both males and females, and secondly, remove a nonsignificant path.

Click for explanation
model_exploratory <- "
suirisk ~ depression + subabuse
hopeless ~ depression + selfesteem
selfesteem ~ depression
subabuse ~ hopeless
subabuse ~~ 0*depression
"

fit_exploratory <- sem(model_exploratory, data, 
                   group = "gender")
summary(fit_exploratory, fit.measures = TRUE)
## lavaan 0.6-9 ended normally after 89 iterations
## 
##   Estimator                                         ML
##   Optimization method                           NLMINB
##   Number of model parameters                        32
##                                                       
##   Number of observations per group:                   
##     males                                          192
##     females                                        329
##                                                       
## Model Test User Model:
##                                                       
##   Test statistic                                22.123
##   Degrees of freedom                                 8
##   P-value (Chi-square)                           0.005
##   Test statistic for each group:
##     males                                        1.091
##     females                                     21.031
## 
## Model Test Baseline Model:
## 
##   Test statistic                               829.489
##   Degrees of freedom                                20
##   P-value                                        0.000
## 
## User Model versus Baseline Model:
## 
##   Comparative Fit Index (CFI)                    0.983
##   Tucker-Lewis Index (TLI)                       0.956
## 
## Loglikelihood and Information Criteria:
## 
##   Loglikelihood user model (H0)              -6870.875
##   Loglikelihood unrestricted model (H1)      -6859.814
##                                                       
##   Akaike (AIC)                               13805.750
##   Bayesian (BIC)                             13941.934
##   Sample-size adjusted Bayesian (BIC)        13840.359
## 
## Root Mean Square Error of Approximation:
## 
##   RMSEA                                          0.082
##   90 Percent confidence interval - lower         0.042
##   90 Percent confidence interval - upper         0.124
##   P-value RMSEA <= 0.05                          0.085
## 
## Standardized Root Mean Square Residual:
## 
##   SRMR                                           0.035
## 
## Parameter Estimates:
## 
##   Standard errors                             Standard
##   Information                                 Expected
##   Information saturated (h1) model          Structured
## 
## 
## Group 1 [males]:
## 
## Regressions:
##                    Estimate  Std.Err  z-value  P(>|z|)
##   suirisk ~                                           
##     depression        0.117    0.015    8.030    0.000
##     subabuse          0.126    0.042    2.998    0.003
##   hopeless ~                                          
##     depression        0.161    0.024    6.640    0.000
##     selfesteem       -0.166    0.033   -4.973    0.000
##   selfesteem ~                                        
##     depression       -0.514    0.037  -13.811    0.000
##   subabuse ~                                          
##     hopeless          0.346    0.066    5.215    0.000
## 
## Covariances:
##                    Estimate  Std.Err  z-value  P(>|z|)
##  .subabuse ~~                                         
##     depression        0.000                           
## 
## Intercepts:
##                    Estimate  Std.Err  z-value  P(>|z|)
##    .suirisk           1.616    0.177    9.127    0.000
##    .hopeless          7.420    1.221    6.075    0.000
##    .selfesteem       36.189    0.373   97.030    0.000
##    .subabuse          2.056    0.268    7.661    0.000
##     depression        6.391    0.558   11.460    0.000
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)
##    .suirisk           2.280    0.233    9.798    0.000
##    .hopeless          3.399    0.347    9.798    0.000
##    .selfesteem       15.860    1.619    9.798    0.000
##    .subabuse          6.312    0.644    9.798    0.000
##     depression       59.707    6.094    9.798    0.000
## 
## 
## Group 2 [females]:
## 
## Regressions:
##                    Estimate  Std.Err  z-value  P(>|z|)
##   suirisk ~                                           
##     depression        0.060    0.012    4.903    0.000
##     subabuse          0.061    0.014    4.194    0.000
##   hopeless ~                                          
##     depression        0.148    0.017    8.482    0.000
##     selfesteem       -0.221    0.026   -8.612    0.000
##   selfesteem ~                                        
##     depression       -0.372    0.031  -11.841    0.000
##   subabuse ~                                          
##     hopeless          0.663    0.120    5.523    0.000
## 
## Covariances:
##                    Estimate  Std.Err  z-value  P(>|z|)
##  .subabuse ~~                                         
##     depression        0.000                           
## 
## Intercepts:
##                    Estimate  Std.Err  z-value  P(>|z|)
##    .suirisk           2.049    0.117   17.461    0.000
##    .hopeless          8.896    0.875   10.172    0.000
##    .selfesteem       33.640    0.305  110.183    0.000
##    .subabuse         -0.958    0.483   -1.984    0.047
##     depression        6.073    0.418   14.525    0.000
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)
##    .suirisk           2.759    0.215   12.826    0.000
##    .hopeless          4.045    0.315   12.826    0.000
##    .selfesteem       18.685    1.457   12.826    0.000
##    .subabuse         37.944    2.958   12.826    0.000
##     depression       57.514    4.484   12.826    0.000

31.0.4 Question 4

Evaluate the path coefficients of both males and females (tip: look at both the unstandardized and standardized coefficients). Can you explain how the two groups differ?

Click for explanation
summary(fit, fit.measures = FALSE, standardized = TRUE)
## lavaan 0.6-9 ended normally after 71 iterations
## 
##   Estimator                                         ML
##   Optimization method                           NLMINB
##   Number of model parameters                        32
##                                                       
##   Number of observations per group:                   
##     males                                          192
##     females                                        329
##                                                       
## Model Test User Model:
##                                                       
##   Test statistic                                75.329
##   Degrees of freedom                                 8
##   P-value (Chi-square)                           0.000
##   Test statistic for each group:
##     males                                       26.329
##     females                                     49.000
## 
## Parameter Estimates:
## 
##   Standard errors                             Standard
##   Information                                 Expected
##   Information saturated (h1) model          Structured
## 
## 
## Group 1 [males]:
## 
## Regressions:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   suirisk ~                                                             
##     hopeless          0.025    0.056    0.454    0.650    0.025    0.039
##     depression        0.111    0.020    5.644    0.000    0.111    0.479
##     subabuse          0.121    0.041    2.977    0.003    0.121    0.181
##   hopeless ~                                                            
##     depression        0.161    0.024    6.640    0.000    0.161    0.456
##     selfesteem       -0.166    0.033   -4.973    0.000   -0.166   -0.342
##   selfesteem ~                                                          
##     depression       -0.514    0.037  -13.811    0.000   -0.514   -0.706
## 
## Covariances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   depression ~~                                                         
##     subabuse          0.000                               0.000    0.000
## 
## Intercepts:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .suirisk           1.592    0.204    7.787    0.000    1.592    0.889
##    .hopeless          7.420    1.221    6.075    0.000    7.420    2.714
##    .selfesteem       36.189    0.373   97.030    0.000   36.189    6.436
##     depression        6.391    0.558   11.460    0.000    6.391    0.827
##     subabuse          3.089    0.194   15.943    0.000    3.089    1.151
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .suirisk           2.277    0.232    9.798    0.000    2.277    0.710
##    .hopeless          3.399    0.347    9.798    0.000    3.399    0.455
##    .selfesteem       15.860    1.619    9.798    0.000   15.860    0.502
##     depression       59.707    6.094    9.798    0.000   59.707    1.000
##     subabuse          7.206    0.735    9.798    0.000    7.206    1.000
## 
## 
## Group 2 [females]:
## 
## Regressions:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   suirisk ~                                                             
##     hopeless          0.045    0.041    1.104    0.270    0.045    0.073
##     depression        0.050    0.015    3.282    0.001    0.050    0.216
##     subabuse          0.059    0.014    4.138    0.000    0.059    0.214
##   hopeless ~                                                            
##     depression        0.148    0.017    8.482    0.000    0.148    0.397
##     selfesteem       -0.221    0.026   -8.612    0.000   -0.221   -0.403
##   selfesteem ~                                                          
##     depression       -0.372    0.031  -11.841    0.000   -0.372   -0.547
## 
## Covariances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##   depression ~~                                                         
##     subabuse          0.000                               0.000    0.000
## 
## Intercepts:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .suirisk           1.981    0.132   14.970    0.000    1.981    1.122
##    .hopeless          8.896    0.875   10.172    0.000    8.896    3.144
##    .selfesteem       33.640    0.305  110.183    0.000   33.640    6.516
##     depression        6.073    0.418   14.525    0.000    6.073    0.801
##     subabuse          0.939    0.355    2.646    0.008    0.939    0.146
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)   Std.lv  Std.all
##    .suirisk           2.749    0.214   12.826    0.000    2.749    0.883
##    .hopeless          4.045    0.315   12.826    0.000    4.045    0.505
##    .selfesteem       18.685    1.457   12.826    0.000   18.685    0.701
##     depression       57.514    4.484   12.826    0.000   57.514    1.000
##     subabuse         41.461    3.233   12.826    0.000   41.461    1.000

31.0.5 Question 5

We can test the difference between males and females more formally in two ways:

  1. By constraining the size of the regression coefficients to be equal in both groups and doing a test for nested models/
  2. By computing (:=) a parameter for the difference between the two groups, and looking at its p-value, or a bootstrapped confidence interval.

Why are these approaches both preferrable over just comparing regression coefficients by sight?

Click for explanation

Even if we observe differences, we do not know whether they are significantly different. By constraining parameters to be equal, we can test two models. 1) the free model against 2) the constrained model. This is done using a Chi-square difference test. By computing a difference parameter, we can do a parameteric test or bootstrap confidence interval for the difference.

31.0.6 Question 6

Constrain the regression coefficients for males and females. Compare the unconstrained model to the model with constrained regression coefficients. What is your conclusion?

Click for explanation

First, estimate the constrained model. We can use the model from the first exercise:

fit_fix_reg <- sem(model, data,
                   group = "gender",
                   group.equal = "regressions")
summary(fit_fix_reg, fit.measures = TRUE)
## lavaan 0.6-9 ended normally after 49 iterations
## 
##   Estimator                                         ML
##   Optimization method                           NLMINB
##   Number of model parameters                        32
##   Number of equality constraints                     6
##                                                       
##   Number of observations per group:                   
##     males                                          192
##     females                                        329
##                                                       
## Model Test User Model:
##                                                       
##   Test statistic                                98.420
##   Degrees of freedom                                14
##   P-value (Chi-square)                           0.000
##   Test statistic for each group:
##     males                                       40.746
##     females                                     57.674
## 
## Model Test Baseline Model:
## 
##   Test statistic                               829.489
##   Degrees of freedom                                20
##   P-value                                        0.000
## 
## User Model versus Baseline Model:
## 
##   Comparative Fit Index (CFI)                    0.896
##   Tucker-Lewis Index (TLI)                       0.851
## 
## Loglikelihood and Information Criteria:
## 
##   Loglikelihood user model (H0)              -6909.024
##   Loglikelihood unrestricted model (H1)      -6859.814
##                                                       
##   Akaike (AIC)                               13870.048
##   Bayesian (BIC)                             13980.697
##   Sample-size adjusted Bayesian (BIC)        13898.167
## 
## Root Mean Square Error of Approximation:
## 
##   RMSEA                                          0.152
##   90 Percent confidence interval - lower         0.125
##   90 Percent confidence interval - upper         0.181
##   P-value RMSEA <= 0.05                          0.000
## 
## Standardized Root Mean Square Residual:
## 
##   SRMR                                           0.136
## 
## Parameter Estimates:
## 
##   Standard errors                             Standard
##   Information                                 Expected
##   Information saturated (h1) model          Structured
## 
## 
## Group 1 [males]:
## 
## Regressions:
##                    Estimate  Std.Err  z-value  P(>|z|)
##   suirisk ~                                           
##     hopelss (.p1.)    0.049    0.033    1.462    0.144
##     deprssn (.p2.)    0.075    0.012    6.150    0.000
##     subabus (.p3.)    0.058    0.014    4.300    0.000
##   hopeless ~                                          
##     deprssn (.p4.)    0.151    0.014   10.681    0.000
##     selfstm (.p5.)   -0.199    0.020   -9.856    0.000
##   selfesteem ~                                        
##     deprssn (.p6.)   -0.431    0.024  -17.787    0.000
## 
## Covariances:
##                    Estimate  Std.Err  z-value  P(>|z|)
##   depression ~~                                       
##     subabuse          0.000                           
## 
## Intercepts:
##                    Estimate  Std.Err  z-value  P(>|z|)
##    .suirisk           1.945    0.142   13.735    0.000
##    .hopeless          8.576    0.737   11.640    0.000
##    .selfesteem       35.658    0.330  108.161    0.000
##     depression        6.391    0.558   11.460    0.000
##     subabuse          3.089    0.194   15.943    0.000
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)
##    .suirisk           2.379    0.243    9.798    0.000
##    .hopeless          3.420    0.349    9.798    0.000
##    .selfesteem       16.273    1.661    9.798    0.000
##     depression       59.707    6.094    9.798    0.000
##     subabuse          7.206    0.735    9.798    0.000
## 
## 
## Group 2 [females]:
## 
## Regressions:
##                    Estimate  Std.Err  z-value  P(>|z|)
##   suirisk ~                                           
##     hopelss (.p1.)    0.049    0.033    1.462    0.144
##     deprssn (.p2.)    0.075    0.012    6.150    0.000
##     subabus (.p3.)    0.058    0.014    4.300    0.000
##   hopeless ~                                          
##     deprssn (.p4.)    0.151    0.014   10.681    0.000
##     selfstm (.p5.)   -0.199    0.020   -9.856    0.000
##   selfesteem ~                                        
##     deprssn (.p6.)   -0.431    0.024  -17.787    0.000
## 
## Covariances:
##                    Estimate  Std.Err  z-value  P(>|z|)
##   depression ~~                                       
##     subabuse          0.000                           
## 
## Intercepts:
##                    Estimate  Std.Err  z-value  P(>|z|)
##    .suirisk           1.821    0.119   15.352    0.000
##    .hopeless          8.199    0.700   11.719    0.000
##    .selfesteem       33.995    0.281  120.946    0.000
##     depression        6.073    0.418   14.525    0.000
##     subabuse          0.939    0.355    2.646    0.008
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)
##    .suirisk           2.786    0.217   12.826    0.000
##    .hopeless          4.056    0.316   12.826    0.000
##    .selfesteem       18.882    1.472   12.826    0.000
##     depression       57.515    4.484   12.826    0.000
##     subabuse         41.461    3.233   12.826    0.000

Then, compare the two models. I like to use semTools::compareFit():

library(semTools)
compareFit(Free = fit,
           Constrained = fit_fix_reg)
## The following lavaan models were compared:
##     Free
##     Constrained
## To view results, assign the compareFit() output to an object and  use the summary() method; see the class?FitDiff help page.

The model gets significantly worse. This means the regression coefficients for males and females are not equal.

31.0.7 Specific differences

Just knowing that regression coefficients differ, is interesting in itself. Reflect here on the conclusion of Mehta et al. 1998. Do they test for significant moderation?

After doing this omnibus (overall) test, it is interesting to know which parameters, speciffically, differ. We can do this by computing new parameters for the difference between men and women. These new parameters will be tested using Z-tests and corresponding p-values. For a non-parametric test, you will have to bootstrap your analysis (see the explanation about bootstrapping indirect effects).

We use a similar approach to the one we used to compute indirect effects:

  1. Label every path in your model
  2. Define new parameters as the difference between corresponding parameters for men and women
model_diff <- "
suirisk ~ c(m1, f1)*hopeless + c(m2, f2)*depression + c(m3, f3)*subabuse
hopeless ~ c(m4, f4)*depression + c(m5, f5)*selfesteem
selfesteem ~ c(m6, f6)*depression
subabuse ~~ 0*depression

D1 := m1-f1
D2 := m2-f2
D3 := m3-f3
D4 := m4-f4
D5 := m5-f5
D6 := m6-f6
"

31.0.8 Question 7

Fit this model, and inspect the results for the defined parameters. What are your conclusions?

Click for explanation
fit_dif <- sem(model_diff, data, 
                   group = "gender")
summary(fit_dif)
## lavaan 0.6-9 ended normally after 71 iterations
## 
##   Estimator                                         ML
##   Optimization method                           NLMINB
##   Number of model parameters                        32
##                                                       
##   Number of observations per group:                   
##     males                                          192
##     females                                        329
##                                                       
## Model Test User Model:
##                                                       
##   Test statistic                                75.329
##   Degrees of freedom                                 8
##   P-value (Chi-square)                           0.000
##   Test statistic for each group:
##     males                                       26.329
##     females                                     49.000
## 
## Parameter Estimates:
## 
##   Standard errors                             Standard
##   Information                                 Expected
##   Information saturated (h1) model          Structured
## 
## 
## Group 1 [males]:
## 
## Regressions:
##                    Estimate  Std.Err  z-value  P(>|z|)
##   suirisk ~                                           
##     hopeless  (m1)    0.025    0.056    0.454    0.650
##     depressin (m2)    0.111    0.020    5.644    0.000
##     subabuse  (m3)    0.121    0.041    2.977    0.003
##   hopeless ~                                          
##     depressin (m4)    0.161    0.024    6.640    0.000
##     selfestem (m5)   -0.166    0.033   -4.973    0.000
##   selfesteem ~                                        
##     depressin (m6)   -0.514    0.037  -13.811    0.000
## 
## Covariances:
##                    Estimate  Std.Err  z-value  P(>|z|)
##   depression ~~                                       
##     subabuse          0.000                           
## 
## Intercepts:
##                    Estimate  Std.Err  z-value  P(>|z|)
##    .suirisk           1.592    0.204    7.787    0.000
##    .hopeless          7.420    1.221    6.075    0.000
##    .selfesteem       36.189    0.373   97.030    0.000
##     depression        6.391    0.558   11.460    0.000
##     subabuse          3.089    0.194   15.943    0.000
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)
##    .suirisk           2.277    0.232    9.798    0.000
##    .hopeless          3.399    0.347    9.798    0.000
##    .selfesteem       15.860    1.619    9.798    0.000
##     depression       59.707    6.094    9.798    0.000
##     subabuse          7.206    0.735    9.798    0.000
## 
## 
## Group 2 [females]:
## 
## Regressions:
##                    Estimate  Std.Err  z-value  P(>|z|)
##   suirisk ~                                           
##     hopeless  (f1)    0.045    0.041    1.104    0.270
##     depressin (f2)    0.050    0.015    3.282    0.001
##     subabuse  (f3)    0.059    0.014    4.138    0.000
##   hopeless ~                                          
##     depressin (f4)    0.148    0.017    8.482    0.000
##     selfestem (f5)   -0.221    0.026   -8.612    0.000
##   selfesteem ~                                        
##     depressin (f6)   -0.372    0.031  -11.841    0.000
## 
## Covariances:
##                    Estimate  Std.Err  z-value  P(>|z|)
##   depression ~~                                       
##     subabuse          0.000                           
## 
## Intercepts:
##                    Estimate  Std.Err  z-value  P(>|z|)
##    .suirisk           1.981    0.132   14.970    0.000
##    .hopeless          8.896    0.875   10.172    0.000
##    .selfesteem       33.640    0.305  110.183    0.000
##     depression        6.073    0.418   14.525    0.000
##     subabuse          0.939    0.355    2.646    0.008
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)
##    .suirisk           2.749    0.214   12.826    0.000
##    .hopeless          4.045    0.315   12.826    0.000
##    .selfesteem       18.685    1.457   12.826    0.000
##     depression       57.514    4.484   12.826    0.000
##     subabuse         41.461    3.233   12.826    0.000
## 
## Defined Parameters:
##                    Estimate  Std.Err  z-value  P(>|z|)
##     D1               -0.020    0.069   -0.291    0.771
##     D2                0.061    0.025    2.436    0.015
##     D3                0.062    0.043    1.443    0.149
##     D4                0.013    0.030    0.445    0.656
##     D5                0.055    0.042    1.301    0.193
##     D6               -0.142    0.049   -2.908    0.004

Only the effect of depression on suicide risk, and the effect of depression on selfesteem, are significantly different between the sexes.

31.0.9 Question 8

Is there anything we should consider when inspecting these p-values?

Click for explanation

You should consider the potential risk of multiple testing, and whether the assumption of normality holds.

31.0.10 Results table

When you want to include your results in a paper, it’s a lot of work to copy-paste everything. There are many ways to get R results directly into a paper, including writing the entire paper in R and automatically updating the results. I will show you a very basic way to make a table and export it to a spreadsheet. We will use the functions parameterEstimates(fit, standardized = TRUE) to get the unstandardized and standardized estimates, and then put them into a nice table:

table_results <- parameterEstimates(fit, standardized = TRUE)
head(table_results)

Then, we take only the labeled parameters (which are the regression coefficients and difference parameters):

table_results <- table_results[table_results$label != "", ]
table_results <- cbind(table_results[1:6, 1:3],
               Est_men = table_results[1:6, "std.all"],
               Est_women = table_results[7:12, "std.all"],
               p_diff = table_results[13:18, "pvalue"])
write.csv(table_results, "table_results.csv", row.names = FALSE)

31.0.11 Question 9

Interpret the effect sizes (standardized estimates) for males and females. What are your conclusions?

31.0.12 Question 10

Evaluate R-square for suicide risk for males and females. What do you find?

Click for explanation
summary(fit, rsquare = TRUE)
## lavaan 0.6-9 ended normally after 71 iterations
## 
##   Estimator                                         ML
##   Optimization method                           NLMINB
##   Number of model parameters                        32
##                                                       
##   Number of observations per group:                   
##     males                                          192
##     females                                        329
##                                                       
## Model Test User Model:
##                                                       
##   Test statistic                                75.329
##   Degrees of freedom                                 8
##   P-value (Chi-square)                           0.000
##   Test statistic for each group:
##     males                                       26.329
##     females                                     49.000
## 
## Parameter Estimates:
## 
##   Standard errors                             Standard
##   Information                                 Expected
##   Information saturated (h1) model          Structured
## 
## 
## Group 1 [males]:
## 
## Regressions:
##                    Estimate  Std.Err  z-value  P(>|z|)
##   suirisk ~                                           
##     hopeless          0.025    0.056    0.454    0.650
##     depression        0.111    0.020    5.644    0.000
##     subabuse          0.121    0.041    2.977    0.003
##   hopeless ~                                          
##     depression        0.161    0.024    6.640    0.000
##     selfesteem       -0.166    0.033   -4.973    0.000
##   selfesteem ~                                        
##     depression       -0.514    0.037  -13.811    0.000
## 
## Covariances:
##                    Estimate  Std.Err  z-value  P(>|z|)
##   depression ~~                                       
##     subabuse          0.000                           
## 
## Intercepts:
##                    Estimate  Std.Err  z-value  P(>|z|)
##    .suirisk           1.592    0.204    7.787    0.000
##    .hopeless          7.420    1.221    6.075    0.000
##    .selfesteem       36.189    0.373   97.030    0.000
##     depression        6.391    0.558   11.460    0.000
##     subabuse          3.089    0.194   15.943    0.000
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)
##    .suirisk           2.277    0.232    9.798    0.000
##    .hopeless          3.399    0.347    9.798    0.000
##    .selfesteem       15.860    1.619    9.798    0.000
##     depression       59.707    6.094    9.798    0.000
##     subabuse          7.206    0.735    9.798    0.000
## 
## R-Square:
##                    Estimate
##     suirisk           0.290
##     hopeless          0.545
##     selfesteem        0.498
## 
## 
## Group 2 [females]:
## 
## Regressions:
##                    Estimate  Std.Err  z-value  P(>|z|)
##   suirisk ~                                           
##     hopeless          0.045    0.041    1.104    0.270
##     depression        0.050    0.015    3.282    0.001
##     subabuse          0.059    0.014    4.138    0.000
##   hopeless ~                                          
##     depression        0.148    0.017    8.482    0.000
##     selfesteem       -0.221    0.026   -8.612    0.000
##   selfesteem ~                                        
##     depression       -0.372    0.031  -11.841    0.000
## 
## Covariances:
##                    Estimate  Std.Err  z-value  P(>|z|)
##   depression ~~                                       
##     subabuse          0.000                           
## 
## Intercepts:
##                    Estimate  Std.Err  z-value  P(>|z|)
##    .suirisk           1.981    0.132   14.970    0.000
##    .hopeless          8.896    0.875   10.172    0.000
##    .selfesteem       33.640    0.305  110.183    0.000
##     depression        6.073    0.418   14.525    0.000
##     subabuse          0.939    0.355    2.646    0.008
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|)
##    .suirisk           2.749    0.214   12.826    0.000
##    .hopeless          4.045    0.315   12.826    0.000
##    .selfesteem       18.685    1.457   12.826    0.000
##     depression       57.514    4.484   12.826    0.000
##     subabuse         41.461    3.233   12.826    0.000
## 
## R-Square:
##                    Estimate
##     suirisk           0.117
##     hopeless          0.495
##     selfesteem        0.299

The R-square for suicide risk is .29 for males, and .12 for females. The model predicts suicide risk better for females.

31.0.13 Question 12

Calculate the total, direct and indirect effects (see practical week 5). The model we have made is a typical example of moderated mediation (i.e. the mediation effects are moderated by gender). In your own words, what are the differences in the mediation between males and females?

Note: Because the paths are different for males and females, you should also calculate the total, direct and indirect effects (see practical week 5) for males and females separately.

Click for explanation

The total effects of depression and substance use on suicide risk are higher for females than males, but the total effect for selfesteem and hopelessness are very similar.

31.0.14 Question 13

Compare your conclusion in the previous question with that of Mehta and colleagues (1998). Are your conclusions any different? Why?

Click for explanation

Should be different: They do not test moderation explicitly, and report differences in all paths between males and females. In fact, the paths leading to suicide risk are different for males and females, but the mediation of depression through hopelessness is similar.