Packages

library(lavaan)
## This is lavaan 0.6-16
## lavaan is FREE software! Please report any bugs.
library(semPlot)
## Warning: package 'semPlot' was built under R version 4.3.2
library(tidyverse)
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr     1.1.3     ✔ readr     2.1.4
## ✔ forcats   1.0.0     ✔ stringr   1.5.0
## ✔ ggplot2   3.4.3     ✔ tibble    3.2.1
## ✔ lubridate 1.9.2     ✔ tidyr     1.3.0
## ✔ purrr     1.0.2
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag()    masks stats::lag()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library(psych)
## 
## Attaching package: 'psych'
## 
## The following objects are masked from 'package:ggplot2':
## 
##     %+%, alpha
## 
## The following object is masked from 'package:lavaan':
## 
##     cor2cov
library(jtools)
## Warning: package 'jtools' was built under R version 4.3.2
library(interactions)
## Warning: package 'interactions' was built under R version 4.3.2
library(ggplot2)
library(tidySEM)
## Warning: package 'tidySEM' was built under R version 4.3.2
## Loading required package: OpenMx
## 
## Attaching package: 'OpenMx'
## 
## The following object is masked from 'package:psych':
## 
##     tr
## 
## Registered S3 method overwritten by 'tidySEM':
##   method          from  
##   predict.MxModel OpenMx
## 
## Attaching package: 'tidySEM'
## 
## The following object is masked from 'package:jtools':
## 
##     get_data
library(dplyr)
library(report)
## Warning: package 'report' was built under R version 4.3.2
## 
## Attaching package: 'report'
## 
## The following object is masked from 'package:tidySEM':
## 
##     report
library(magrittr)
## 
## Attaching package: 'magrittr'
## 
## The following object is masked from 'package:purrr':
## 
##     set_names
## 
## The following object is masked from 'package:tidyr':
## 
##     extract

import data

library(readr)
AAFD <- read_csv("AsianData_FINAL_Dataset.csv")
## New names:
## Rows: 160 Columns: 33
## ── Column specification
## ──────────────────────────────────────────────────────── Delimiter: "," chr
## (3): AHELP, ETH_22_TEXT, BORN_1 dbl (27): ...1, PRE_HELP, AGE, GEN, EDU, EMP,
## INS_1, INS_2, ETH, INC, BORN, ... lgl (3): GEN_8_TEXT, EDU_11_TEXT, ETH_26_TEXT
## ℹ Use `spec()` to retrieve the full column specification for this data. ℹ
## Specify the column types or set `show_col_types = FALSE` to quiet this message.
## • `` -> `...1`
head(AAFD)
## # A tibble: 6 × 33
##    ...1 AHELP      PRE_HELP   AGE   GEN GEN_8_TEXT   EDU EDU_11_TEXT   EMP INS_1
##   <dbl> <chr>         <dbl> <dbl> <dbl> <lgl>      <dbl> <lgl>       <dbl> <dbl>
## 1     1 Housemates        1    39     2 NA             5 NA              1     1
## 2     2 My girlfr…        2    30     2 NA             6 NA              1     1
## 3     3 A mission…        1    37     2 NA             4 NA              2     1
## 4     4 I have ta…        1    34     2 NA             6 NA              1     1
## 5     5 No one            2    28     2 NA             5 NA              2     1
## 6     6 Nobody            2    64     2 NA             3 NA              1     1
## # ℹ 23 more variables: INS_2 <dbl>, ETH <dbl>, ETH_22_TEXT <chr>,
## #   ETH_26_TEXT <lgl>, INC <dbl>, BORN <dbl>, BORN_1 <chr>, BORN_2 <dbl>,
## #   SSRPH <dbl>, SSOSH <dbl>, MHSAS <dbl>, PR_PF <dbl>, PR_A <dbl>, PR_D <dbl>,
## #   PR_SR <dbl>, PR_PI <dbl>, ANG <dbl>, CSA <dbl>, IEQ <dbl>, SLESQ <dbl>,
## #   OD <dbl>, PCL5 <dbl>, ESC <dbl>
#check Structure code
#str(AAFD)

#data set with only variables of interest

d <- data.frame(AAFD$SLESQ, AAFD$CSA, AAFD$ESC, AAFD$PCL5)
d <- rename(d, stressful_life_events = AAFD.SLESQ, central_sensitization = AAFD.CSA, emotional_self_control = AAFD.ESC, trauma_symptoms = AAFD.PCL5)

remove NA variables

d <- na.omit(d)

Create Table 1 (M/SD of main variables and correlations)

