library(lavaan)
## This is lavaan 0.6-13
## lavaan is FREE software! Please report any bugs.
estress <- read.csv("estress.csv")
head(estress)
## tenure estress affect withdraw sex age ese
## 1 1.67 6.0 2.60 3.00 1 51 5.33
## 2 0.58 5.0 1.00 1.00 0 45 6.05
## 3 0.58 5.5 2.40 3.66 1 42 5.26
## 4 2.00 3.0 1.16 4.66 1 50 4.35
## 5 5.00 4.5 1.00 4.33 1 48 4.86
## 6 9.00 6.0 1.50 3.00 1 48 5.05
withdraw_model <- "
affect ~ a_ag * age + a_se * sex + a_es * estress
withdraw ~ age + sex + estress + b * affect
c_es := a_es * b"
withdraw_model
## [1] "\naffect ~ a_ag * age + a_se * sex + a_es * estress\nwithdraw ~ age + sex + estress + b * affect\nc_es := a_es * b"
colMeans(estress)
## tenure estress affect withdraw sex age ese
## 5.9285878 4.6202290 1.5980916 2.3211450 0.6183206 43.7938931 5.6073282
estresscorrelation <-cor(estress)
estresscorrelation
## tenure estress affect withdraw sex
## tenure 1.000000000 0.06787622 -0.06520633 -0.03536860 -0.003181564
## estress 0.067876218 1.00000000 0.34006259 0.06407186 0.132833014
## affect -0.065206327 0.34006259 1.00000000 0.41658602 0.046217575
## withdraw -0.035368601 0.06407186 0.41658602 1.00000000 0.050029219
## sex -0.003181564 0.13283301 0.04621758 0.05002922 1.000000000
## age 0.266195837 0.06598494 -0.01779056 -0.03526418 0.083119846
## ese -0.060421582 -0.15826688 -0.24552431 -0.24250778 0.028105987
## age ese
## tenure 0.26619584 -0.06042158
## estress 0.06598494 -0.15826688
## affect -0.01779056 -0.24552431
## withdraw -0.03526418 -0.24250778
## sex 0.08311985 0.02810599
## age 1.00000000 -0.08263488
## ese -0.08263488 1.00000000
sapply(estress[,2:6], sd)
## estress affect withdraw sex age
## 1.4236142 0.7237171 1.2468702 0.4867283 10.3596014
estressfit_mod <- sem (
model = withdraw_model, data = estress,
se = "bootstrap", bootstrap = 5000)
estressfit_mod
## lavaan 0.6.13 ended normally after 1 iteration
##
## Estimator ML
## Optimization method NLMINB
## Number of model parameters 9
##
## Number of observations 262
##
## Model Test User Model:
##
## Test statistic 0.000
## Degrees of freedom 0
summary(estressfit_mod, standardize = TRUE, rsquare = TRUE, ci = TRUE)
## lavaan 0.6.13 ended normally after 1 iteration
##
## Estimator ML
## Optimization method NLMINB
## Number of model parameters 9
##
## Number of observations 262
##
## Model Test User Model:
##
## Test statistic 0.000
## Degrees of freedom 0
##
## Parameter Estimates:
##
## Standard errors Bootstrap
## Number of requested bootstrap draws 5000
## Number of successful bootstrap draws 5000
##
## Regressions:
## Estimate Std.Err z-value P(>|z|) ci.lower ci.upper
## affect ~
## age (a_ag) -0.003 0.005 -0.602 0.547 -0.012 0.006
## sex (a_se) 0.006 0.094 0.066 0.948 -0.182 0.192
## estress (a_es) 0.174 0.042 4.188 0.000 0.089 0.251
## withdraw ~
## age -0.003 0.007 -0.434 0.664 -0.016 0.011
## sex 0.112 0.148 0.758 0.448 -0.177 0.389
## estress -0.080 0.055 -1.470 0.142 -0.186 0.030
## affect (b) 0.767 0.142 5.420 0.000 0.493 1.043
## Std.lv Std.all
##
## -0.003 -0.041
## 0.006 0.004
## 0.174 0.342
##
## -0.003 -0.025
## 0.112 0.044
## -0.080 -0.091
## 0.767 0.445
##
## Variances:
## Estimate Std.Err z-value P(>|z|) ci.lower ci.upper
## .affect 0.461 0.082 5.637 0.000 0.311 0.625
## .withdraw 1.266 0.096 13.242 0.000 1.053 1.430
## Std.lv Std.all
## 0.461 0.883
## 1.266 0.817
##
## R-Square:
## Estimate
## affect 0.117
## withdraw 0.183
##
## Defined Parameters:
## Estimate Std.Err z-value P(>|z|) ci.lower ci.upper
## c_es 0.133 0.033 3.983 0.000 0.071 0.202
## Std.lv Std.all
## 0.133 0.152
library(lavaanPlot)
lavaanPlot(
model = estressfit_mod, coefs = TRUE, covs = TRUE,
stars = "regress", stand = TRUE)
Path analysis was used to test the withdrawal model based on data from 262 people. We used lavaan version 0.6.13 (Rosseel, 2012), with maximum likelihood estimation. The variables of age (b = -0.003, se = 0.005, p = 0.535) and sex (b = 0.006, se = 0.094, p = 0.948) were not found to be statistically significant predictors of depressive affect. However, economic stress (b = 0.174, se = 0.042, p = 0.000) is a statistically significant predictor of depressive affect. Depressive affect (b = 0.767, se = 0.141, p = 0.000) was found to be the only statistically significant predictor of withdrawal intentions. The variables of age (b = -0.003, se = 0.007, p = 0.660), sex (b = 0.112, se = 0.146, p = 0.765), and economic stress (b = -0.080, se = 0.055, p = 0.145) were not statistically significant predictors of withdrawal intentions. There is evidence to suggest an indirect effect of economic stress to withdrawal intentions mediated by depressive affect.