User-Sem-Lavaan (SEM)
User-Sem-Lavaan (SEM)
lavaan
28 May 2020
Contents
Data preparation 2
Install and load relevant R packages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
Data input . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
R session info 32
1
Data preparation
Data input
# Sample size
nrow(Bergh)
## [1] 861
## Create mean scores per construct
Bergh$Open <- (O1+O2+O3)/3
Bergh$Agree <- (A1+A2+A3)/3
Bergh$Prejudice <- (EP+SP+DP+HP)/4
'
2
# Step 3: Evaluate the model
# Summary
summary(model1.fit,
rsquare = TRUE,
fit.measures = TRUE,
standardized = TRUE)
3
## Information Expected
## Information saturated (h1) model Structured
## Standard errors Standard
##
## Regressions:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## Prejudice ~
## Open (b1) -0.612 0.043 -14.118 0.000 -0.612 -0.423
## Agree (b2) -0.324 0.043 -7.522 0.000 -0.324 -0.225
##
## Covariances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## Open ~~
## Agree 0.049 0.007 7.148 0.000 0.049 0.251
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## Open 0.192 0.009 20.748 0.000 0.192 1.000
## Agree 0.194 0.009 20.748 0.000 0.194 1.000
## .Prejudice 0.291 0.014 20.748 0.000 0.291 0.723
##
## R-Square:
## Estimate
## Prejudice 0.277
# Visualize the path model
semPaths(model1.fit,
rotation = 2,
layout = "tree2",
what = "std",
posCol = "black",
edge.width = 0.5,
style = "Lisrel",
fade = T,
edge.label.position = 0.55)
4
Agr
−0.23
0.25
Prj 0.72
−0.42
Opn
## $cov
## Prejdc Open Agree
## Prejudice 0.402
## Open -0.133 0.192
## Agree -0.093 0.049 0.194
# List all parameter values
parameterEstimates(model1.fit)
## $stat
## [1] 17.76479
##
## $df
## [1] 1
##
## $p.value
## [1] 2.499661e-05
##
## $se
## [1] "standard"
5
ADD-ON–Model 1 with bootstrapping of standard errors
6
## RMSEA 0.000
## 90 Percent confidence interval - lower 0.000
## 90 Percent confidence interval - upper 0.000
## P-value RMSEA <= 0.05 NA
##
## Standardized Root Mean Square Residual:
##
## SRMR 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
## Prejudice ~
## Open (b1) -0.612 0.044 -13.905 0.000 -0.704 -0.528
## Agree (b2) -0.324 0.043 -7.576 0.000 -0.410 -0.238
## Std.lv Std.all
##
## -0.612 -0.423
## -0.324 -0.225
##
## Covariances:
## Estimate Std.Err z-value P(>|z|) ci.lower ci.upper
## Open ~~
## Agree 0.049 0.007 6.802 0.000 0.034 0.061
## Std.lv Std.all
##
## 0.049 0.251
##
## Variances:
## Estimate Std.Err z-value P(>|z|) ci.lower ci.upper
## Open 0.192 0.009 22.345 0.000 0.174 0.209
## Agree 0.194 0.008 24.159 0.000 0.177 0.211
## .Prejudice 0.291 0.017 17.440 0.000 0.258 0.323
## Std.lv Std.all
## 0.192 1.000
## 0.194 1.000
## 0.291 0.723
##
## R-Square:
## Estimate
## Prejudice 0.277
# List all parameter values
parameterEstimates(model1.fit.boot, ci = TRUE, boot.ci.type = "basic")
7
## 5 Agree ~~ Agree 0.194 0.008 24.159 0 0.178 0.212
## 6 Prejudice ~~ Prejudice 0.291 0.017 17.440 0 0.258 0.324
'
8
##
## Comparative Fit Index (CFI) 1.000
## Tucker-Lewis Index (TLI) 1.000
##
## Loglikelihood and Information Criteria:
##
## Loglikelihood user model (H0) -1689.786
## Loglikelihood unrestricted model (H1) -1689.786
##
## Akaike (AIC) 3391.572
## Bayesian (BIC) 3420.121
## Sample-size adjusted Bayesian (BIC) 3401.066
##
## Root Mean Square Error of Approximation:
##
## RMSEA 0.000
## 90 Percent confidence interval - lower 0.000
## 90 Percent confidence interval - upper 0.000
## P-value RMSEA <= 0.05 NA
##
## Standardized Root Mean Square Residual:
##
## SRMR 0.000
##
## Parameter Estimates:
##
## Information Expected
## Information saturated (h1) model Structured
## Standard errors Standard
##
## Regressions:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## Prejudice ~
## Open (b1) -0.612 0.043 -14.118 0.000 -0.612 -0.423
## Agree (b2) -0.324 0.043 -7.522 0.000 -0.324 -0.225
## Open ~
## Agree (b3) 0.250 0.033 7.614 0.000 0.250 0.251
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## Agree 0.194 0.009 20.748 0.000 0.194 1.000
## .Prejudice 0.291 0.014 20.748 0.000 0.291 0.723
## .Open 0.180 0.009 20.748 0.000 0.180 0.937
##
## R-Square:
## Estimate
## Prejudice 0.277
## Open 0.063
##
## Defined Parameters:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## ind -0.153 0.023 -6.701 0.000 -0.153 -0.106
9
# Visualize the path model
semPaths(model2.fit,
rotation = 2,
layout = "tree2",
what = "std",
posCol = "black",
edge.width = 0.5,
style = "Lisrel",
fade = T,
edge.label.position = 0.55)
Opn 0.94
0.25
Agr
−0.42
−0.23
Prj 0.72
Correlation matrix
## EP SP HP DP A1 A2 A3
## EP 1.0000000 0.5328577 0.2545270 0.5314828 -0.2486889 -0.3889079 -0.3031269
## SP 0.5328577 1.0000000 0.2219292 0.5252140 -0.1710822 -0.2973829 -0.1987969
## HP 0.2545270 0.2219292 1.0000000 0.2415626 -0.1120012 -0.1510590 -0.0827062
## DP 0.5314828 0.5252140 0.2415626 1.0000000 -0.3292610 -0.4709318 -0.3936544
## A1 -0.2486889 -0.1710822 -0.1120012 -0.3292610 1.0000000 0.6867541 0.7835360
## A2 -0.3889079 -0.2973829 -0.1510590 -0.4709318 0.6867541 1.0000000 0.7453925
## A3 -0.3031269 -0.1987969 -0.0827062 -0.3936544 0.7835360 0.7453925 1.0000000
## O1 -0.3543605 -0.3317130 -0.2332906 -0.2994080 0.0861290 0.2293831 0.1488831
## O2 -0.3622272 -0.3127873 -0.2972669 -0.3327277 0.1393367 0.2698570 0.2082816
## O3 -0.4089230 -0.3300734 -0.2930209 -0.3407396 0.1904259 0.3178221 0.2584276
## O1 O2 O3
10
## EP -0.3543605 -0.3622272 -0.4089230
## SP -0.3317130 -0.3127873 -0.3300734
## HP -0.2332906 -0.2972669 -0.2930209
## DP -0.2994080 -0.3327277 -0.3407396
## A1 0.0861290 0.1393367 0.1904259
## A2 0.2293831 0.2698570 0.3178221
## A3 0.1488831 0.2082816 0.2584276
## O1 1.0000000 0.6624692 0.7444363
## O2 0.6624692 1.0000000 0.7140617
## O3 0.7444363 0.7140617 1.0000000
# Correlogram
corrplot(Bergh.cor, type = "upper", order = "hclust",
tl.col = "black", tl.srt = 60,
addCoef.col = "white",
number.cex = 0.75,
cl.cex = 1,
tl.cex = 0.9)
HP
DP
EP
SP
O2
O1
O3
A3
A2
A1
1
HP 1 0.24 0.25 0.22 −0.15 −0.11 −0.08 −0.3 −0.23 −0.29
0.8
DP 1 0.53 0.53 −0.47 −0.33 −0.39 −0.33 −0.3 −0.34
0.6
EP 1 0.53 −0.39 −0.25 −0.3 −0.36 −0.35 −0.41
0.4
SP 1 −0.3 −0.17 −0.2 −0.31 −0.33 −0.33
0.2
A2 1 0.69 0.75 0.27 0.23 0.32
0
A1 1 0.78 0.14 0.09 0.19
−0.2
A3 1 0.21 0.15 0.26
−0.4
O2 1 0.66 0.71
−0.6
O1 1 0.74
−0.8
O3 1
−1
Variables that represent the same underlying concept (i.e., agreeableness, openness, and prejudice) correlate
positively, significantly, and substantially. Do they really measure the same concept?
11
# Measurement models
OP =~ O1 + O2 + O3
AG =~ A1 + A2 + A3
PR =~ EP + SP + HP + DP
# Covariance structure
OP ~~ OP + AG + PR
AG ~~ AG + PR
PR ~~ PR
'
12
##
## Akaike (AIC) 11391.614
## Bayesian (BIC) 11501.050
## Sample-size adjusted Bayesian (BIC) 11428.008
##
## Root Mean Square Error of Approximation:
##
## RMSEA 0.075
## 90 Percent confidence interval - lower 0.065
## 90 Percent confidence interval - upper 0.085
## P-value RMSEA <= 0.05 0.000
##
## Standardized Root Mean Square Residual:
##
## SRMR 0.054
##
## Parameter Estimates:
##
## Information Expected
## Information saturated (h1) model Structured
## Standard errors Standard
##
## Latent Variables:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## OP =~
## O1 1.000 0.400 0.827
## O2 0.934 0.036 26.185 0.000 0.374 0.799
## O3 1.149 0.040 28.900 0.000 0.460 0.898
## AG =~
## A1 1.000 0.426 0.846
## A2 0.910 0.032 28.812 0.000 0.388 0.823
## A3 1.030 0.032 31.899 0.000 0.439 0.914
## PR =~
## EP 1.000 0.530 0.746
## SP 0.886 0.051 17.348 0.000 0.469 0.686
## HP 1.030 0.112 9.160 0.000 0.545 0.350
## DP 0.746 0.041 18.308 0.000 0.395 0.741
##
## Covariances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## OP ~~
## AG 0.049 0.007 7.105 0.000 0.286 0.286
## PR -0.122 0.011 -11.371 0.000 -0.573 -0.573
## AG ~~
## PR -0.110 0.011 -10.241 0.000 -0.485 -0.485
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## OP 0.160 0.011 14.156 0.000 1.000 1.000
## AG 0.182 0.012 14.822 0.000 1.000 1.000
## PR 0.281 0.025 11.385 0.000 1.000 1.000
## .O1 0.074 0.005 14.555 0.000 0.074 0.317
## .O2 0.079 0.005 15.837 0.000 0.079 0.361
## .O3 0.051 0.005 9.630 0.000 0.051 0.194
13
## .A1 0.072 0.005 14.461 0.000 0.072 0.284
## .A2 0.072 0.005 15.697 0.000 0.072 0.322
## .A3 0.038 0.004 9.152 0.000 0.038 0.165
## .EP 0.224 0.016 14.198 0.000 0.224 0.444
## .SP 0.248 0.015 16.146 0.000 0.248 0.530
## .HP 2.137 0.107 20.052 0.000 2.137 0.878
## .DP 0.128 0.009 14.376 0.000 0.128 0.451
##
## R-Square:
## Estimate
## O1 0.683
## O2 0.639
## O3 0.806
## A1 0.716
## A2 0.678
## A3 0.835
## EP 0.556
## SP 0.470
## HP 0.122
## DP 0.549
# Visualize the path model
semPaths(model3.fit,
rotation = 2,
layout = "tree2",
what = "std",
posCol = "black",
edge.width = 0.5,
style = "Lisrel",
fade = T,
edge.label.position = 0.55)
DP 0.45
0.74
0.35 HP 0.88
PR
0.69
SP 0.53
0.75
−0.49
EP 0.44
−0.57 A3 0.17
0.91
AG 0.82
A2 0.32
0.85
0.29 A1 0.28
O3 0.19
0.90
OP 0.80
O2 0.36
0.83
O1 0.32
14
Model 3b: Refined CFA of personality
Some researcher had reason to believe that the indicators A1 and A3 may covary beyond having the same
underlying construct (Agreeableness). This may be due to similar wording in questions to the study
participants or a similar method with which A1 and A3 have been assessed. To represent this in the original
measurement model (Model 3), we add the residual covariance between these two indicators (i.e., A1 ~~ A3)
and evaluate the extent to which this improves/changes the model fit.
# Step 1: Model specification
model3b <- '
# Measurement models
OP =~ O1 + O2 + O3
AG =~ A1 + A2 + A3
PR =~ EP + SP + HP + DP
# Covariance structure
OP ~~ OP + AG + PR
AG ~~ AG + PR
PR ~~ PR
# Residual covariance
A1 ~~ A3
'
15
## Degrees of freedom 45
## P-value 0.000
##
## User Model versus Baseline Model:
##
## Comparative Fit Index (CFI) 0.979
## Tucker-Lewis Index (TLI) 0.970
##
## Loglikelihood and Information Criteria:
##
## Loglikelihood user model (H0) -5638.625
## Loglikelihood unrestricted model (H1) -5579.497
##
## Akaike (AIC) 11325.249
## Bayesian (BIC) 11439.444
## Sample-size adjusted Bayesian (BIC) 11363.226
##
## Root Mean Square Error of Approximation:
##
## RMSEA 0.057
## 90 Percent confidence interval - lower 0.046
## 90 Percent confidence interval - upper 0.068
## P-value RMSEA <= 0.05 0.131
##
## Standardized Root Mean Square Residual:
##
## SRMR 0.043
##
## Parameter Estimates:
##
## Information Expected
## Information saturated (h1) model Structured
## Standard errors Standard
##
## Latent Variables:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## OP =~
## O1 1.000 0.400 0.827
## O2 0.934 0.036 26.188 0.000 0.374 0.799
## O3 1.149 0.040 28.921 0.000 0.460 0.898
## AG =~
## A1 1.000 0.346 0.687
## A2 1.361 0.086 15.756 0.000 0.471 0.999
## A3 1.036 0.033 31.662 0.000 0.358 0.746
## PR =~
## EP 1.000 0.529 0.744
## SP 0.887 0.051 17.460 0.000 0.469 0.685
## HP 1.031 0.112 9.177 0.000 0.545 0.349
## DP 0.750 0.040 18.535 0.000 0.397 0.744
##
## Covariances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## OP ~~
## AG 0.046 0.006 7.516 0.000 0.330 0.330
16
## PR -0.121 0.011 -11.372 0.000 -0.573 -0.573
## AG ~~
## PR -0.098 0.010 -9.409 0.000 -0.536 -0.536
## .A1 ~~
## .A3 0.066 0.008 8.266 0.000 0.066 0.560
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## OP 0.160 0.011 14.158 0.000 1.000 1.000
## AG 0.120 0.012 9.879 0.000 1.000 1.000
## PR 0.279 0.024 11.413 0.000 1.000 1.000
## .O1 0.074 0.005 14.570 0.000 0.074 0.317
## .O2 0.079 0.005 15.846 0.000 0.079 0.361
## .O3 0.051 0.005 9.643 0.000 0.051 0.194
## .A1 0.134 0.009 14.890 0.000 0.134 0.528
## .A2 0.000 0.012 0.027 0.979 0.000 0.001
## .A3 0.102 0.008 12.293 0.000 0.102 0.444
## .EP 0.225 0.016 14.456 0.000 0.225 0.447
## .SP 0.249 0.015 16.300 0.000 0.249 0.531
## .HP 2.138 0.106 20.073 0.000 2.138 0.878
## .DP 0.127 0.009 14.467 0.000 0.127 0.447
##
## R-Square:
## Estimate
## O1 0.683
## O2 0.639
## O3 0.806
## A1 0.472
## A2 0.999
## A3 0.556
## EP 0.553
## SP 0.469
## HP 0.122
## DP 0.553
# Visualize the path model
semPaths(model3b.fit,
rotation = 2,
layout = "tree2",
what = "std",
posCol = "black",
edge.width = 0.5,
style = "Lisrel",
fade = T,
edge.label.position = 0.55)
17
DP 0.45
0.74
0.35 HP 0.88
PR
0.68
SP 0.53
0.74
−0.54
EP 0.45
−0.57 A3 0.44
0.75
AG 1.00 0.56
A2 0.00
0.69
0.33 A1 0.53
O3 0.19
0.90
OP 0.80
O2 0.36
0.83
O1 0.32
# Residual covariance
A1 ~~ A3
# Structural model
PR ~ b1*OP + b2*AG
'
18
estimator = "ML")
19
## Parameter Estimates:
##
## Information Expected
## Information saturated (h1) model Structured
## Standard errors Standard
##
## Latent Variables:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## OP =~
## O1 1.000 0.400 0.827
## O2 0.934 0.036 26.188 0.000 0.374 0.799
## O3 1.149 0.040 28.921 0.000 0.460 0.898
## AG =~
## A1 1.000 0.346 0.687
## A2 1.361 0.086 15.756 0.000 0.471 0.999
## A3 1.036 0.033 31.662 0.000 0.358 0.746
## PR =~
## EP 1.000 0.529 0.744
## SP 0.887 0.051 17.460 0.000 0.469 0.685
## HP 1.031 0.112 9.177 0.000 0.545 0.349
## DP 0.750 0.040 18.535 0.000 0.397 0.744
##
## Regressions:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## PR ~
## OP (b1) -0.587 0.053 -11.106 0.000 -0.444 -0.444
## AG (b2) -0.595 0.058 -10.172 0.000 -0.390 -0.390
##
## Covariances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .A1 ~~
## .A3 0.066 0.008 8.266 0.000 0.066 0.560
## OP ~~
## AG 0.046 0.006 7.516 0.000 0.330 0.330
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .O1 0.074 0.005 14.570 0.000 0.074 0.317
## .O2 0.079 0.005 15.846 0.000 0.079 0.361
## .O3 0.051 0.005 9.643 0.000 0.051 0.194
## .A1 0.134 0.009 14.890 0.000 0.134 0.528
## .A2 0.000 0.012 0.027 0.979 0.000 0.001
## .A3 0.102 0.008 12.293 0.000 0.102 0.444
## .EP 0.225 0.016 14.456 0.000 0.225 0.447
## .SP 0.249 0.015 16.300 0.000 0.249 0.531
## .HP 2.138 0.106 20.073 0.000 2.138 0.878
## .DP 0.127 0.009 14.467 0.000 0.127 0.447
## OP 0.160 0.011 14.158 0.000 1.000 1.000
## AG 0.120 0.012 9.879 0.000 1.000 1.000
## .PR 0.150 0.015 9.937 0.000 0.536 0.536
##
## R-Square:
## Estimate
## O1 0.683
20
## O2 0.639
## O3 0.806
## A1 0.472
## A2 0.999
## A3 0.556
## EP 0.553
## SP 0.469
## HP 0.122
## DP 0.553
## PR 0.464
# Visualize the path model
semPaths(model4.fit,
rotation = 2,
layout = "tree2",
what = "std",
posCol = "black",
edge.width = 0.5,
style = "Lisrel",
fade = T,
edge.label.position = 0.55)
0.44 A3
0.75
0.56
0.00 A2 1.00 AG DP 0.45
0.69
0.74
−0.39
0.53 A1 HP 0.88
0.35
0.33
0.54 PR
0.68
0.19 O3 SP 0.53
−0.44
0.74
0.90
0.83
0.32 O1
## Hypothesis testing
lavTestWald(model4.fit, constraints = "b1 == b2")
## $stat
## [1] 0.009016331
##
## $df
## [1] 1
##
## $p.value
## [1] 0.9243511
##
## $se
21
## [1] "standard"
22
ADD-ON–Model 5: Multi-group SEM (Gender differences in the
structural parameters)
# Covariance structure
OP ~~ OP + AG
AG ~~ AG
# Residual covariance
A1 ~~ A3
# Structural model
PR ~ c(a1,b1)*OP + c(a2,b2)*AG
'
23
## Test statistic 208.998
## Degrees of freedom 79
## P-value (Chi-square) 0.000
## Test statistic for each group:
## male 83.323
## female 125.675
##
## Model Test Baseline Model:
##
## Test statistic 4207.254
## Degrees of freedom 90
## P-value 0.000
##
## User Model versus Baseline Model:
##
## Comparative Fit Index (CFI) 0.968
## Tucker-Lewis Index (TLI) 0.964
##
## Loglikelihood and Information Criteria:
##
## Loglikelihood user model (H0) -5575.804
## Loglikelihood unrestricted model (H1) -5471.305
##
## Akaike (AIC) 11213.608
## Bayesian (BIC) 11361.109
## Sample-size adjusted Bayesian (BIC) 11262.661
##
## Root Mean Square Error of Approximation:
##
## RMSEA 0.062
## 90 Percent confidence interval - lower 0.052
## 90 Percent confidence interval - upper 0.072
## P-value RMSEA <= 0.05 0.028
##
## Standardized Root Mean Square Residual:
##
## SRMR 0.067
##
## Parameter Estimates:
##
## Information Expected
## Information saturated (h1) model Structured
## Standard errors Standard
##
##
## Group 1 [male]:
##
## Latent Variables:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## OP =~
## O1 1.000 0.410 0.833
## O2 (.p2.) 0.932 0.036 26.006 0.000 0.382 0.806
## O3 (.p3.) 1.148 0.040 28.727 0.000 0.471 0.902
## AG =~
24
## A1 1.000 0.346 0.689
## A2 (.p5.) 1.327 0.089 14.919 0.000 0.459 0.993
## A3 (.p6.) 1.021 0.033 31.242 0.000 0.353 0.744
## PR =~
## EP 1.000 0.552 0.761
## SP (.p8.) 0.822 0.049 16.706 0.000 0.454 0.685
## HP (.p9.) 1.029 0.114 9.020 0.000 0.568 0.363
## DP (.10.) 0.733 0.041 17.857 0.000 0.405 0.748
##
## Regressions:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## PR ~
## OP (a1) -0.620 0.097 -6.403 0.000 -0.461 -0.461
## AG (a2) -0.510 0.108 -4.719 0.000 -0.320 -0.320
##
## Covariances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## OP ~~
## AG 0.059 0.011 5.315 0.000 0.414 0.414
## .A1 ~~
## .A3 0.058 0.009 6.338 0.000 0.058 0.502
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## OP 0.168 0.019 9.083 0.000 1.000 1.000
## AG 0.120 0.015 7.753 0.000 1.000 1.000
## .O1 (.17.) 0.074 0.005 14.561 0.000 0.074 0.306
## .O2 (.18.) 0.079 0.005 15.870 0.000 0.079 0.351
## .O3 (.19.) 0.051 0.005 9.612 0.000 0.051 0.186
## .A1 (.20.) 0.132 0.009 14.304 0.000 0.132 0.525
## .A2 (.21.) 0.003 0.012 0.244 0.807 0.003 0.013
## .A3 (.22.) 0.101 0.008 11.859 0.000 0.101 0.447
## .EP (.23.) 0.221 0.016 14.053 0.000 0.221 0.421
## .SP (.24.) 0.233 0.014 16.504 0.000 0.233 0.531
## .HP (.25.) 2.133 0.106 20.044 0.000 2.133 0.869
## .DP (.26.) 0.129 0.009 14.552 0.000 0.129 0.440
## .PR 0.172 0.026 6.590 0.000 0.564 0.564
##
## R-Square:
## Estimate
## O1 0.694
## O2 0.649
## O3 0.814
## A1 0.475
## A2 0.987
## A3 0.553
## EP 0.579
## SP 0.469
## HP 0.131
## DP 0.560
## PR 0.436
##
##
## Group 2 [female]:
25
##
## Latent Variables:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## OP =~
## O1 1.000 0.394 0.822
## O2 (.p2.) 0.932 0.036 26.006 0.000 0.367 0.794
## O3 (.p3.) 1.148 0.040 28.727 0.000 0.452 0.895
## AG =~
## A1 1.000 0.343 0.686
## A2 (.p5.) 1.327 0.089 14.919 0.000 0.455 0.993
## A3 (.p6.) 1.021 0.033 31.242 0.000 0.351 0.741
## PR =~
## EP 1.000 0.511 0.736
## SP (.p8.) 0.822 0.049 16.706 0.000 0.420 0.656
## HP (.p9.) 1.029 0.114 9.020 0.000 0.526 0.339
## DP (.10.) 0.733 0.041 17.857 0.000 0.375 0.722
##
## Regressions:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## PR ~
## OP (b1) -0.586 0.060 -9.722 0.000 -0.451 -0.451
## AG (b2) -0.568 0.066 -8.614 0.000 -0.381 -0.381
##
## Covariances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## OP ~~
## AG 0.037 0.007 5.683 0.000 0.276 0.276
## .A1 ~~
## .A3 0.067 0.008 8.011 0.000 0.067 0.576
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## OP 0.155 0.012 12.660 0.000 1.000 1.000
## AG 0.118 0.013 9.258 0.000 1.000 1.000
## .O1 (.17.) 0.074 0.005 14.561 0.000 0.074 0.324
## .O2 (.18.) 0.079 0.005 15.870 0.000 0.079 0.370
## .O3 (.19.) 0.051 0.005 9.612 0.000 0.051 0.199
## .A1 (.20.) 0.132 0.009 14.304 0.000 0.132 0.529
## .A2 (.21.) 0.003 0.012 0.244 0.807 0.003 0.014
## .A3 (.22.) 0.101 0.008 11.859 0.000 0.101 0.450
## .EP (.23.) 0.221 0.016 14.053 0.000 0.221 0.459
## .SP (.24.) 0.233 0.014 16.504 0.000 0.233 0.569
## .HP (.25.) 2.133 0.106 20.044 0.000 2.133 0.885
## .DP (.26.) 0.129 0.009 14.552 0.000 0.129 0.478
## .PR 0.145 0.017 8.743 0.000 0.556 0.556
##
## R-Square:
## Estimate
## O1 0.676
## O2 0.630
## O3 0.801
## A1 0.471
## A2 0.986
## A3 0.550
26
## EP 0.541
## SP 0.431
## HP 0.115
## DP 0.522
## PR 0.444
# Hypothesis testing
lavTestWald(model5.fit, constraints = "a1==b1")
## $stat
## [1] 0.0955577
##
## $df
## [1] 1
##
## $p.value
## [1] 0.7572271
##
## $se
## [1] "standard"
lavTestWald(model5.fit, constraints = "a2==b2")
## $stat
## [1] 0.2275054
##
## $df
## [1] 1
##
## $p.value
## [1] 0.6333798
##
## $se
## [1] "standard"
# Covariance structure
OP ~~ OP + AG
AG ~~ AG
# Residual covariance
A1 ~~ A3
# Structural model
27
PR ~ OP + AG
'
# Summary
summary(model6.fit,
rsquare = TRUE,
fit.measures = TRUE,
standardized = TRUE)
28
## Loglikelihood user model (H0) -5575.924
## Loglikelihood unrestricted model (H1) -5471.305
##
## Akaike (AIC) 11209.847
## Bayesian (BIC) 11347.832
## Sample-size adjusted Bayesian (BIC) 11255.736
##
## Root Mean Square Error of Approximation:
##
## RMSEA 0.061
## 90 Percent confidence interval - lower 0.051
## 90 Percent confidence interval - upper 0.071
## P-value RMSEA <= 0.05 0.041
##
## Standardized Root Mean Square Residual:
##
## SRMR 0.067
##
## Parameter Estimates:
##
## Information Expected
## Information saturated (h1) model Structured
## Standard errors Standard
##
##
## Group 1 [male]:
##
## Latent Variables:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## OP =~
## O1 1.000 0.411 0.833
## O2 (.p2.) 0.932 0.036 26.007 0.000 0.383 0.806
## O3 (.p3.) 1.148 0.040 28.723 0.000 0.471 0.902
## AG =~
## A1 1.000 0.346 0.690
## A2 (.p5.) 1.322 0.088 14.987 0.000 0.458 0.991
## A3 (.p6.) 1.022 0.033 31.242 0.000 0.354 0.745
## PR =~
## EP 1.000 0.554 0.762
## SP (.p8.) 0.822 0.049 16.716 0.000 0.456 0.686
## HP (.p9.) 1.029 0.114 9.019 0.000 0.570 0.364
## DP (.10.) 0.733 0.041 17.855 0.000 0.406 0.749
##
## Regressions:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## PR ~
## OP (.15.) -0.593 0.053 -11.116 0.000 -0.439 -0.439
## AG (.16.) -0.554 0.058 -9.488 0.000 -0.346 -0.346
##
## Covariances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## OP ~~
## AG 0.059 0.011 5.315 0.000 0.414 0.414
## .A1 ~~
29
## .A3 0.058 0.009 6.303 0.000 0.058 0.500
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## OP 0.169 0.019 9.099 0.000 1.000 1.000
## AG 0.120 0.015 7.760 0.000 1.000 1.000
## .O1 (.17.) 0.074 0.005 14.560 0.000 0.074 0.306
## .O2 (.18.) 0.079 0.005 15.867 0.000 0.079 0.351
## .O3 (.19.) 0.051 0.005 9.610 0.000 0.051 0.186
## .A1 (.20.) 0.132 0.009 14.287 0.000 0.132 0.524
## .A2 (.21.) 0.004 0.012 0.312 0.755 0.004 0.017
## .A3 (.22.) 0.100 0.008 11.834 0.000 0.100 0.445
## .EP (.23.) 0.221 0.016 14.050 0.000 0.221 0.419
## .SP (.24.) 0.233 0.014 16.496 0.000 0.233 0.529
## .HP (.25.) 2.133 0.106 20.044 0.000 2.133 0.868
## .DP (.26.) 0.129 0.009 14.562 0.000 0.129 0.439
## .PR 0.172 0.026 6.611 0.000 0.561 0.561
##
## R-Square:
## Estimate
## O1 0.694
## O2 0.649
## O3 0.814
## A1 0.476
## A2 0.983
## A3 0.555
## EP 0.581
## SP 0.471
## HP 0.132
## DP 0.561
## PR 0.439
##
##
## Group 2 [female]:
##
## Latent Variables:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## OP =~
## O1 1.000 0.393 0.822
## O2 (.p2.) 0.932 0.036 26.007 0.000 0.367 0.794
## O3 (.p3.) 1.148 0.040 28.723 0.000 0.452 0.895
## AG =~
## A1 1.000 0.344 0.688
## A2 (.p5.) 1.322 0.088 14.987 0.000 0.455 0.991
## A3 (.p6.) 1.022 0.033 31.242 0.000 0.351 0.743
## PR =~
## EP 1.000 0.511 0.735
## SP (.p8.) 0.822 0.049 16.716 0.000 0.420 0.656
## HP (.p9.) 1.029 0.114 9.019 0.000 0.525 0.338
## DP (.10.) 0.733 0.041 17.855 0.000 0.374 0.722
##
## Regressions:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## PR ~
30
## OP (.15.) -0.593 0.053 -11.116 0.000 -0.457 -0.457
## AG (.16.) -0.554 0.058 -9.488 0.000 -0.374 -0.374
##
## Covariances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## OP ~~
## AG 0.038 0.007 5.698 0.000 0.277 0.277
## .A1 ~~
## .A3 0.066 0.008 7.978 0.000 0.066 0.575
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## OP 0.155 0.012 12.667 0.000 1.000 1.000
## AG 0.118 0.013 9.279 0.000 1.000 1.000
## .O1 (.17.) 0.074 0.005 14.560 0.000 0.074 0.324
## .O2 (.18.) 0.079 0.005 15.867 0.000 0.079 0.370
## .O3 (.19.) 0.051 0.005 9.610 0.000 0.051 0.199
## .A1 (.20.) 0.132 0.009 14.287 0.000 0.132 0.527
## .A2 (.21.) 0.004 0.012 0.312 0.755 0.004 0.017
## .A3 (.22.) 0.100 0.008 11.834 0.000 0.100 0.448
## .EP (.23.) 0.221 0.016 14.050 0.000 0.221 0.459
## .SP (.24.) 0.233 0.014 16.496 0.000 0.233 0.569
## .HP (.25.) 2.133 0.106 20.044 0.000 2.133 0.885
## .DP (.26.) 0.129 0.009 14.562 0.000 0.129 0.479
## .PR 0.145 0.017 8.747 0.000 0.557 0.557
##
## R-Square:
## Estimate
## O1 0.676
## O2 0.630
## O3 0.801
## A1 0.473
## A2 0.983
## A3 0.552
## EP 0.541
## SP 0.431
## HP 0.115
## DP 0.521
## PR 0.443
# Model comparison
anova(model5.fit, model6.fit)
31
R session info
sessionInfo()
32
## [94] survival_3.1-8 glasso_1.11 truncnorm_1.0-8
## [97] tibble_3.0.1 arm_1.10-1 cluster_2.1.0
## [100] statmod_1.4.34 ellipsis_0.3.0
33