psych::describe(d)
##                        vars   n mean   sd median trimmed  mad  min  max range
## stressful_life_events     1 160 1.22 0.19   1.15    1.19 0.12 1.00 1.85  0.85
## central_sensitization     2 160 1.56 0.72   1.54    1.55 0.74 0.04 3.44  3.40
## emotional_self_control    3 160 3.52 1.08   3.50    3.49 1.11 1.12 7.00  5.88
## trauma_symptoms           4 160 1.50 1.07   1.50    1.44 1.11 0.00 4.00  4.00
##                        skew kurtosis   se
## stressful_life_events  0.97     0.47 0.01
## central_sensitization  0.07    -0.53 0.06
## emotional_self_control 0.25    -0.05 0.09
## trauma_symptoms        0.39    -0.80 0.08

Conduct bivariate correlations of main variables stressful life events, central sensitization, emotional self-control

Correlation Analysis

# Pearson's Correlation Coefficent:
results.r <- d %$%
  cor.test(x = stressful_life_events, y = trauma_symptoms)

report(results.r)
## Effect sizes were labelled following Funder's (2019) recommendations.
## 
## The Pearson's product-moment correlation between stressful_life_events and
## trauma_symptoms is positive, statistically significant, and large (r = 0.35,
## 95% CI [0.20, 0.48], t(158) = 4.65, p < .001)

#Pairs Panels

psych::pairs.panels(d)

Conduct simple moderation (stressful life events = IV, central sensitization = DV, emotional self-control = Moderator)

model <- lm(stressful_life_events ~ central_sensitization * emotional_self_control, d)
summary(model)
## 
## Call:
## lm(formula = stressful_life_events ~ central_sensitization * 
##     emotional_self_control, data = d)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.29732 -0.12314 -0.04028  0.10320  0.57090 
## 
## Coefficients:
##                                               Estimate Std. Error t value
## (Intercept)                                   1.118128   0.113215   9.876
## central_sensitization                         0.079054   0.065780   1.202
## emotional_self_control                       -0.016786   0.030535  -0.550
## central_sensitization:emotional_self_control  0.006377   0.017821   0.358
##                                              Pr(>|t|)    
## (Intercept)                                    <2e-16 ***
## central_sensitization                           0.231    
## emotional_self_control                          0.583    
## central_sensitization:emotional_self_control    0.721    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.1738 on 156 degrees of freedom
## Multiple R-squared:  0.1566, Adjusted R-squared:  0.1404 
## F-statistic: 9.655 on 3 and 156 DF,  p-value: 6.966e-06

Create Figure 1 of main analyses with path coefficients

#graph interaction

interactions::interact_plot(model, pred = central_sensitization, modx = emotional_self_control, main.title = "Main Analyses with Path Coefficients") +
    ylim(1, 10)

Conduct Simple moderation (IV: stressful life events, DV: trauma symptoms, Moderator: Emotional self-control)

model2 <- lm(stressful_life_events ~ trauma_symptoms * emotional_self_control, d)
summary(model2)
## 
## Call:
## lm(formula = stressful_life_events ~ trauma_symptoms * emotional_self_control, 
##     data = d)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.35589 -0.12119 -0.04134  0.09645  0.61521 
## 
## Coefficients:
##                                         Estimate Std. Error t value Pr(>|t|)
## (Intercept)                             1.226630   0.082650  14.841   <2e-16
## trauma_symptoms                         0.027079   0.046323   0.585    0.560
## emotional_self_control                 -0.029332   0.022817  -1.286    0.201
## trauma_symptoms:emotional_self_control  0.009863   0.012395   0.796    0.427
##                                           
## (Intercept)                            ***
## trauma_symptoms                           
## emotional_self_control                    
## trauma_symptoms:emotional_self_control    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.1764 on 156 degrees of freedom
## Multiple R-squared:  0.1309, Adjusted R-squared:  0.1142 
## F-statistic: 7.832 on 3 and 156 DF,  p-value: 6.667e-05

#graph interaction

interactions::interact_plot(model2, pred = trauma_symptoms, modx = emotional_self_control, main.title = "Main Analyses with Path Coefficients") +
    ylim(1, 10)

Conduct a Simple mediation (IV: stressful life events, DV: central sensitization, Mediator: trauma symptoms as measured by the PCL 5)

# Y = central_sensitization; X = stressful_life_events; M = trauma_symptoms
LMedModel <- "
          central_sensitization ~ b*stressful_life_events + c_p*trauma_symptoms 
          stressful_life_events ~a*trauma_symptoms
          
          #intercepts
          stressful_life_events ~ stressful_life_events.mean*1
          central_sensitization ~ central_sensitization.mean*1
          
          indirect :=  a*b
          direct  := c_p
          total_c  := c_p + (a*b)
          "
