### Confirmatory factor analysis with simple model modifications (modification indices)

### First, set the working directory where R will find the data

setwd("H:/data/User/Classes/multiv_13/YTs/YTSplit/Week 11 wmv - 2016/Wk11.R")
getwd()
## [1] "H:/data/User/Classes/multiv_13/YTs/YTSplit/Week 11 wmv - 2016/Wk11.R"
### Read the data
act<- read.csv("class12_practice_2014.csv")
head(act)
##   ï..const Cannabis   Heroin RecreationalPrescription  Cocaine
## 1 1 39.27526 37.96159 38.80631 35.61966
## 2 1 42.23284 46.17213 51.21147 57.59864
## 3 1 44.83347 46.99985 59.76539 49.09941
## 4 1 34.47021 41.91081 40.29767 43.06850
## 5 1 43.92398 41.56159 42.61687 38.01203
## 6 1 51.50516 44.16697 53.44381 44.51995
## InternalizedAnger ExternalizedAnger StateAnger TraitAnger ComorbidityIndex
## 1 53.69821 51.99119 53.46528 53.72893 38.54430
## 2 43.56667 51.99295 54.43380 44.36288 54.13281
## 3 63.13547 50.43772 48.84715 44.00640 42.28565
## 4 67.15893 48.21949 62.03162 51.11746 51.59931
## 5 60.95380 54.93101 53.09180 51.58114 40.10570
## 6 54.31116 59.33450 45.01612 56.69322 50.30999
## SubjectiveHealth FunctioningIndex FitnessIndex
## 1 46.61205 53.26231 48.87486
## 2 41.07006 52.10228 47.31790
## 3 58.08440 54.45158 50.20508
## 4 51.76131 48.43218 61.44567
## 5 55.22229 47.41978 58.48749
## 6 51.60633 45.14889 54.91742
library(lavaan)
## This is lavaan 0.6-7
## lavaan is BETA software! Please report any bugs.
#Confirmatory factor model with raw data

act.mod<- ' drugbelief =~ Cannabis + Heroin + RecreationalPrescription + Cocaine
anger =~ InternalizedAnger + ExternalizedAnger + StateAnger + TraitAnger
health =~ ComorbidityIndex + SubjectiveHealth + FunctioningIndex + FitnessIndex '

fit.act <- cfa(act.mod, data=act[2:13])
summary(fit.act, fit.measures=TRUE, standardized=TRUE)
fitmeasures(fit.act)
## lavaan 0.6-7 ended normally after 150 iterations
##
## Estimator ML
## Optimization method NLMINB
## Number of free parameters 27
##
## Number of observations 200
##
## Model Test User Model:
##
## Test statistic 128.888
## Degrees of freedom 51
## P-value (Chi-square) 0.000
##
## Model Test Baseline Model:
##
## Test statistic 960.853
## Degrees of freedom 66
## P-value 0.000
##
## User Model versus Baseline Model:
##
## Comparative Fit Index (CFI) 0.913
## Tucker-Lewis Index (TLI) 0.887
##
## Loglikelihood and Information Criteria:
##
## Loglikelihood user model (H0) -7647.167
## Loglikelihood unrestricted model (H1) -7582.723
##
## Akaike (AIC) 15348.333
## Bayesian (BIC) 15437.388
## Sample-size adjusted Bayesian (BIC) 15351.849
##
## Root Mean Square Error of Approximation:
##
## RMSEA 0.087
## 90 Percent confidence interval - lower 0.069
## 90 Percent confidence interval - upper 0.106
## P-value RMSEA <= 0.05 0.001
##
## Standardized Root Mean Square Residual:
##
## SRMR 0.052
##
## Parameter Estimates:
##
## Standard errors Standard
## Information Expected
## Information saturated (h1) model Structured
##
## Latent Variables:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## drugbelief =~
## Cannabis 1.000 8.657 0.882
## Heroin 0.630 0.051 12.447 0.000 5.454 0.808
## RcrtnlPrscrptn 0.617 0.055 11.190 0.000 5.340 0.732
## Cocaine 0.405 0.052 7.726 0.000 3.510 0.539
## anger =~
## InternalzdAngr 1.000 9.923 0.945
## ExternalzdAngr 0.572 0.042 13.647 0.000 5.672 0.778
## StateAnger 0.612 0.042 14.616 0.000 6.072 0.815
## TraitAnger 0.267 0.041 6.447 0.000 2.645 0.441
## health =~
## ComorbidtyIndx 1.000 5.229 0.842
## SubjectiveHlth 0.632 0.119 5.318 0.000 3.303 0.508
## FunctionngIndx 0.334 0.085 3.921 0.000 1.749 0.339
## FitnessIndex 0.542 0.104 5.195 0.000 2.836 0.489
##
## Covariances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## drugbelief ~~
## anger -9.961 6.807 -1.463 0.143 -0.116 -0.116
## health 15.505 4.146 3.739 0.000 0.343 0.343
## anger ~~
## health 14.454 4.528 3.192 0.001 0.279 0.279
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .Cannabis 21.480 4.610 4.659 0.000 21.480 0.223
## .Heroin 15.859 2.306 6.878 0.000 15.859 0.348
## .RcrtnlPrscrptn 24.714 3.008 8.216 0.000 24.714 0.464
## .Cocaine 30.044 3.195 9.403 0.000 30.044 0.709
## .InternalzdAngr 11.698 4.346 2.692 0.007 11.698 0.106
## .ExternalzdAngr 20.927 2.536 8.252 0.000 20.927 0.394
## .StateAnger 18.586 2.460 7.555 0.000 18.586 0.335
## .TraitAnger 28.996 2.961 9.792 0.000 28.996 0.806
## .ComorbidtyIndx 11.264 4.117 2.736 0.006 11.264 0.292
## .SubjectiveHlth 31.357 3.622 8.657 0.000 31.357 0.742
## .FunctionngIndx 23.584 2.462 9.580 0.000 23.584 0.885
## .FitnessIndex 25.563 2.900 8.815 0.000 25.563 0.761
## drugbelief 74.938 10.247 7.313 0.000 1.000 1.000
## anger 98.472 11.727 8.397 0.000 1.000 1.000
## health 27.342 5.414 5.050 0.000 1.000 1.000
(mi <- modindices(fit.act))
##                          lhs op                      rhs     mi     epc sepc.lv
## 31 drugbelief =~ InternalizedAnger 0.078 0.015 0.132
## 32 drugbelief =~ ExternalizedAnger 0.010 -0.004 -0.038
## 33 drugbelief =~ StateAnger 0.012 0.005 0.040
## 34 drugbelief =~ TraitAnger 0.954 -0.047 -0.405
## 35 drugbelief =~ ComorbidityIndex 0.049 0.016 0.136
## 36 drugbelief =~ SubjectiveHealth 0.048 -0.013 -0.111
## 37 drugbelief =~ FunctioningIndex 0.068 -0.012 -0.108
## 38 drugbelief =~ FitnessIndex 0.010 0.005 0.046
## 39 anger =~ Cannabis 0.008 0.005 0.045
## 40 anger =~ Heroin 3.662 -0.067 -0.663
## 41 anger =~ RecreationalPrescription 3.849 0.080 0.793
## 42 anger =~ Cocaine 0.095 0.013 0.129
## 43 anger =~ ComorbidityIndex 0.085 -0.016 -0.163
## 44 anger =~ SubjectiveHealth 0.001 0.001 0.012
## 45 anger =~ FunctioningIndex 0.678 0.032 0.319
## 46 anger =~ FitnessIndex 0.030 -0.007 -0.073
## 47 health =~ Cannabis 2.093 0.163 0.851
## 48 health =~ Heroin 2.028 -0.113 -0.589
## 49 health =~ RecreationalPrescription 0.003 -0.005 -0.028
## 50 health =~ Cocaine 0.070 -0.025 -0.131
## 51 health =~ InternalizedAnger 1.506 -0.124 -0.651
## 52 health =~ ExternalizedAnger 0.167 0.033 0.170
## 53 health =~ StateAnger 1.011 0.077 0.405
## 54 health =~ TraitAnger 0.154 0.035 0.181
## 55 Cannabis ~~ Heroin 6.563 -12.588 -12.588
## 56 Cannabis ~~ RecreationalPrescription 24.570 21.825 21.825
## 57 Cannabis ~~ Cocaine 13.710 -11.152 -11.152
## 58 Cannabis ~~ InternalizedAnger 0.587 1.907 1.907
## 59 Cannabis ~~ ExternalizedAnger 0.653 -1.712 -1.712
## 60 Cannabis ~~ StateAnger 1.428 -2.435 -2.435
## 61 Cannabis ~~ TraitAnger 2.795 3.952 3.952
## 62 Cannabis ~~ ComorbidityIndex 3.314 4.156 4.156
## 63 Cannabis ~~ SubjectiveHealth 0.009 -0.245 -0.245
## 64 Cannabis ~~ FunctioningIndex 0.212 -0.992 -0.992
## 65 Cannabis ~~ FitnessIndex 0.234 -1.114 -1.114
## 66 Heroin ~~ RecreationalPrescription 7.147 -7.164 -7.164
## 67 Heroin ~~ Cocaine 33.298 11.689 11.689
## 68 Heroin ~~ InternalizedAnger 2.382 -2.819 -2.819
## 69 Heroin ~~ ExternalizedAnger 1.102 1.642 1.642
## 70 Heroin ~~ StateAnger 0.006 0.117 0.117
## 71 Heroin ~~ TraitAnger 0.186 -0.752 -0.752
## 72 Heroin ~~ ComorbidityIndex 0.995 -1.635 -1.635
## 73 Heroin ~~ SubjectiveHealth 0.079 -0.528 -0.528
## 74 Heroin ~~ FunctioningIndex 0.009 -0.152 -0.152
## 75 Heroin ~~ FitnessIndex 0.976 1.672 1.672
## 76 RecreationalPrescription ~~ Cocaine 3.496 -4.214 -4.214
## 77 RecreationalPrescription ~~ InternalizedAnger 6.057 5.297 5.297
## 78 RecreationalPrescription ~~ ExternalizedAnger 1.260 -2.074 -2.074
## 79 RecreationalPrescription ~~ StateAnger 0.202 0.797 0.797
## 80 RecreationalPrescription ~~ TraitAnger 8.853 -6.140 -6.140
## 81 RecreationalPrescription ~~ ComorbidityIndex 0.357 -1.143 -1.143
## 82 RecreationalPrescription ~~ SubjectiveHealth 0.145 0.844 0.844
## 83 RecreationalPrescription ~~ FunctioningIndex 0.496 1.319 1.319
## 84 RecreationalPrescription ~~ FitnessIndex 1.525 -2.465 -2.465
## 85 Cocaine ~~ InternalizedAnger 2.210 -3.346 -3.346
## 86 Cocaine ~~ ExternalizedAnger 1.321 2.224 2.224
## 87 Cocaine ~~ StateAnger 1.894 2.560 2.560
## 88 Cocaine ~~ TraitAnger 0.039 -0.425 -0.425
## 89 Cocaine ~~ ComorbidityIndex 0.845 -1.826 -1.826
## 90 Cocaine ~~ SubjectiveHealth 0.035 -0.434 -0.434
## 91 Cocaine ~~ FunctioningIndex 0.000 0.004 0.004
## 92 Cocaine ~~ FitnessIndex 1.556 2.605 2.605
## 93 InternalizedAnger ~~ ExternalizedAnger 0.039 -1.108 -1.108
## 94 InternalizedAnger ~~ StateAnger 33.592 37.899 37.899
## 95 InternalizedAnger ~~ TraitAnger 15.983 -10.404 -10.404
## 96 InternalizedAnger ~~ ComorbidityIndex 0.614 -1.652 -1.652
## 97 InternalizedAnger ~~ SubjectiveHealth 0.286 1.259 1.259
## 98 InternalizedAnger ~~ FunctioningIndex 0.657 1.603 1.603
## 99 InternalizedAnger ~~ FitnessIndex 4.305 -4.389 -4.389
## 100 ExternalizedAnger ~~ StateAnger 18.227 -12.863 -12.863
## 101 ExternalizedAnger ~~ TraitAnger 38.409 11.994 11.994
## 102 ExternalizedAnger ~~ ComorbidityIndex 0.305 -0.952 -0.952
## 103 ExternalizedAnger ~~ SubjectiveHealth 0.545 1.483 1.483
## 104 ExternalizedAnger ~~ FunctioningIndex 0.640 -1.357 -1.357
## 105 ExternalizedAnger ~~ FitnessIndex 2.896 3.073 3.073
## 106 StateAnger ~~ TraitAnger 1.488 -2.305 -2.305
## 107 StateAnger ~~ ComorbidityIndex 1.836 2.252 2.252
## 108 StateAnger ~~ SubjectiveHealth 1.766 -2.565 -2.565
## 109 StateAnger ~~ FunctioningIndex 0.013 -0.189 -0.189
## 110 StateAnger ~~ FitnessIndex 0.526 1.259 1.259
## 111 TraitAnger ~~ ComorbidityIndex 0.001 0.073 0.073
## 112 TraitAnger ~~ SubjectiveHealth 0.034 -0.412 -0.412
## 113 TraitAnger ~~ FunctioningIndex 0.867 1.763 1.763
## 114 TraitAnger ~~ FitnessIndex 1.209 2.216 2.216
## 115 ComorbidityIndex ~~ SubjectiveHealth 1.179 -4.742 -4.742
## 116 ComorbidityIndex ~~ FunctioningIndex 4.678 5.575 5.575
## 117 ComorbidityIndex ~~ FitnessIndex 0.634 -2.966 -2.966
## 118 SubjectiveHealth ~~ FunctioningIndex 1.763 -2.871 -2.871
## 119 SubjectiveHealth ~~ FitnessIndex 5.302 5.868 5.868
## 120 FunctioningIndex ~~ FitnessIndex 3.979 -3.851 -3.851
## sepc.all sepc.nox
## 31 0.013 0.013
## 32 -0.005 -0.005
## 33 0.005 0.005
## 34 -0.067 -0.067
## 35 0.022 0.022
## 36 -0.017 -0.017
## 37 -0.021 -0.021
## 38 0.008 0.008
## 39 0.005 0.005
## 40 -0.098 -0.098
## 41 0.109 0.109
## 42 0.020 0.020
## 43 -0.026 -0.026
## 44 0.002 0.002
## 45 0.062 0.062
## 46 -0.013 -0.013
## 47 0.087 0.087
## 48 -0.087 -0.087
## 49 -0.004 -0.004
## 50 -0.020 -0.020
## 51 -0.062 -0.062
## 52 0.023 0.023
## 53 0.054 0.054
## 54 0.030 0.030
## 55 -0.682 -0.682
## 56 0.947 0.947
## 57 -0.439 -0.439
## 58 0.120 0.120
## 59 -0.081 -0.081
## 60 -0.122 -0.122
## 61 0.158 0.158
## 62 0.267 0.267
## 63 -0.009 -0.009
## 64 -0.044 -0.044
## 65 -0.048 -0.048
## 66 -0.362 -0.362
## 67 0.536 0.536
## 68 -0.207 -0.207
## 69 0.090 0.090
## 70 0.007 0.007
## 71 -0.035 -0.035
## 72 -0.122 -0.122
## 73 -0.024 -0.024
## 74 -0.008 -0.008
## 75 0.083 0.083
## 76 -0.155 -0.155
## 77 0.312 0.312
## 78 -0.091 -0.091
## 79 0.037 0.037
## 80 -0.229 -0.229
## 81 -0.068 -0.068
## 82 0.030 0.030
## 83 0.055 0.055
## 84 -0.098 -0.098
## 85 -0.178 -0.178
## 86 0.089 0.089
## 87 0.108 0.108
## 88 -0.014 -0.014
## 89 -0.099 -0.099
## 90 -0.014 -0.014
## 91 0.000 0.000
## 92 0.094 0.094
## 93 -0.071 -0.071
## 94 2.570 2.570
## 95 -0.565 -0.565
## 96 -0.144 -0.144
## 97 0.066 0.066
## 98 0.097 0.097
## 99 -0.254 -0.254
## 100 -0.652 -0.652
## 101 0.487 0.487
## 102 -0.062 -0.062
## 103 0.058 0.058
## 104 -0.061 -0.061
## 105 0.133 0.133
## 106 -0.099 -0.099
## 107 0.156 0.156
## 108 -0.106 -0.106
## 109 -0.009 -0.009
## 110 0.058 0.058
## 111 0.004 0.004
## 112 -0.014 -0.014
## 113 0.067 0.067
## 114 0.081 0.081
## 115 -0.252 -0.252
## 116 0.342 0.342
## 117 -0.175 -0.175
## 118 -0.106 -0.106
## 119 0.207 0.207
## 120 -0.157 -0.157
#To filter to only get MIs for correlated uniquenesses
mi[mi$op == "~~",]
##                          lhs op                      rhs     mi     epc sepc.lv
## 55 Cannabis ~~ Heroin 6.563 -12.588 -12.588
## 56 Cannabis ~~ RecreationalPrescription 24.570 21.825 21.825
## 57 Cannabis ~~ Cocaine 13.710 -11.152 -11.152
## 58 Cannabis ~~ InternalizedAnger 0.587 1.907 1.907
## 59 Cannabis ~~ ExternalizedAnger 0.653 -1.712 -1.712
## 60 Cannabis ~~ StateAnger 1.428 -2.435 -2.435
## 61 Cannabis ~~ TraitAnger 2.795 3.952 3.952
## 62 Cannabis ~~ ComorbidityIndex 3.314 4.156 4.156
## 63 Cannabis ~~ SubjectiveHealth 0.009 -0.245 -0.245
## 64 Cannabis ~~ FunctioningIndex 0.212 -0.992 -0.992
## 65 Cannabis ~~ FitnessIndex 0.234 -1.114 -1.114
## 66 Heroin ~~ RecreationalPrescription 7.147 -7.164 -7.164
## 67 Heroin ~~ Cocaine 33.298 11.689 11.689
## 68 Heroin ~~ InternalizedAnger 2.382 -2.819 -2.819
## 69 Heroin ~~ ExternalizedAnger 1.102 1.642 1.642
## 70 Heroin ~~ StateAnger 0.006 0.117 0.117
## 71 Heroin ~~ TraitAnger 0.186 -0.752 -0.752
## 72 Heroin ~~ ComorbidityIndex 0.995 -1.635 -1.635
## 73 Heroin ~~ SubjectiveHealth 0.079 -0.528 -0.528
## 74 Heroin ~~ FunctioningIndex 0.009 -0.152 -0.152
## 75 Heroin ~~ FitnessIndex 0.976 1.672 1.672
## 76 RecreationalPrescription ~~ Cocaine 3.496 -4.214 -4.214
## 77 RecreationalPrescription ~~ InternalizedAnger 6.057 5.297 5.297
## 78 RecreationalPrescription ~~ ExternalizedAnger 1.260 -2.074 -2.074
## 79 RecreationalPrescription ~~ StateAnger 0.202 0.797 0.797
## 80 RecreationalPrescription ~~ TraitAnger 8.853 -6.140 -6.140
## 81 RecreationalPrescription ~~ ComorbidityIndex 0.357 -1.143 -1.143
## 82 RecreationalPrescription ~~ SubjectiveHealth 0.145 0.844 0.844
## 83 RecreationalPrescription ~~ FunctioningIndex 0.496 1.319 1.319
## 84 RecreationalPrescription ~~ FitnessIndex 1.525 -2.465 -2.465
## 85 Cocaine ~~ InternalizedAnger 2.210 -3.346 -3.346
## 86 Cocaine ~~ ExternalizedAnger 1.321 2.224 2.224
## 87 Cocaine ~~ StateAnger 1.894 2.560 2.560
## 88 Cocaine ~~ TraitAnger 0.039 -0.425 -0.425
## 89 Cocaine ~~ ComorbidityIndex 0.845 -1.826 -1.826
## 90 Cocaine ~~ SubjectiveHealth 0.035 -0.434 -0.434
## 91 Cocaine ~~ FunctioningIndex 0.000 0.004 0.004
## 92 Cocaine ~~ FitnessIndex 1.556 2.605 2.605
## 93 InternalizedAnger ~~ ExternalizedAnger 0.039 -1.108 -1.108
## 94 InternalizedAnger ~~ StateAnger 33.592 37.899 37.899
## 95 InternalizedAnger ~~ TraitAnger 15.983 -10.404 -10.404
## 96 InternalizedAnger ~~ ComorbidityIndex 0.614 -1.652 -1.652
## 97 InternalizedAnger ~~ SubjectiveHealth 0.286 1.259 1.259
## 98 InternalizedAnger ~~ FunctioningIndex 0.657 1.603 1.603
## 99 InternalizedAnger ~~ FitnessIndex 4.305 -4.389 -4.389
## 100 ExternalizedAnger ~~ StateAnger 18.227 -12.863 -12.863
## 101 ExternalizedAnger ~~ TraitAnger 38.409 11.994 11.994
## 102 ExternalizedAnger ~~ ComorbidityIndex 0.305 -0.952 -0.952
## 103 ExternalizedAnger ~~ SubjectiveHealth 0.545 1.483 1.483
## 104 ExternalizedAnger ~~ FunctioningIndex 0.640 -1.357 -1.357
## 105 ExternalizedAnger ~~ FitnessIndex 2.896 3.073 3.073
## 106 StateAnger ~~ TraitAnger 1.488 -2.305 -2.305
## 107 StateAnger ~~ ComorbidityIndex 1.836 2.252 2.252
## 108 StateAnger ~~ SubjectiveHealth 1.766 -2.565 -2.565
## 109 StateAnger ~~ FunctioningIndex 0.013 -0.189 -0.189
## 110 StateAnger ~~ FitnessIndex 0.526 1.259 1.259
## 111 TraitAnger ~~ ComorbidityIndex 0.001 0.073 0.073
## 112 TraitAnger ~~ SubjectiveHealth 0.034 -0.412 -0.412
## 113 TraitAnger ~~ FunctioningIndex 0.867 1.763 1.763
## 114 TraitAnger ~~ FitnessIndex 1.209 2.216 2.216
## 115 ComorbidityIndex ~~ SubjectiveHealth 1.179 -4.742 -4.742
## 116 ComorbidityIndex ~~ FunctioningIndex 4.678 5.575 5.575
## 117 ComorbidityIndex ~~ FitnessIndex 0.634 -2.966 -2.966
## 118 SubjectiveHealth ~~ FunctioningIndex 1.763 -2.871 -2.871
## 119 SubjectiveHealth ~~ FitnessIndex 5.302 5.868 5.868
## 120 FunctioningIndex ~~ FitnessIndex 3.979 -3.851 -3.851
## sepc.all sepc.nox
## 55 -0.682 -0.682
## 56 0.947 0.947
## 57 -0.439 -0.439
## 58 0.120 0.120
## 59 -0.081 -0.081
## 60 -0.122 -0.122
## 61 0.158 0.158
## 62 0.267 0.267
## 63 -0.009 -0.009
## 64 -0.044 -0.044
## 65 -0.048 -0.048
## 66 -0.362 -0.362
## 67 0.536 0.536
## 68 -0.207 -0.207
## 69 0.090 0.090
## 70 0.007 0.007
## 71 -0.035 -0.035
## 72 -0.122 -0.122
## 73 -0.024 -0.024
## 74 -0.008 -0.008
## 75 0.083 0.083
## 76 -0.155 -0.155
## 77 0.312 0.312
## 78 -0.091 -0.091
## 79 0.037 0.037
## 80 -0.229 -0.229
## 81 -0.068 -0.068
## 82 0.030 0.030
## 83 0.055 0.055
## 84 -0.098 -0.098
## 85 -0.178 -0.178
## 86 0.089 0.089
## 87 0.108 0.108
## 88 -0.014 -0.014
## 89 -0.099 -0.099
## 90 -0.014 -0.014
## 91 0.000 0.000
## 92 0.094 0.094
## 93 -0.071 -0.071
## 94 2.570 2.570
## 95 -0.565 -0.565
## 96 -0.144 -0.144
## 97 0.066 0.066
## 98 0.097 0.097
## 99 -0.254 -0.254
## 100 -0.652 -0.652
## 101 0.487 0.487
## 102 -0.062 -0.062
## 103 0.058 0.058
## 104 -0.061 -0.061
## 105 0.133 0.133
## 106 -0.099 -0.099
## 107 0.156 0.156
## 108 -0.106 -0.106
## 109 -0.009 -0.009
## 110 0.058 0.058
## 111 0.004 0.004
## 112 -0.014 -0.014
## 113 0.067 0.067
## 114 0.081 0.081
## 115 -0.252 -0.252
## 116 0.342 0.342
## 117 -0.175 -0.175
## 118 -0.106 -0.106
## 119 0.207 0.207
## 120 -0.157 -0.157
## If you go to the "mi" data frame at the right, and SORT on the MI column, you 
# can sort the parameters from highest to lowest.