set.seed(230925)  #required for reproducible results because lavaan introduces randomness into the calculations
LMed_fit <- lavaan::sem(LMedModel, data = d, se = "bootstrap", missing = "fiml")
## Warning in lav_model_nvcov_bootstrap(lavmodel = lavmodel, lavsamplestats =
## lavsamplestats, : lavaan WARNING: 1 bootstrap runs failed or did not converge.
LMed_Sum <- lavaan::summary(LMed_fit, standardized = T, rsq = T, ci = TRUE)
LMed_ParEsts <- lavaan::parameterEstimates(LMed_fit, boot.ci.type = "bca.simple",
    standardized = TRUE)
LMed_Sum
## lavaan 0.6.16 ended normally after 1 iteration
## 
##   Estimator                                         ML
##   Optimization method                           NLMINB
##   Number of model parameters                         7
## 
##   Number of observations                           160
##   Number of missing patterns                         1
## 
## Model Test User Model:
##                                                       
##   Test statistic                                 0.000
##   Degrees of freedom                                 0
## 
## Parameter Estimates:
## 
##   Standard errors                            Bootstrap
##   Number of requested bootstrap draws             1000
##   Number of successful bootstrap draws             999
## 
## Regressions:
##                           Estimate  Std.Err  z-value  P(>|z|) ci.lower ci.upper
##   central_sensitization ~                                                      
##     strssf__   (b)           0.736    0.242    3.036    0.002    0.266    1.220
##     trm_symp (c_p)           0.395    0.049    8.038    0.000    0.302    0.493
##   stressful_life_events ~                                                      
##     trm_symp   (a)           0.061    0.013    4.647    0.000    0.036    0.089
##    Std.lv  Std.all
##                   
##     0.736    0.191
##     0.395    0.582
##                   
##     0.061    0.347
## 
## Intercepts:
##                    Estimate  Std.Err  z-value  P(>|z|) ci.lower ci.upper
##    .strss__ (s__.)    1.126    0.021   52.584    0.000    1.086    1.168
##    .cntrl_s (cn_.)    0.072    0.271    0.265    0.791   -0.467    0.600
##    Std.lv  Std.all
##     1.126    6.025
##     0.072    0.100
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|) ci.lower ci.upper
##    .centrl_snstztn    0.285    0.029    9.700    0.000    0.221    0.336
##    .strssfl_lf_vnt    0.031    0.004    7.776    0.000    0.024    0.039
##    Std.lv  Std.all
##     0.285    0.548
##     0.031    0.879
## 
## R-Square:
##                    Estimate
##     centrl_snstztn    0.452
##     strssfl_lf_vnt    0.121
## 
## Defined Parameters:
##                    Estimate  Std.Err  z-value  P(>|z|) ci.lower ci.upper
##     indirect          0.045    0.016    2.769    0.006    0.015    0.078
##     direct            0.395    0.049    8.034    0.000    0.302    0.493
##     total_c           0.440    0.045    9.720    0.000    0.353    0.532
##    Std.lv  Std.all
##     0.045    0.066
##     0.395    0.582
##     0.440    0.648

Conduct a moderated mediation of all 4 of these variables (IV: stressful life events, DV: central sensitization, Mediator: trauma symptoms, Moderator: emotional_self_control)

Mel’s variables: (public stigma =IV, self stigma = Mediator, help-seeking attitudes = DV, familism = Moderator)

Combined <- '
    #equations
    trauma_symptoms ~ a1*stressful_life_events + a2*emotional_self_control + a3*stressful_life_events:emotional_self_control
    central_sensitization ~ c_p1*stressful_life_events + c_p2*emotional_self_control + c_p3*stressful_life_events:emotional_self_control + b*trauma_symptoms

    #intercepts
    trauma_symptoms ~ trauma_symptoms.mean*1
    central_sensitization ~ central_sensitization.mean*1

    #means, variances of W for simple slopes
    emotional_self_control ~ emotional_self_control.mean*1
    emotional_self_control ~~ emotional_self_control.var*emotional_self_control
    
    #index of moderated mediation, there will be an a and b path in the product
    #if the a and/or b path is moderated, select the label that represents the moderation
    
    imm := a3*b

    #Note that we first create the indirect product, then add to it the product of the imm and the W level
    indirect.SDbelow := a1*b + imm*(emotional_self_control.mean - sqrt(emotional_self_control.var))
    indirect.mean := a1*b + imm*(emotional_self_control.mean)
    indirect.SDabove := a1*b + imm*(emotional_self_control.mean + sqrt(emotional_self_control.var))

    #direct effect is also moderated so calculate with c_p1 + c_p3
    direct.SDbelow := c_p1 + c_p3*(emotional_self_control.mean - sqrt(emotional_self_control.var)) 
    direct.Smean := c_p1 + c_p3*(emotional_self_control.mean)
    direct.SDabove := c_p1 + c_p3*(emotional_self_control.mean + sqrt(emotional_self_control.var))

 '
set.seed(230925) #required for reproducible results because lavaan introduces randomness into the calculations
Combined_fit <- lavaan::sem(Combined, data = d, se = "bootstrap", missing = 'fiml', fixed.x = FALSE, bootstrap = 1000)
cFITsum <- lavaan::summary(Combined_fit, standardized = TRUE, rsq=T, ci=TRUE)    
cParamEsts <- lavaan::parameterEstimates(Combined_fit, boot.ci.type = "bca.simple", standardized=TRUE)
cFITsum
## lavaan 0.6.16 ended normally after 21 iterations
## 
##   Estimator                                         ML
##   Optimization method                           NLMINB
##   Number of model parameters                        18
## 
##   Number of observations                           160
##   Number of missing patterns                         1
## 
## Model Test User Model:
##                                                       
##   Test statistic                               596.947
##   Degrees of freedom                                 2
##   P-value (Chi-square)                           0.000
## 
## Parameter Estimates:
## 
##   Standard errors                            Bootstrap
##   Number of requested bootstrap draws             1000
##   Number of successful bootstrap draws            1000
## 
## Regressions:
##                           Estimate  Std.Err  z-value  P(>|z|) ci.lower ci.upper
##   trauma_symptoms ~                                                            
##     strss__   (a1)           1.183    1.398    0.846    0.398   -2.237    3.423
##     emtnl__   (a2)          -0.170    0.471   -0.362    0.718   -1.321    0.580
##     st__:__   (a3)           0.230    0.376    0.611    0.541   -0.358    1.162
##   central_sensitization ~                                                      
##     strss__ (c_p1)           0.946    0.739    1.280    0.200   -0.373    2.523
##     emtnl__ (c_p2)           0.034    0.241    0.139    0.889   -0.399    0.548
##     st__:__ (c_p3)          -0.066    0.192   -0.343    0.731   -0.515    0.268
##     trm_sym    (b)           0.402    0.051    7.945    0.000    0.305    0.503
##    Std.lv  Std.all
##                   
##     1.183    0.199
##    -0.170   -0.165
##     0.230    0.305
##                   
##     0.946    0.245
##     0.034    0.050
##    -0.066   -0.135
##     0.402    0.619
## 
## Covariances:
##                            Estimate  Std.Err  z-value  P(>|z|) ci.lower
##   stressful_life_events ~~                                             
##     strssfl_lf_:__            0.113    0.030    3.758    0.000    0.060
##  ci.upper   Std.lv  Std.all
##                            
##     0.181    0.113    0.411
## 
## Intercepts:
##                    Estimate  Std.Err  z-value  P(>|z|) ci.lower ci.upper
##    .trm_sym (tr_.)   -0.320    1.740   -0.184    0.854   -3.190    3.866
##    .cntrl_s (cn_.)   -0.030    0.930   -0.032    0.974   -1.959    1.702
##     emtnl__ (e__.)    3.520    0.087   40.458    0.000    3.348    3.691
##     strss__           1.217    0.015   82.286    0.000    1.189    1.246
##     st__:__           4.275    0.117   36.636    0.000    4.052    4.510
##    Std.lv  Std.all
##    -0.320   -0.288
##    -0.030   -0.042
##     3.520    3.269
##     1.217    6.515
##     4.275    2.899
## 
## Variances:
##                    Estimate  Std.Err  z-value  P(>|z|) ci.lower ci.upper
##     emtnl__ (e__.)    1.159    0.128    9.029    0.000    0.924    1.417
##    .trm_sym           0.978    0.099    9.885    0.000    0.773    1.153
##    .cntrl_s           0.282    0.030    9.551    0.000    0.216    0.332
##     strss__           0.035    0.004    8.165    0.000    0.027    0.043
##     st__:__           2.175    0.397    5.472    0.000    1.552    3.085
##    Std.lv  Std.all
##     1.159    1.000
##     0.978    0.791
##     0.282    0.541
##     0.035    1.000
##     2.175    1.000
## 
## R-Square:
##                    Estimate
##     trauma_symptms    0.209
##     centrl_snstztn    0.459
## 
## Defined Parameters:
##                    Estimate  Std.Err  z-value  P(>|z|) ci.lower ci.upper
##     imm               0.092    0.154    0.598    0.550   -0.141    0.499
##     indirect.SDblw    0.701    0.264    2.654    0.008    0.201    1.228
##     indirect.mean     0.800    0.213    3.762    0.000    0.447    1.279
##     indirect.SDabv    0.899    0.270    3.329    0.001    0.487    1.531
##     direct.SDbelow    0.785    0.336    2.338    0.019    0.160    1.469
##     direct.Smean      0.713    0.252    2.833    0.005    0.215    1.212
##     direct.SDabove    0.642    0.311    2.069    0.039   -0.068    1.196
##    Std.lv  Std.all
##     0.092    0.189
##     0.701    0.551
##     0.800    0.739
##     0.899    0.928
##     0.785   -0.061
##     0.713   -0.196
##     0.642   -0.331