#Rerun of confirmatory model, freeing up Externalized Anger ~~ TraitAnger

act.mod2<- ' drugbelief =~ Cannabis + Heroin + RecreationalPrescription + Cocaine
anger =~ InternalizedAnger + ExternalizedAnger + StateAnger + TraitAnger
health =~ ComorbidityIndex + SubjectiveHealth + FunctioningIndex + FitnessIndex
#Correlated uniqueness
ExternalizedAnger ~~ TraitAnger'

fit.act2 <- cfa(act.mod2, data=act[2:13])
summary(fit.act2, fit.measures=TRUE, standardized=TRUE)
fitmeasures(fit.act2)
## lavaan 0.6-7 ended normally after 164 iterations
##
## Estimator ML
## Optimization method NLMINB
## Number of free parameters 28
##
## Number of observations 200
##
## Model Test User Model:
##
## Test statistic 88.112
## Degrees of freedom 50
## P-value (Chi-square) 0.001
##
## Model Test Baseline Model:
##
## Test statistic 960.853
## Degrees of freedom 66
## P-value 0.000
##
## User Model versus Baseline Model:
##
## Comparative Fit Index (CFI) 0.957
## Tucker-Lewis Index (TLI) 0.944
##
## Loglikelihood and Information Criteria:
##
## Loglikelihood user model (H0) -7626.779
## Loglikelihood unrestricted model (H1) -7582.723
##
## Akaike (AIC) 15309.557
## Bayesian (BIC) 15401.910
## Sample-size adjusted Bayesian (BIC) 15313.203
##
## Root Mean Square Error of Approximation:
##
## RMSEA 0.062
## 90 Percent confidence interval - lower 0.040
## 90 Percent confidence interval - upper 0.083
## P-value RMSEA <= 0.05 0.174
##
## Standardized Root Mean Square Residual:
##
## SRMR 0.047
##
## Parameter Estimates:
##
## Standard errors Standard
## Information Expected
## Information saturated (h1) model Structured
##
## Latent Variables:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## drugbelief =~
## Cannabis 1.000 8.652 0.881
## Heroin 0.631 0.051 12.442 0.000 5.456 0.808
## RcrtnlPrscrptn 0.617 0.055 11.178 0.000 5.338 0.732
## Cocaine 0.406 0.053 7.737 0.000 3.515 0.540
## anger =~
## InternalzdAngr 1.000 10.291 0.980
## ExternalzdAngr 0.531 0.042 12.692 0.000 5.460 0.749
## StateAnger 0.578 0.042 13.898 0.000 5.946 0.798
## TraitAnger 0.225 0.040 5.598 0.000 2.312 0.385
## health =~
## ComorbidtyIndx 1.000 5.244 0.844
## SubjectiveHlth 0.629 0.119 5.278 0.000 3.299 0.508
## FunctionngIndx 0.334 0.085 3.913 0.000 1.750 0.339
## FitnessIndex 0.538 0.105 5.144 0.000 2.821 0.487
##
## Covariances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .ExternalizedAnger ~~
## .TraitAnger 12.098 2.196 5.509 0.000 12.098 0.453
## drugbelief ~~
## anger -9.635 6.897 -1.397 0.162 -0.108 -0.108
## health 15.514 4.149 3.739 0.000 0.342 0.342
## anger ~~
## health 13.911 4.578 3.039 0.002 0.258 0.258
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .Cannabis 21.559 4.616 4.670 0.000 21.559 0.224
## .Heroin 15.827 2.306 6.863 0.000 15.827 0.347
## .RcrtnlPrscrptn 24.736 3.011 8.216 0.000 24.736 0.465
## .Cocaine 30.006 3.192 9.399 0.000 30.006 0.708
## .InternalzdAngr 4.267 5.028 0.849 0.396 4.267 0.039
## .ExternalzdAngr 23.286 2.729 8.534 0.000 23.286 0.439
## .StateAnger 20.102 2.619 7.675 0.000 20.102 0.362
## .TraitAnger 30.650 3.093 9.910 0.000 30.650 0.852
## .ComorbidtyIndx 11.107 4.185 2.654 0.008 11.107 0.288
## .SubjectiveHlth 31.378 3.629 8.647 0.000 31.378 0.742
## .FunctionngIndx 23.579 2.462 9.579 0.000 23.579 0.885
## .FitnessIndex 25.649 2.907 8.825 0.000 25.649 0.763
## drugbelief 74.859 10.246 7.306 0.000 1.000 1.000
## anger 105.903 12.095 8.756 0.000 1.000 1.000
## health 27.499 5.472 5.025 0.000 1.000 1.000
(mi2 <- modindices(fit.act2))
##                          lhs op                      rhs     mi     epc sepc.lv
## 32 drugbelief =~ InternalizedAnger 0.023 0.008 0.072
## 33 drugbelief =~ ExternalizedAnger 0.070 0.010 0.089
## 34 drugbelief =~ StateAnger 0.004 -0.003 -0.022
## 35 drugbelief =~ TraitAnger 1.130 -0.046 -0.399
## 36 drugbelief =~ ComorbidityIndex 0.039 0.014 0.123
## 37 drugbelief =~ SubjectiveHealth 0.046 -0.013 -0.109
## 38 drugbelief =~ FunctioningIndex 0.067 -0.012 -0.107
## 39 drugbelief =~ FitnessIndex 0.017 0.007 0.059
## 40 anger =~ Cannabis 0.012 0.005 0.051
## 41 anger =~ Heroin 4.083 -0.066 -0.684
## 42 anger =~ RecreationalPrescription 4.834 0.084 0.868
## 43 anger =~ Cocaine 0.012 0.004 0.044
## 44 anger =~ ComorbidityIndex 0.058 -0.013 -0.130
## 45 anger =~ SubjectiveHealth 0.019 0.006 0.063
## 46 anger =~ FunctioningIndex 0.772 0.032 0.330
## 47 anger =~ FitnessIndex 0.160 -0.016 -0.164
## 48 health =~ Cannabis 2.152 0.164 0.862
## 49 health =~ Heroin 2.059 -0.113 -0.593
## 50 health =~ RecreationalPrescription 0.002 -0.004 -0.023
## 51 health =~ Cocaine 0.089 -0.028 -0.148
## 52 health =~ InternalizedAnger 2.456 -0.160 -0.842
## 53 health =~ ExternalizedAnger 0.279 0.037 0.196
## 54 health =~ StateAnger 1.797 0.101 0.528
## 55 health =~ TraitAnger 0.134 0.029 0.151
## 56 Cannabis ~~ Heroin 6.590 -12.656 -12.656
## 57 Cannabis ~~ RecreationalPrescription 25.107 22.088 22.088
## 58 Cannabis ~~ Cocaine 13.880 -11.231 -11.231
## 59 Cannabis ~~ InternalizedAnger 1.794 3.246 3.246
## 60 Cannabis ~~ ExternalizedAnger 3.118 -3.376 -3.376
## 61 Cannabis ~~ StateAnger 1.516 -2.483 -2.483
## 62 Cannabis ~~ TraitAnger 4.583 4.601 4.601
## 63 Cannabis ~~ ComorbidityIndex 3.276 4.138 4.138
## 64 Cannabis ~~ SubjectiveHealth 0.008 -0.231 -0.231
## 65 Cannabis ~~ FunctioningIndex 0.215 -0.997 -0.997
## 66 Cannabis ~~ FitnessIndex 0.245 -1.142 -1.142
## 67 Heroin ~~ RecreationalPrescription 7.224 -7.220 -7.220
## 68 Heroin ~~ Cocaine 33.163 11.672 11.672
## 69 Heroin ~~ InternalizedAnger 2.742 -2.931 -2.931
## 70 Heroin ~~ ExternalizedAnger 1.810 1.898 1.898
## 71 Heroin ~~ StateAnger 0.019 0.204 0.204
## 72 Heroin ~~ TraitAnger 1.115 -1.675 -1.675
## 73 Heroin ~~ ComorbidityIndex 0.988 -1.630 -1.630
## 74 Heroin ~~ SubjectiveHealth 0.074 -0.510 -0.510
## 75 Heroin ~~ FunctioningIndex 0.009 -0.148 -0.148
## 76 Heroin ~~ FitnessIndex 0.959 1.658 1.658
## 77 RecreationalPrescription ~~ Cocaine 3.548 -4.246 -4.246
## 78 RecreationalPrescription ~~ InternalizedAnger 3.515 3.909 3.909
## 79 RecreationalPrescription ~~ ExternalizedAnger 0.002 0.066 0.066
## 80 RecreationalPrescription ~~ StateAnger 0.001 0.065 0.065
## 81 RecreationalPrescription ~~ TraitAnger 6.810 -4.894 -4.894
## 82 RecreationalPrescription ~~ ComorbidityIndex 0.380 -1.181 -1.181
## 83 RecreationalPrescription ~~ SubjectiveHealth 0.146 0.849 0.849
## 84 RecreationalPrescription ~~ FunctioningIndex 0.493 1.316 1.316
## 85 RecreationalPrescription ~~ FitnessIndex 1.537 -2.477 -2.477
## 86 Cocaine ~~ InternalizedAnger 2.855 -3.677 -3.677
## 87 Cocaine ~~ ExternalizedAnger 2.119 2.540 2.540
## 88 Cocaine ~~ StateAnger 2.241 2.754 2.754
## 89 Cocaine ~~ TraitAnger 0.558 -1.467 -1.467
## 90 Cocaine ~~ ComorbidityIndex 0.773 -1.747 -1.747
## 91 Cocaine ~~ SubjectiveHealth 0.029 -0.395 -0.395
## 92 Cocaine ~~ FunctioningIndex 0.000 0.021 0.021
## 93 Cocaine ~~ FitnessIndex 1.574 2.621 2.621
## 94 InternalizedAnger ~~ ExternalizedAnger 2.391 8.522 8.522
## 95 InternalizedAnger ~~ StateAnger 0.869 12.564 12.564
## 96 InternalizedAnger ~~ TraitAnger 0.839 -2.520 -2.520
## 97 InternalizedAnger ~~ ComorbidityIndex 1.166 -2.269 -2.269
## 98 InternalizedAnger ~~ SubjectiveHealth 0.247 1.136 1.136
## 99 InternalizedAnger ~~ FunctioningIndex 1.115 2.022 2.022
## 100 InternalizedAnger ~~ FitnessIndex 4.174 -4.198 -4.198
## 101 ExternalizedAnger ~~ StateAnger 2.634 -4.861 -4.861
## 102 ExternalizedAnger ~~ ComorbidityIndex 0.122 -0.543 -0.543
## 103 ExternalizedAnger ~~ SubjectiveHealth 0.666 1.477 1.477
## 104 ExternalizedAnger ~~ FunctioningIndex 1.691 -1.989 -1.989
## 105 ExternalizedAnger ~~ FitnessIndex 2.243 2.441 2.441
## 106 StateAnger ~~ TraitAnger 0.426 1.061 1.061
## 107 StateAnger ~~ ComorbidityIndex 2.394 2.548 2.548
## 108 StateAnger ~~ SubjectiveHealth 1.570 -2.393 -2.393
## 109 StateAnger ~~ FunctioningIndex 0.017 -0.210 -0.210
## 110 StateAnger ~~ FitnessIndex 1.123 1.821 1.821
## 111 TraitAnger ~~ ComorbidityIndex 0.148 0.668 0.668
## 112 TraitAnger ~~ SubjectiveHealth 0.245 -1.009 -1.009
## 113 TraitAnger ~~ FunctioningIndex 2.031 2.451 2.451
## 114 TraitAnger ~~ FitnessIndex 0.170 0.755 0.755
## 115 ComorbidityIndex ~~ SubjectiveHealth 1.460 -5.393 -5.393
## 116 ComorbidityIndex ~~ FunctioningIndex 4.648 5.631 5.631
## 117 ComorbidityIndex ~~ FitnessIndex 0.517 -2.722 -2.722
## 118 SubjectiveHealth ~~ FunctioningIndex 1.767 -2.880 -2.880
## 119 SubjectiveHealth ~~ FitnessIndex 5.496 6.009 6.009
## 120 FunctioningIndex ~~ FitnessIndex 3.913 -3.827 -3.827
## sepc.all sepc.nox
## 32 0.007 0.007
## 33 0.012 0.012
## 34 -0.003 -0.003
## 35 -0.067 -0.067
## 36 0.020 0.020
## 37 -0.017 -0.017
## 38 -0.021 -0.021
## 39 0.010 0.010
## 40 0.005 0.005
## 41 -0.101 -0.101
## 42 0.119 0.119
## 43 0.007 0.007
## 44 -0.021 -0.021
## 45 0.010 0.010
## 46 0.064 0.064
## 47 -0.028 -0.028
## 48 0.088 0.088
## 49 -0.088 -0.088
## 50 -0.003 -0.003
## 51 -0.023 -0.023
## 52 -0.080 -0.080
## 53 0.027 0.027
## 54 0.071 0.071
## 55 0.025 0.025
## 56 -0.685 -0.685
## 57 0.956 0.956
## 58 -0.442 -0.442
## 59 0.338 0.338
## 60 -0.151 -0.151
## 61 -0.119 -0.119
## 62 0.179 0.179
## 63 0.267 0.267
## 64 -0.009 -0.009
## 65 -0.044 -0.044
## 66 -0.049 -0.049
## 67 -0.365 -0.365
## 68 0.536 0.536
## 69 -0.357 -0.357
## 70 0.099 0.099
## 71 0.011 0.011
## 72 -0.076 -0.076
## 73 -0.123 -0.123
## 74 -0.023 -0.023
## 75 -0.008 -0.008
## 76 0.082 0.082
## 77 -0.156 -0.156
## 78 0.380 0.380
## 79 0.003 0.003
## 80 0.003 0.003
## 81 -0.178 -0.178
## 82 -0.071 -0.071
## 83 0.030 0.030
## 84 0.054 0.054
## 85 -0.098 -0.098
## 86 -0.325 -0.325
## 87 0.096 0.096
## 88 0.112 0.112
## 89 -0.048 -0.048
## 90 -0.096 -0.096
## 91 -0.013 -0.013
## 92 0.001 0.001
## 93 0.094 0.094
## 94 0.855 0.855
## 95 1.356 1.356
## 96 -0.220 -0.220
## 97 -0.330 -0.330
## 98 0.098 0.098
## 99 0.202 0.202
## 100 -0.401 -0.401
## 101 -0.225 -0.225
## 102 -0.034 -0.034
## 103 0.055 0.055
## 104 -0.085 -0.085
## 105 0.100 0.100
## 106 0.043 0.043
## 107 0.171 0.171
## 108 -0.095 -0.095
## 109 -0.010 -0.010
## 110 0.080 0.080
## 111 0.036 0.036
## 112 -0.033 -0.033
## 113 0.091 0.091
## 114 0.027 0.027
## 115 -0.289 -0.289
## 116 0.348 0.348
## 117 -0.161 -0.161
## 118 -0.106 -0.106
## 119 0.212 0.212
## 120 -0.156 -0.156
#To filter to only get MIs for correlated uniquenesses
mi2[mi2$op == "~~",]
##                          lhs op                      rhs     mi     epc sepc.lv
## 56 Cannabis ~~ Heroin 6.590 -12.656 -12.656
## 57 Cannabis ~~ RecreationalPrescription 25.107 22.088 22.088
## 58 Cannabis ~~ Cocaine 13.880 -11.231 -11.231
## 59 Cannabis ~~ InternalizedAnger 1.794 3.246 3.246
## 60 Cannabis ~~ ExternalizedAnger 3.118 -3.376 -3.376
## 61 Cannabis ~~ StateAnger 1.516 -2.483 -2.483
## 62 Cannabis ~~ TraitAnger 4.583 4.601 4.601
## 63 Cannabis ~~ ComorbidityIndex 3.276 4.138 4.138
## 64 Cannabis ~~ SubjectiveHealth 0.008 -0.231 -0.231
## 65 Cannabis ~~ FunctioningIndex 0.215 -0.997 -0.997
## 66 Cannabis ~~ FitnessIndex 0.245 -1.142 -1.142
## 67 Heroin ~~ RecreationalPrescription 7.224 -7.220 -7.220
## 68 Heroin ~~ Cocaine 33.163 11.672 11.672
## 69 Heroin ~~ InternalizedAnger 2.742 -2.931 -2.931
## 70 Heroin ~~ ExternalizedAnger 1.810 1.898 1.898
## 71 Heroin ~~ StateAnger 0.019 0.204 0.204
## 72 Heroin ~~ TraitAnger 1.115 -1.675 -1.675
## 73 Heroin ~~ ComorbidityIndex 0.988 -1.630 -1.630
## 74 Heroin ~~ SubjectiveHealth 0.074 -0.510 -0.510
## 75 Heroin ~~ FunctioningIndex 0.009 -0.148 -0.148
## 76 Heroin ~~ FitnessIndex 0.959 1.658 1.658
## 77 RecreationalPrescription ~~ Cocaine 3.548 -4.246 -4.246
## 78 RecreationalPrescription ~~ InternalizedAnger 3.515 3.909 3.909
## 79 RecreationalPrescription ~~ ExternalizedAnger 0.002 0.066 0.066
## 80 RecreationalPrescription ~~ StateAnger 0.001 0.065 0.065
## 81 RecreationalPrescription ~~ TraitAnger 6.810 -4.894 -4.894
## 82 RecreationalPrescription ~~ ComorbidityIndex 0.380 -1.181 -1.181
## 83 RecreationalPrescription ~~ SubjectiveHealth 0.146 0.849 0.849
## 84 RecreationalPrescription ~~ FunctioningIndex 0.493 1.316 1.316
## 85 RecreationalPrescription ~~ FitnessIndex 1.537 -2.477 -2.477
## 86 Cocaine ~~ InternalizedAnger 2.855 -3.677 -3.677
## 87 Cocaine ~~ ExternalizedAnger 2.119 2.540 2.540
## 88 Cocaine ~~ StateAnger 2.241 2.754 2.754
## 89 Cocaine ~~ TraitAnger 0.558 -1.467 -1.467
## 90 Cocaine ~~ ComorbidityIndex 0.773 -1.747 -1.747
## 91 Cocaine ~~ SubjectiveHealth 0.029 -0.395 -0.395
## 92 Cocaine ~~ FunctioningIndex 0.000 0.021 0.021
## 93 Cocaine ~~ FitnessIndex 1.574 2.621 2.621
## 94 InternalizedAnger ~~ ExternalizedAnger 2.391 8.522 8.522
## 95 InternalizedAnger ~~ StateAnger 0.869 12.564 12.564
## 96 InternalizedAnger ~~ TraitAnger 0.839 -2.520 -2.520
## 97 InternalizedAnger ~~ ComorbidityIndex 1.166 -2.269 -2.269
## 98 InternalizedAnger ~~ SubjectiveHealth 0.247 1.136 1.136
## 99 InternalizedAnger ~~ FunctioningIndex 1.115 2.022 2.022
## 100 InternalizedAnger ~~ FitnessIndex 4.174 -4.198 -4.198
## 101 ExternalizedAnger ~~ StateAnger 2.634 -4.861 -4.861
## 102 ExternalizedAnger ~~ ComorbidityIndex 0.122 -0.543 -0.543
## 103 ExternalizedAnger ~~ SubjectiveHealth 0.666 1.477 1.477
## 104 ExternalizedAnger ~~ FunctioningIndex 1.691 -1.989 -1.989
## 105 ExternalizedAnger ~~ FitnessIndex 2.243 2.441 2.441
## 106 StateAnger ~~ TraitAnger 0.426 1.061 1.061
## 107 StateAnger ~~ ComorbidityIndex 2.394 2.548 2.548
## 108 StateAnger ~~ SubjectiveHealth 1.570 -2.393 -2.393
## 109 StateAnger ~~ FunctioningIndex 0.017 -0.210 -0.210
## 110 StateAnger ~~ FitnessIndex 1.123 1.821 1.821
## 111 TraitAnger ~~ ComorbidityIndex 0.148 0.668 0.668
## 112 TraitAnger ~~ SubjectiveHealth 0.245 -1.009 -1.009
## 113 TraitAnger ~~ FunctioningIndex 2.031 2.451 2.451
## 114 TraitAnger ~~ FitnessIndex 0.170 0.755 0.755
## 115 ComorbidityIndex ~~ SubjectiveHealth 1.460 -5.393 -5.393
## 116 ComorbidityIndex ~~ FunctioningIndex 4.648 5.631 5.631
## 117 ComorbidityIndex ~~ FitnessIndex 0.517 -2.722 -2.722
## 118 SubjectiveHealth ~~ FunctioningIndex 1.767 -2.880 -2.880
## 119 SubjectiveHealth ~~ FitnessIndex 5.496 6.009 6.009
## 120 FunctioningIndex ~~ FitnessIndex 3.913 -3.827 -3.827
## sepc.all sepc.nox
## 56 -0.685 -0.685
## 57 0.956 0.956
## 58 -0.442 -0.442
## 59 0.338 0.338
## 60 -0.151 -0.151
## 61 -0.119 -0.119
## 62 0.179 0.179
## 63 0.267 0.267
## 64 -0.009 -0.009
## 65 -0.044 -0.044
## 66 -0.049 -0.049
## 67 -0.365 -0.365
## 68 0.536 0.536
## 69 -0.357 -0.357
## 70 0.099 0.099
## 71 0.011 0.011
## 72 -0.076 -0.076
## 73 -0.123 -0.123
## 74 -0.023 -0.023
## 75 -0.008 -0.008
## 76 0.082 0.082
## 77 -0.156 -0.156
## 78 0.380 0.380
## 79 0.003 0.003
## 80 0.003 0.003
## 81 -0.178 -0.178
## 82 -0.071 -0.071
## 83 0.030 0.030
## 84 0.054 0.054
## 85 -0.098 -0.098
## 86 -0.325 -0.325
## 87 0.096 0.096
## 88 0.112 0.112
## 89 -0.048 -0.048
## 90 -0.096 -0.096
## 91 -0.013 -0.013
## 92 0.001 0.001
## 93 0.094 0.094
## 94 0.855 0.855
## 95 1.356 1.356
## 96 -0.220 -0.220
## 97 -0.330 -0.330
## 98 0.098 0.098
## 99 0.202 0.202
## 100 -0.401 -0.401
## 101 -0.225 -0.225
## 102 -0.034 -0.034
## 103 0.055 0.055
## 104 -0.085 -0.085
## 105 0.100 0.100
## 106 0.043 0.043
## 107 0.171 0.171
## 108 -0.095 -0.095
## 109 -0.010 -0.010
## 110 0.080 0.080
## 111 0.036 0.036
## 112 -0.033 -0.033
## 113 0.091 0.091
## 114 0.027 0.027
## 115 -0.289 -0.289
## 116 0.348 0.348
## 117 -0.161 -0.161
## 118 -0.106 -0.106
## 119 0.212 0.212
## 120 -0.156 -0.156
#Rerun of confirmatory model, freeing up Heroin ~~ Cocaine

act.mod3<- ' drugbelief =~ Cannabis + Heroin + RecreationalPrescription + Cocaine
anger =~ InternalizedAnger + ExternalizedAnger + StateAnger + TraitAnger
health =~ ComorbidityIndex + SubjectiveHealth + FunctioningIndex + FitnessIndex
#Correlated uniqueness
ExternalizedAnger ~~ TraitAnger
Heroin ~~ Cocaine'

fit.act3 <- cfa(act.mod3, data=act[2:13])
summary(fit.act3, fit.measures=TRUE, standardized=TRUE)
fitmeasures(fit.act3)
## lavaan 0.6-7 ended normally after 175 iterations
##
## Estimator ML
## Optimization method NLMINB
## Number of free parameters 29
##
## Number of observations 200
##
## Model Test User Model:
##
## Test statistic 55.570
## Degrees of freedom 49
## P-value (Chi-square) 0.241
##
## Model Test Baseline Model:
##
## Test statistic 960.853
## Degrees of freedom 66
## P-value 0.000
##
## User Model versus Baseline Model:
##
## Comparative Fit Index (CFI) 0.993
## Tucker-Lewis Index (TLI) 0.990
##
## Loglikelihood and Information Criteria:
##
## Loglikelihood user model (H0) -7610.508
## Loglikelihood unrestricted model (H1) -7582.723
##
## Akaike (AIC) 15279.015
## Bayesian (BIC) 15374.666
## Sample-size adjusted Bayesian (BIC) 15282.791
##
## Root Mean Square Error of Approximation:
##
## RMSEA 0.026
## 90 Percent confidence interval - lower 0.000
## 90 Percent confidence interval - upper 0.055
## P-value RMSEA <= 0.05 0.909
##
## Standardized Root Mean Square Residual:
##
## SRMR 0.042
##
## Parameter Estimates:
##
## Standard errors Standard
## Information Expected
## Information saturated (h1) model Structured
##
## Latent Variables:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## drugbelief =~
## Cannabis 1.000 9.263 0.943
## Heroin 0.542 0.049 11.062 0.000 5.019 0.743
## RcrtnlPrscrptn 0.573 0.053 10.823 0.000 5.307 0.727
## Cocaine 0.310 0.051 6.123 0.000 2.867 0.441
## anger =~
## InternalzdAngr 1.000 10.275 0.979
## ExternalzdAngr 0.532 0.042 12.716 0.000 5.467 0.750
## StateAnger 0.580 0.042 13.924 0.000 5.955 0.800
## TraitAnger 0.225 0.040 5.600 0.000 2.315 0.386
## health =~
## ComorbidtyIndx 1.000 5.300 0.853
## SubjectiveHlth 0.616 0.117 5.271 0.000 3.267 0.503
## FunctionngIndx 0.330 0.084 3.929 0.000 1.749 0.339
## FitnessIndex 0.526 0.103 5.128 0.000 2.787 0.481
##
## Covariances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .ExternalizedAnger ~~
## .TraitAnger 12.063 2.195 5.496 0.000 12.063 0.452
## .Heroin ~~
## .Cocaine 11.535 2.315 4.982 0.000 11.535 0.437
## drugbelief ~~
## anger -9.454 7.212 -1.311 0.190 -0.099 -0.099
## health 17.077 4.353 3.923 0.000 0.348 0.348
## anger ~~
## health 13.993 4.594 3.046 0.002 0.257 0.257
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .Cannabis 10.619 5.481 1.937 0.053 10.619 0.110
## .Heroin 20.407 2.597 7.857 0.000 20.407 0.448
## .RcrtnlPrscrptn 25.056 3.087 8.116 0.000 25.056 0.471
## .Cocaine 34.140 3.523 9.690 0.000 34.140 0.806
## .InternalzdAngr 4.604 5.010 0.919 0.358 4.604 0.042
## .ExternalzdAngr 23.205 2.723 8.521 0.000 23.205 0.437
## .StateAnger 19.997 2.613 7.652 0.000 19.997 0.361
## .TraitAnger 30.635 3.093 9.906 0.000 30.635 0.851
## .ComorbidtyIndx 10.513 4.219 2.492 0.013 10.513 0.272
## .SubjectiveHlth 31.587 3.623 8.718 0.000 31.587 0.747
## .FunctionngIndx 23.584 2.458 9.595 0.000 23.584 0.885
## .FitnessIndex 25.838 2.905 8.896 0.000 25.838 0.769
## drugbelief 85.800 10.989 7.808 0.000 1.000 1.000
## anger 105.567 12.085 8.735 0.000 1.000 1.000
## health 28.093 5.522 5.087 0.000 1.000 1.000
(mi3 <- modindices(fit.act3))
##                          lhs op                      rhs    mi    epc sepc.lv
## 33 drugbelief =~ InternalizedAnger 0.278 0.027 0.246
## 34 drugbelief =~ ExternalizedAnger 0.018 -0.005 -0.044
## 35 drugbelief =~ StateAnger 0.105 -0.012 -0.112
## 36 drugbelief =~ TraitAnger 0.362 -0.024 -0.221
## 37 drugbelief =~ ComorbidityIndex 0.144 0.025 0.235
## 38 drugbelief =~ SubjectiveHealth 0.041 -0.011 -0.102
## 39 drugbelief =~ FunctioningIndex 0.115 -0.015 -0.137
## 40 drugbelief =~ FitnessIndex 0.005 -0.003 -0.032
## 41 anger =~ Cannabis 0.001 0.001 0.013
## 42 anger =~ Heroin 4.160 -0.062 -0.632
## 43 anger =~ RecreationalPrescription 3.820 0.073 0.752
## 44 anger =~ Cocaine 0.549 0.027 0.282
## 45 anger =~ ComorbidityIndex 0.096 -0.017 -0.170
## 46 anger =~ SubjectiveHealth 0.029 0.008 0.078
## 47 anger =~ FunctioningIndex 0.781 0.032 0.332
## 48 anger =~ FitnessIndex 0.118 -0.014 -0.141
## 49 health =~ Cannabis 0.640 0.095 0.503
## 50 health =~ Heroin 1.000 -0.072 -0.379
## 51 health =~ RecreationalPrescription 0.025 -0.014 -0.075
## 52 health =~ Cocaine 0.271 0.045 0.238
## 53 health =~ InternalizedAnger 2.251 -0.151 -0.800
## 54 health =~ ExternalizedAnger 0.203 0.031 0.166
## 55 health =~ StateAnger 1.708 0.097 0.512
## 56 health =~ TraitAnger 0.175 0.032 0.172
## 57 Cannabis ~~ Heroin 0.463 -3.320 -3.320
## 58 Cannabis ~~ RecreationalPrescription 0.123 3.269 3.269
## 59 Cannabis ~~ Cocaine 0.011 -0.347 -0.347
## 60 Cannabis ~~ InternalizedAnger 1.202 2.612 2.612
## 61 Cannabis ~~ ExternalizedAnger 2.419 -2.866 -2.866
## 62 Cannabis ~~ StateAnger 1.075 -2.016 -2.016
## 63 Cannabis ~~ TraitAnger 5.597 4.896 4.896
## 64 Cannabis ~~ ComorbidityIndex 1.526 2.888 2.888
## 65 Cannabis ~~ SubjectiveHealth 0.088 -0.739 -0.739
## 66 Cannabis ~~ FunctioningIndex 0.396 -1.309 -1.309
## 67 Cannabis ~~ FitnessIndex 0.059 -0.543 -0.543
## 68 Heroin ~~ RecreationalPrescription 0.232 1.275 1.275
## 69 Heroin ~~ InternalizedAnger 1.322 -1.898 -1.898
## 70 Heroin ~~ ExternalizedAnger 0.865 1.226 1.226
## 71 Heroin ~~ StateAnger 0.104 -0.449 -0.449
## 72 Heroin ~~ TraitAnger 1.186 -1.615 -1.615
## 73 Heroin ~~ ComorbidityIndex 0.231 -0.727 -0.727
## 74 Heroin ~~ SubjectiveHealth 0.010 -0.172 -0.172
## 75 Heroin ~~ FunctioningIndex 0.000 0.013 0.013
## 76 Heroin ~~ FitnessIndex 0.304 0.871 0.871
## 77 RecreationalPrescription ~~ Cocaine 0.007 0.166 0.166
## 78 RecreationalPrescription ~~ InternalizedAnger 1.917 2.834 2.834
## 79 RecreationalPrescription ~~ ExternalizedAnger 0.209 0.748 0.748
## 80 RecreationalPrescription ~~ StateAnger 0.102 0.551 0.551
## 81 RecreationalPrescription ~~ TraitAnger 8.981 -5.511 -5.511
## 82 RecreationalPrescription ~~ ComorbidityIndex 0.666 -1.533 -1.533
## 83 RecreationalPrescription ~~ SubjectiveHealth 0.166 0.888 0.888
## 84 RecreationalPrescription ~~ FunctioningIndex 0.593 1.413 1.413
## 85 RecreationalPrescription ~~ FitnessIndex 0.911 -1.871 -1.871
## 86 Cocaine ~~ InternalizedAnger 1.412 -2.418 -2.418
## 87 Cocaine ~~ ExternalizedAnger 0.961 1.598 1.598
## 88 Cocaine ~~ StateAnger 2.103 2.493 2.493
## 89 Cocaine ~~ TraitAnger 0.193 -0.806 -0.806
## 90 Cocaine ~~ ComorbidityIndex 0.068 -0.479 -0.479
## 91 Cocaine ~~ SubjectiveHealth 0.000 -0.019 -0.019
## 92 Cocaine ~~ FunctioningIndex 0.005 0.135 0.135
## 93 Cocaine ~~ FitnessIndex 0.966 1.920 1.920
## 94 InternalizedAnger ~~ ExternalizedAnger 2.495 8.697 8.697
## 95 InternalizedAnger ~~ StateAnger 1.124 14.326 14.326
## 96 InternalizedAnger ~~ TraitAnger 0.729 -2.345 -2.345
## 97 InternalizedAnger ~~ ComorbidityIndex 1.383 -2.467 -2.467
## 98 InternalizedAnger ~~ SubjectiveHealth 0.242 1.128 1.128
## 99 InternalizedAnger ~~ FunctioningIndex 1.084 1.996 1.996
## 100 InternalizedAnger ~~ FitnessIndex 4.172 -4.207 -4.207
## 101 ExternalizedAnger ~~ StateAnger 3.117 -5.303 -5.303
## 102 ExternalizedAnger ~~ ComorbidityIndex 0.072 -0.414 -0.414
## 103 ExternalizedAnger ~~ SubjectiveHealth 0.720 1.537 1.537
## 104 ExternalizedAnger ~~ FunctioningIndex 1.642 -1.958 -1.958
## 105 ExternalizedAnger ~~ FitnessIndex 2.290 2.468 2.468
## 106 StateAnger ~~ TraitAnger 0.439 1.077 1.077
## 107 StateAnger ~~ ComorbidityIndex 2.584 2.635 2.635
## 108 StateAnger ~~ SubjectiveHealth 1.532 -2.364 -2.364
## 109 StateAnger ~~ FunctioningIndex 0.016 -0.201 -0.201
## 110 StateAnger ~~ FitnessIndex 1.112 1.814 1.814
## 111 TraitAnger ~~ ComorbidityIndex 0.081 0.492 0.492
## 112 TraitAnger ~~ SubjectiveHealth 0.269 -1.056 -1.056
## 113 TraitAnger ~~ FunctioningIndex 1.981 2.420 2.420
## 114 TraitAnger ~~ FitnessIndex 0.149 0.709 0.709
## 115 ComorbidityIndex ~~ SubjectiveHealth 1.719 -5.845 -5.845
## 116 ComorbidityIndex ~~ FunctioningIndex 4.409 5.520 5.520
## 117 ComorbidityIndex ~~ FitnessIndex 0.488 -2.633 -2.633
## 118 SubjectiveHealth ~~ FunctioningIndex 1.644 -2.772 -2.772
## 119 SubjectiveHealth ~~ FitnessIndex 5.832 6.132 6.132
## 120 FunctioningIndex ~~ FitnessIndex 3.686 -3.708 -3.708
## sepc.all sepc.nox
## 33 0.023 0.023
## 34 -0.006 -0.006
## 35 -0.015 -0.015
## 36 -0.037 -0.037
## 37 0.038 0.038
## 38 -0.016 -0.016
## 39 -0.027 -0.027
## 40 -0.005 -0.005
## 41 0.001 0.001
## 42 -0.094 -0.094
## 43 0.103 0.103
## 44 0.043 0.043
## 45 -0.027 -0.027
## 46 0.012 0.012
## 47 0.064 0.064
## 48 -0.024 -0.024
## 49 0.051 0.051
## 50 -0.056 -0.056
## 51 -0.010 -0.010
## 52 0.037 0.037
## 53 -0.076 -0.076
## 54 0.023 0.023
## 55 0.069 0.069
## 56 0.029 0.029
## 57 -0.226 -0.226
## 58 0.200 0.200
## 59 -0.018 -0.018
## 60 0.374 0.374
## 61 -0.183 -0.183
## 62 -0.138 -0.138
## 63 0.271 0.271
## 64 0.273 0.273
## 65 -0.040 -0.040
## 66 -0.083 -0.083
## 67 -0.033 -0.033
## 68 0.056 0.056
## 69 -0.196 -0.196
## 70 0.056 0.056
## 71 -0.022 -0.022
## 72 -0.065 -0.065
## 73 -0.050 -0.050
## 74 -0.007 -0.007
## 75 0.001 0.001
## 76 0.038 0.038
## 77 0.006 0.006
## 78 0.264 0.264
## 79 0.031 0.031
## 80 0.025 0.025
## 81 -0.199 -0.199
## 82 -0.094 -0.094
## 83 0.032 0.032
## 84 0.058 0.058
## 85 -0.074 -0.074
## 86 -0.193 -0.193
## 87 0.057 0.057
## 88 0.095 0.095
## 89 -0.025 -0.025
## 90 -0.025 -0.025
## 91 -0.001 -0.001
## 92 0.005 0.005
## 93 0.065 0.065
## 94 0.841 0.841
## 95 1.493 1.493
## 96 -0.197 -0.197
## 97 -0.355 -0.355
## 98 0.094 0.094
## 99 0.192 0.192
## 100 -0.386 -0.386
## 101 -0.246 -0.246
## 102 -0.026 -0.026
## 103 0.057 0.057
## 104 -0.084 -0.084
## 105 0.101 0.101
## 106 0.044 0.044
## 107 0.182 0.182
## 108 -0.094 -0.094
## 109 -0.009 -0.009
## 110 0.080 0.080
## 111 0.027 0.027
## 112 -0.034 -0.034
## 113 0.090 0.090
## 114 0.025 0.025
## 115 -0.321 -0.321
## 116 0.351 0.351
## 117 -0.160 -0.160
## 118 -0.102 -0.102
## 119 0.215 0.215
## 120 -0.150 -0.150
#To filter to only get MIs for correlated uniquenesses
mi3[mi3$op == "~~",]
##                          lhs op                      rhs    mi    epc sepc.lv
## 57 Cannabis ~~ Heroin 0.463 -3.320 -3.320
## 58 Cannabis ~~ RecreationalPrescription 0.123 3.269 3.269
## 59 Cannabis ~~ Cocaine 0.011 -0.347 -0.347
## 60 Cannabis ~~ InternalizedAnger 1.202 2.612 2.612
## 61 Cannabis ~~ ExternalizedAnger 2.419 -2.866 -2.866
## 62 Cannabis ~~ StateAnger 1.075 -2.016 -2.016
## 63 Cannabis ~~ TraitAnger 5.597 4.896 4.896
## 64 Cannabis ~~ ComorbidityIndex 1.526 2.888 2.888
## 65 Cannabis ~~ SubjectiveHealth 0.088 -0.739 -0.739
## 66 Cannabis ~~ FunctioningIndex 0.396 -1.309 -1.309
## 67 Cannabis ~~ FitnessIndex 0.059 -0.543 -0.543
## 68 Heroin ~~ RecreationalPrescription 0.232 1.275 1.275
## 69 Heroin ~~ InternalizedAnger 1.322 -1.898 -1.898
## 70 Heroin ~~ ExternalizedAnger 0.865 1.226 1.226
## 71 Heroin ~~ StateAnger 0.104 -0.449 -0.449
## 72 Heroin ~~ TraitAnger 1.186 -1.615 -1.615
## 73 Heroin ~~ ComorbidityIndex 0.231 -0.727 -0.727
## 74 Heroin ~~ SubjectiveHealth 0.010 -0.172 -0.172
## 75 Heroin ~~ FunctioningIndex 0.000 0.013 0.013
## 76 Heroin ~~ FitnessIndex 0.304 0.871 0.871
## 77 RecreationalPrescription ~~ Cocaine 0.007 0.166 0.166
## 78 RecreationalPrescription ~~ InternalizedAnger 1.917 2.834 2.834
## 79 RecreationalPrescription ~~ ExternalizedAnger 0.209 0.748 0.748
## 80 RecreationalPrescription ~~ StateAnger 0.102 0.551 0.551
## 81 RecreationalPrescription ~~ TraitAnger 8.981 -5.511 -5.511
## 82 RecreationalPrescription ~~ ComorbidityIndex 0.666 -1.533 -1.533
## 83 RecreationalPrescription ~~ SubjectiveHealth 0.166 0.888 0.888
## 84 RecreationalPrescription ~~ FunctioningIndex 0.593 1.413 1.413
## 85 RecreationalPrescription ~~ FitnessIndex 0.911 -1.871 -1.871
## 86 Cocaine ~~ InternalizedAnger 1.412 -2.418 -2.418
## 87 Cocaine ~~ ExternalizedAnger 0.961 1.598 1.598
## 88 Cocaine ~~ StateAnger 2.103 2.493 2.493
## 89 Cocaine ~~ TraitAnger 0.193 -0.806 -0.806
## 90 Cocaine ~~ ComorbidityIndex 0.068 -0.479 -0.479
## 91 Cocaine ~~ SubjectiveHealth 0.000 -0.019 -0.019
## 92 Cocaine ~~ FunctioningIndex 0.005 0.135 0.135
## 93 Cocaine ~~ FitnessIndex 0.966 1.920 1.920
## 94 InternalizedAnger ~~ ExternalizedAnger 2.495 8.697 8.697
## 95 InternalizedAnger ~~ StateAnger 1.124 14.326 14.326
## 96 InternalizedAnger ~~ TraitAnger 0.729 -2.345 -2.345
## 97 InternalizedAnger ~~ ComorbidityIndex 1.383 -2.467 -2.467
## 98 InternalizedAnger ~~ SubjectiveHealth 0.242 1.128 1.128
## 99 InternalizedAnger ~~ FunctioningIndex 1.084 1.996 1.996
## 100 InternalizedAnger ~~ FitnessIndex 4.172 -4.207 -4.207
## 101 ExternalizedAnger ~~ StateAnger 3.117 -5.303 -5.303
## 102 ExternalizedAnger ~~ ComorbidityIndex 0.072 -0.414 -0.414
## 103 ExternalizedAnger ~~ SubjectiveHealth 0.720 1.537 1.537
## 104 ExternalizedAnger ~~ FunctioningIndex 1.642 -1.958 -1.958
## 105 ExternalizedAnger ~~ FitnessIndex 2.290 2.468 2.468
## 106 StateAnger ~~ TraitAnger 0.439 1.077 1.077
## 107 StateAnger ~~ ComorbidityIndex 2.584 2.635 2.635
## 108 StateAnger ~~ SubjectiveHealth 1.532 -2.364 -2.364
## 109 StateAnger ~~ FunctioningIndex 0.016 -0.201 -0.201
## 110 StateAnger ~~ FitnessIndex 1.112 1.814 1.814
## 111 TraitAnger ~~ ComorbidityIndex 0.081 0.492 0.492
## 112 TraitAnger ~~ SubjectiveHealth 0.269 -1.056 -1.056
## 113 TraitAnger ~~ FunctioningIndex 1.981 2.420 2.420
## 114 TraitAnger ~~ FitnessIndex 0.149 0.709 0.709
## 115 ComorbidityIndex ~~ SubjectiveHealth 1.719 -5.845 -5.845
## 116 ComorbidityIndex ~~ FunctioningIndex 4.409 5.520 5.520
## 117 ComorbidityIndex ~~ FitnessIndex 0.488 -2.633 -2.633
## 118 SubjectiveHealth ~~ FunctioningIndex 1.644 -2.772 -2.772
## 119 SubjectiveHealth ~~ FitnessIndex 5.832 6.132 6.132
## 120 FunctioningIndex ~~ FitnessIndex 3.686 -3.708 -3.708
## sepc.all sepc.nox
## 57 -0.226 -0.226
## 58 0.200 0.200
## 59 -0.018 -0.018
## 60 0.374 0.374
## 61 -0.183 -0.183
## 62 -0.138 -0.138
## 63 0.271 0.271
## 64 0.273 0.273
## 65 -0.040 -0.040
## 66 -0.083 -0.083
## 67 -0.033 -0.033
## 68 0.056 0.056
## 69 -0.196 -0.196
## 70 0.056 0.056
## 71 -0.022 -0.022
## 72 -0.065 -0.065
## 73 -0.050 -0.050
## 74 -0.007 -0.007
## 75 0.001 0.001
## 76 0.038 0.038
## 77 0.006 0.006
## 78 0.264 0.264
## 79 0.031 0.031
## 80 0.025 0.025
## 81 -0.199 -0.199
## 82 -0.094 -0.094
## 83 0.032 0.032
## 84 0.058 0.058
## 85 -0.074 -0.074
## 86 -0.193 -0.193
## 87 0.057 0.057
## 88 0.095 0.095
## 89 -0.025 -0.025
## 90 -0.025 -0.025
## 91 -0.001 -0.001
## 92 0.005 0.005
## 93 0.065 0.065
## 94 0.841 0.841
## 95 1.493 1.493
## 96 -0.197 -0.197
## 97 -0.355 -0.355
## 98 0.094 0.094
## 99 0.192 0.192
## 100 -0.386 -0.386
## 101 -0.246 -0.246
## 102 -0.026 -0.026
## 103 0.057 0.057
## 104 -0.084 -0.084
## 105 0.101 0.101
## 106 0.044 0.044
## 107 0.182 0.182
## 108 -0.094 -0.094
## 109 -0.009 -0.009
## 110 0.080 0.080
## 111 0.027 0.027
## 112 -0.034 -0.034
## 113 0.090 0.090
## 114 0.025 0.025
## 115 -0.321 -0.321
## 116 0.351 0.351
## 117 -0.160 -0.160
## 118 -0.102 -0.102
## 119 0.215 0.215
## 120 -0.150 -0.150
anova(fit.act,fit.act2,fit.act3)
## Chi-Squared Difference Test
##
## Df AIC BIC Chisq Chisq diff Df diff Pr(>Chisq)
## fit.act3 49 15279 15375 55.570
## fit.act2 50 15310 15402 88.112 32.542 1 1.166e-08 ***
## fit.act 51 15348 15437 128.888 40.776 1 1.707e-10 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

#install.packages("lavaanPlot")
library(lavaanPlot)
## Warning: package 'lavaanPlot' was built under R version 4.0.3
lavaanPlot(model = fit.act3, sig=.05,stars=c("regress","latent","covs"),
node_options = list(shape = "box", fontname = "Arial"),
edge_options = list(color = "black"),
coefs = TRUE, covs = TRUE, stand=TRUE)