Dissertation Analyses

load(file="/Users/meganwilliams/Desktop/Dissertation/StroopMixed.rdata")
load(file="/Users/meganwilliams/Desktop/Dissertation/Allvars.rdata")
library(effects)
library(interactions)
library(rcompanion)
library(car)

Trail Making Test Part A - Psychological Aggression

Model 1

options(scipen = 999)
TMTAlog1 <- glm(PsychAggress ~ TrailsA + WRATtotal, data=Allvars,family = "binomial")
summary(TMTAlog1)
## 
## Call:
## glm(formula = PsychAggress ~ TrailsA + WRATtotal, family = "binomial", 
##     data = Allvars)
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -2.1303   0.4823   0.5085   0.5449   1.0981  
## 
## Coefficients:
##              Estimate Std. Error z value Pr(>|z|)  
## (Intercept)  1.335665   0.655826   2.037   0.0417 *
## TrailsA     -0.006319   0.002737  -2.309   0.0209 *
## WRATtotal    0.017840   0.014644   1.218   0.2231  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 505.40  on 640  degrees of freedom
## Residual deviance: 498.57  on 638  degrees of freedom
## AIC: 504.57
## 
## Number of Fisher Scoring iterations: 4
confint(TMTAlog1)
##                   2.5 %        97.5 %
## (Intercept)  0.08059980  2.6610057816
## TrailsA     -0.01174768 -0.0006371154
## WRATtotal   -0.01143901  0.0461535852
exp(cbind(OR = coef(TMTAlog1), confint(TMTAlog1)))
##                    OR     2.5 %     97.5 %
## (Intercept) 3.8025243 1.0839370 14.3106753
## TrailsA     0.9937012 0.9883211  0.9993631
## WRATtotal   1.0179999 0.9886262  1.0472352
plot(predictorEffect("TrailsA",TMTAlog1))

#Wald chi-square Test
Anova(TMTAlog1, type="II", test="Wald")
## Analysis of Deviance Table (Type II tests)
## 
## Response: PsychAggress
##           Df  Chisq Pr(>Chisq)  
## TrailsA    1 5.3315    0.02094 *
## WRATtotal  1 1.4840    0.22315  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
########Compare to null model 
#Difference in Deviance
with(TMTAlog1,null.deviance - deviance)
## [1] 6.831695
#Degrees of freedom for the difference between two models
with(TMTAlog1,df.null - df.residual)
## [1] 2
#p-value
with(TMTAlog1,pchisq(null.deviance-deviance,df.null-df.residual,lower.tail=FALSE))
## [1] 0.03284855
#Pseudo R-Squared
nagelkerke(TMTAlog1)
## $Models
##                                                                    
## Model: "glm, PsychAggress ~ TrailsA + WRATtotal, binomial, Allvars"
## Null:  "glm, PsychAggress ~ 1, binomial, Allvars"                  
## 
## $Pseudo.R.squared.for.model.vs.null
##                              Pseudo.R.squared
## McFadden                            0.0135174
## Cox and Snell (ML)                  0.0106013
## Nagelkerke (Cragg and Uhler)        0.0194357
## 
## $Likelihood.ratio.test
##  Df.diff LogLik.diff  Chisq  p.value
##       -2     -3.4158 6.8317 0.032849
## 
## $Number.of.observations
##           
## Model: 641
## Null:  641
## 
## $Messages
## [1] "Note: For models fit with REML, these statistics are based on refitting with ML"
## 
## $Warnings
## [1] "None"

Model 3

options(scipen = 999)
TMTAlog3 <- glm(PsychAggress ~ (TrailsA + Sex + PovStat)^3 + Age + WRATtotal, data = Allvars, family = "binomial")
summary(TMTAlog3)
## 
## Call:
## glm(formula = PsychAggress ~ (TrailsA + Sex + PovStat)^3 + Age + 
##     WRATtotal, family = "binomial", data = Allvars)
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -2.3050   0.4145   0.4876   0.5662   0.9371  
## 
## Coefficients:
##                               Estimate Std. Error z value Pr(>|z|)  
## (Intercept)                  2.3232837  0.9521720   2.440   0.0147 *
## TrailsA                     -0.0046246  0.0044733  -1.034   0.3012  
## SexMen                      -0.5352512  0.3757272  -1.425   0.1543  
## PovStatBelow                -0.3211181  0.9165205  -0.350   0.7261  
## Age                         -0.0211628  0.0133563  -1.584   0.1131  
## WRATtotal                    0.0213502  0.0147965   1.443   0.1490  
## TrailsA:SexMen               0.0002853  0.0061339   0.047   0.9629  
## TrailsA:PovStatBelow         0.0121948  0.0262325   0.465   0.6420  
## SexMen:PovStatBelow          1.1973680  1.0734939   1.115   0.2647  
## TrailsA:SexMen:PovStatBelow -0.0212556  0.0279137  -0.761   0.4464  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 505.40  on 640  degrees of freedom
## Residual deviance: 489.18  on 631  degrees of freedom
## AIC: 509.18
## 
## Number of Fisher Scoring iterations: 5
confint(TMTAlog3)
##                                    2.5 %      97.5 %
## (Intercept)                  0.481332779 4.221863340
## TrailsA                     -0.013299827 0.005857359
## SexMen                      -1.282198611 0.200258901
## PovStatBelow                -2.259676235 1.362523862
## Age                         -0.047546389 0.004928338
## WRATtotal                   -0.008162031 0.050025754
## TrailsA:SexMen              -0.012576295 0.012711360
## TrailsA:PovStatBelow        -0.030481680 0.074099544
## SexMen:PovStatBelow         -0.795772727 3.446700474
## TrailsA:SexMen:PovStatBelow -0.085997696 0.025273803
exp(cbind(OR = coef(TMTAlog3), confint(TMTAlog3)))
##                                     OR     2.5 %    97.5 %
## (Intercept)                 10.2091427 1.6182297 68.160372
## TrailsA                      0.9953861 0.9867882  1.005875
## SexMen                       0.5855222 0.2774267  1.221719
## PovStatBelow                 0.7253376 0.1043843  3.906039
## Age                          0.9790596 0.9535662  1.004941
## WRATtotal                    1.0215797 0.9918712  1.051298
## TrailsA:SexMen               1.0002853 0.9875025  1.012792
## TrailsA:PovStatBelow         1.0122695 0.9699782  1.076914
## SexMen:PovStatBelow          3.3113900 0.4512324 31.396627
## TrailsA:SexMen:PovStatBelow  0.9789687 0.9175963  1.025596
Anova(TMTAlog3, type="II", test="Wald")
## Analysis of Deviance Table (Type II tests)
## 
## Response: PsychAggress
##                     Df  Chisq Pr(>Chisq)  
## TrailsA              1 3.4814    0.06206 .
## Sex                  1 2.6939    0.10073  
## PovStat              1 1.0180    0.31299  
## Age                  1 2.5106    0.11309  
## WRATtotal            1 2.0820    0.14904  
## TrailsA:Sex          1 0.0137    0.90666  
## TrailsA:PovStat      1 0.5539    0.45673  
## Sex:PovStat          1 0.8076    0.36884  
## TrailsA:Sex:PovStat  1 0.5798    0.44637  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
########Compare to null model 
#Difference in Deviance
with(TMTAlog3,null.deviance - deviance)
## [1] 16.21973
#Degrees of freedom for the difference between two models
with(TMTAlog3,df.null - df.residual)
## [1] 9
#p-value
with(TMTAlog3,pchisq(null.deviance-deviance,df.null-df.residual,lower.tail=FALSE))
## [1] 0.06243246
#Pseudo R-Squared
nagelkerke(TMTAlog3)
## $Models
##                                                                                              
## Model: "glm, PsychAggress ~ (TrailsA + Sex + PovStat)^3 + Age + WRATtotal, binomial, Allvars"
## Null:  "glm, PsychAggress ~ 1, binomial, Allvars"                                            
## 
## $Pseudo.R.squared.for.model.vs.null
##                              Pseudo.R.squared
## McFadden                            0.0320928
## Cox and Snell (ML)                  0.0249863
## Nagelkerke (Cragg and Uhler)        0.0458083
## 
## $Likelihood.ratio.test
##  Df.diff LogLik.diff Chisq  p.value
##       -9     -8.1099 16.22 0.062432
## 
## $Number.of.observations
##           
## Model: 641
## Null:  641
## 
## $Messages
## [1] "Note: For models fit with REML, these statistics are based on refitting with ML"
## 
## $Warnings
## [1] "None"

Compare Models 1 & 3

anova(TMTAlog1,TMTAlog3,test = "LR")
## Analysis of Deviance Table
## 
## Model 1: PsychAggress ~ TrailsA + WRATtotal
## Model 2: PsychAggress ~ (TrailsA + Sex + PovStat)^3 + Age + WRATtotal
##   Resid. Df Resid. Dev Df Deviance Pr(>Chi)
## 1       638     498.57                     
## 2       631     489.18  7    9.388    0.226

Trail Making Test Part A - Physical Assault

Model 1

options(scipen = 999)
TMTAlog1 <- glm(PhysAssault ~ TrailsA + WRATtotal, data=Allvars,family = "binomial")
summary(TMTAlog1)
## 
## Call:
## glm(formula = PhysAssault ~ TrailsA + WRATtotal, family = "binomial", 
##     data = Allvars)
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -0.5836  -0.5414  -0.5166  -0.4765   2.2735  
## 
## Coefficients:
##              Estimate Std. Error z value Pr(>|z|)  
## (Intercept) -1.982492   0.861673  -2.301   0.0214 *
## TrailsA     -0.009439   0.008155  -1.157   0.2471  
## WRATtotal    0.007887   0.017005   0.464   0.6428  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 482.53  on 640  degrees of freedom
## Residual deviance: 479.65  on 638  degrees of freedom
## AIC: 485.65
## 
## Number of Fisher Scoring iterations: 6
exp(cbind(OR = coef(TMTAlog1), confint(TMTAlog1)))
##                    OR      2.5 %    97.5 %
## (Intercept) 0.1377256 0.02554227 0.7641915
## TrailsA     0.9906055 0.97159815 1.0021088
## WRATtotal   1.0079181 0.97537269 1.0428449
Anova(TMTAlog1, type="II", test="Wald")
## Analysis of Deviance Table (Type II tests)
## 
## Response: PhysAssault
##           Df  Chisq Pr(>Chisq)
## TrailsA    1 1.3396     0.2471
## WRATtotal  1 0.2151     0.6428
########Compare to null model 
#Difference in Deviance
with(TMTAlog1,null.deviance - deviance)
## [1] 2.881826
#Degrees of freedom for the difference between two models
with(TMTAlog1,df.null - df.residual)
## [1] 2
#p-value
with(TMTAlog1,pchisq(null.deviance-deviance,df.null-df.residual,lower.tail=FALSE))
## [1] 0.2367116
#Pseudo R-Squared
nagelkerke(TMTAlog1)
## $Models
##                                                                   
## Model: "glm, PhysAssault ~ TrailsA + WRATtotal, binomial, Allvars"
## Null:  "glm, PhysAssault ~ 1, binomial, Allvars"                  
## 
## $Pseudo.R.squared.for.model.vs.null
##                              Pseudo.R.squared
## McFadden                           0.00597229
## Cox and Snell (ML)                 0.00448574
## Nagelkerke (Cragg and Uhler)       0.00848053
## 
## $Likelihood.ratio.test
##  Df.diff LogLik.diff  Chisq p.value
##       -2     -1.4409 2.8818 0.23671
## 
## $Number.of.observations
##           
## Model: 641
## Null:  641
## 
## $Messages
## [1] "Note: For models fit with REML, these statistics are based on refitting with ML"
## 
## $Warnings
## [1] "None"

Model 3

options(scipen = 999)
TMTAlog3 <- glm(PhysAssault ~ (TrailsA + Sex + PovStat)^3 + Age + WRATtotal, data = Allvars, family = "binomial")
summary(TMTAlog3)
## 
## Call:
## glm(formula = PhysAssault ~ (TrailsA + Sex + PovStat)^3 + Age + 
##     WRATtotal, family = "binomial", data = Allvars)
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -0.9896  -0.5444  -0.4687  -0.3914   2.4456  
## 
## Coefficients:
##                                Estimate  Std. Error z value Pr(>|z|)  
## (Intercept)                 -1.36348112  1.05751855  -1.289   0.1973  
## TrailsA                      0.00007282  0.00727697   0.010   0.9920  
## SexMen                       0.07629996  0.57331921   0.133   0.8941  
## PovStatBelow                 1.66166783  0.89445973   1.858   0.0632 .
## Age                         -0.02951309  0.01411907  -2.090   0.0366 *
## WRATtotal                    0.01521473  0.01744790   0.872   0.3832  
## TrailsA:SexMen              -0.00802885  0.01525606  -0.526   0.5987  
## TrailsA:PovStatBelow        -0.04104160  0.02947504  -1.392   0.1638  
## SexMen:PovStatBelow         -1.19151471  1.15924755  -1.028   0.3040  
## TrailsA:SexMen:PovStatBelow  0.04371608  0.03509486   1.246   0.2129  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 482.53  on 640  degrees of freedom
## Residual deviance: 466.00  on 631  degrees of freedom
## AIC: 486
## 
## Number of Fisher Scoring iterations: 6
confint(TMTAlog3)
## Waiting for profiling to be done...
##                                    2.5 %       97.5 %
## (Intercept)                 -3.466733133  0.698550735
## TrailsA                     -0.022462644  0.010741157
## SexMen                      -0.973440421  1.399852489
## PovStatBelow                 0.006201422  3.512932999
## Age                         -0.057593946 -0.002109772
## WRATtotal                   -0.018221155  0.050392858
## TrailsA:SexMen              -0.048493721  0.019944784
## TrailsA:PovStatBelow        -0.105757832  0.010049154
## SexMen:PovStatBelow         -3.556398613  1.153705945
## TrailsA:SexMen:PovStatBelow -0.024980614  0.119436934
exp(cbind(OR = coef(TMTAlog3), confint(TMTAlog3)))
## Waiting for profiling to be done...
##                                    OR      2.5 %     97.5 %
## (Intercept)                 0.2557689 0.03121885  2.0108364
## TrailsA                     1.0000728 0.97778776  1.0107991
## SexMen                      1.0792863 0.37778107  4.0546018
## PovStatBelow                5.2680898 1.00622069 33.5465155
## Age                         0.9709182 0.94403320  0.9978925
## WRATtotal                   1.0153311 0.98194385  1.0516842
## TrailsA:SexMen              0.9920033 0.95266332  1.0201450
## TrailsA:PovStatBelow        0.9597892 0.89964249  1.0100998
## SexMen:PovStatBelow         0.3037608 0.02854143  3.1699187
## TrailsA:SexMen:PovStatBelow 1.0446857 0.97532882  1.1268622
Anova(TMTAlog3, type="II", test="Wald")
## Analysis of Deviance Table (Type II tests)
## 
## Response: PhysAssault
##                     Df  Chisq Pr(>Chisq)  
## TrailsA              1 0.4071    0.52342  
## Sex                  1 0.2931    0.58823  
## PovStat              1 4.2643    0.03892 *
## Age                  1 4.3694    0.03659 *
## WRATtotal            1 0.7604    0.38320  
## TrailsA:Sex          1 0.0004    0.98470  
## TrailsA:PovStat      1 0.4051    0.52446  
## Sex:PovStat          1 0.0421    0.83736  
## TrailsA:Sex:PovStat  1 1.5517    0.21289  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
########Compare to null model 
#Difference in Deviance
with(TMTAlog3,null.deviance - deviance)
## [1] 16.52871
#Degrees of freedom for the difference between two models
with(TMTAlog3,df.null - df.residual)
## [1] 9
#p-value
with(TMTAlog3,pchisq(null.deviance-deviance,df.null-df.residual,lower.tail=FALSE))
## [1] 0.05662862
#Pseudo R-Squared
nagelkerke(TMTAlog3)
## $Models
##                                                                                             
## Model: "glm, PhysAssault ~ (TrailsA + Sex + PovStat)^3 + Age + WRATtotal, binomial, Allvars"
## Null:  "glm, PhysAssault ~ 1, binomial, Allvars"                                            
## 
## $Pseudo.R.squared.for.model.vs.null
##                              Pseudo.R.squared
## McFadden                            0.0342541
## Cox and Snell (ML)                  0.0254562
## Nagelkerke (Cragg and Uhler)        0.0481263
## 
## $Likelihood.ratio.test
##  Df.diff LogLik.diff  Chisq  p.value
##       -9     -8.2644 16.529 0.056629
## 
## $Number.of.observations
##           
## Model: 641
## Null:  641
## 
## $Messages
## [1] "Note: For models fit with REML, these statistics are based on refitting with ML"
## 
## $Warnings
## [1] "None"

Compare Models 1 & 3

anova(TMTAlog1,TMTAlog3,test = "LR")
## Analysis of Deviance Table
## 
## Model 1: PhysAssault ~ TrailsA + WRATtotal
## Model 2: PhysAssault ~ (TrailsA + Sex + PovStat)^3 + Age + WRATtotal
##   Resid. Df Resid. Dev Df Deviance Pr(>Chi)  
## 1       638     479.65                       
## 2       631     466.00  7   13.647  0.05783 .
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Trail Making Test Part B - Psychological Aggression

Model 1

options(scipen = 999)
TMTBlog1 <- glm(PsychAggress ~ TrailsB + WRATtotal, data=Allvars,family = "binomial")
summary(TMTBlog1)
## 
## Call:
## glm(formula = PsychAggress ~ TrailsB + WRATtotal, family = "binomial", 
##     data = Allvars)
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -2.1102   0.4895   0.5148   0.5478   0.7594  
## 
## Coefficients:
##              Estimate Std. Error z value Pr(>|z|)
## (Intercept)  1.339399   0.816391   1.641    0.101
## TrailsB     -0.001334   0.001663  -0.802    0.422
## WRATtotal    0.015670   0.016401   0.955    0.339
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 505.4  on 640  degrees of freedom
## Residual deviance: 502.6  on 638  degrees of freedom
## AIC: 508.6
## 
## Number of Fisher Scoring iterations: 4
confint(TMTBlog1)
##                    2.5 %      97.5 %
## (Intercept) -0.240037089 2.968605536
## TrailsB     -0.004508184 0.002034085
## WRATtotal   -0.016915484 0.047550012
exp(cbind(OR = coef(TMTBlog1), confint(TMTBlog1)))
##                    OR     2.5 %    97.5 %
## (Intercept) 3.8167494 0.7865987 19.464758
## TrailsB     0.9986672 0.9955020  1.002036
## WRATtotal   1.0157937 0.9832268  1.048699
Anova(TMTBlog1, type="II", test="Wald")
## Analysis of Deviance Table (Type II tests)
## 
## Response: PsychAggress
##           Df  Chisq Pr(>Chisq)
## TrailsB    1 0.6435     0.4224
## WRATtotal  1 0.9129     0.3394
########Compare to null model 
#Difference in Deviance
with(TMTBlog1,null.deviance - deviance)
## [1] 2.79723
#Degrees of freedom for the difference between two models
with(TMTBlog1,df.null - df.residual)
## [1] 2
#p-value
with(TMTBlog1,pchisq(null.deviance-deviance,df.null-df.residual,lower.tail=FALSE))
## [1] 0.2469387
#Pseudo R-Squared
nagelkerke(TMTBlog1)
## $Models
##                                                                    
## Model: "glm, PsychAggress ~ TrailsB + WRATtotal, binomial, Allvars"
## Null:  "glm, PsychAggress ~ 1, binomial, Allvars"                  
## 
## $Pseudo.R.squared.for.model.vs.null
##                              Pseudo.R.squared
## McFadden                           0.00553467
## Cox and Snell (ML)                 0.00435435
## Nagelkerke (Cragg and Uhler)       0.00798297
## 
## $Likelihood.ratio.test
##  Df.diff LogLik.diff  Chisq p.value
##       -2     -1.3986 2.7972 0.24694
## 
## $Number.of.observations
##           
## Model: 641
## Null:  641
## 
## $Messages
## [1] "Note: For models fit with REML, these statistics are based on refitting with ML"
## 
## $Warnings
## [1] "None"

Model 3

options(scipen = 999)
TMTBlog3 <- glm(PsychAggress ~ (TrailsB + Sex + PovStat)^3 + Age + WRATtotal, data = Allvars, family = "binomial")
summary(TMTBlog3)
## 
## Call:
## glm(formula = PsychAggress ~ (TrailsB + Sex + PovStat)^3 + Age + 
##     WRATtotal, family = "binomial", data = Allvars)
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -2.3166   0.4161   0.4923   0.5692   0.9530  
## 
## Coefficients:
##                                Estimate  Std. Error z value Pr(>|z|)  
## (Intercept)                  2.11869216  1.06981158   1.980   0.0477 *
## TrailsB                      0.00006311  0.00289151   0.022   0.9826  
## SexMen                      -0.28635201  0.49006156  -0.584   0.5590  
## PovStatBelow                 0.27642697  0.71307763   0.388   0.6983  
## Age                         -0.02183121  0.01355727  -1.610   0.1073  
## WRATtotal                    0.02252136  0.01718596   1.310   0.1900  
## TrailsB:SexMen              -0.00202431  0.00347289  -0.583   0.5600  
## TrailsB:PovStatBelow        -0.00157107  0.00516673  -0.304   0.7611  
## SexMen:PovStatBelow         -0.88586893  1.02357774  -0.865   0.3868  
## TrailsB:SexMen:PovStatBelow  0.01099893  0.00806233   1.364   0.1725  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 505.40  on 640  degrees of freedom
## Residual deviance: 490.99  on 631  degrees of freedom
## AIC: 510.99
## 
## Number of Fisher Scoring iterations: 5
confint(TMTBlog3)
##                                    2.5 %      97.5 %
## (Intercept)                  0.040995977 4.243386118
## TrailsB                     -0.005314178 0.006180063
## SexMen                      -1.257432994 0.671448445
## PovStatBelow                -1.102935668 1.720782202
## Age                         -0.048621607 0.004639968
## WRATtotal                   -0.011510819 0.056032243
## TrailsB:SexMen              -0.009085005 0.004661670
## TrailsB:PovStatBelow        -0.011454410 0.009293020
## SexMen:PovStatBelow         -2.939374247 1.102186380
## TrailsB:SexMen:PovStatBelow -0.004275290 0.028250524
exp(cbind(OR = coef(TMTBlog3), confint(TMTBlog3)))
##                                    OR      2.5 %    97.5 %
## (Intercept)                 8.3202488 1.04184791 69.643273
## TrailsB                     1.0000631 0.99469992  1.006199
## SexMen                      0.7509982 0.28438310  1.957070
## PovStatBelow                1.3184107 0.33189532  5.588898
## Age                         0.9784054 0.95254150  1.004651
## WRATtotal                   1.0227769 0.98855518  1.057632
## TrailsB:SexMen              0.9979777 0.99095614  1.004673
## TrailsB:PovStatBelow        0.9984302 0.98861094  1.009336
## SexMen:PovStatBelow         0.4123557 0.05289882  3.010741
## TrailsB:SexMen:PovStatBelow 1.0110596 0.99573384  1.028653
Anova(TMTBlog3, type="II", test="Wald")
## Analysis of Deviance Table (Type II tests)
## 
## Response: PsychAggress
##                     Df  Chisq Pr(>Chisq)  
## TrailsB              1 0.1338    0.71456  
## Sex                  1 3.3623    0.06671 .
## PovStat              1 0.7220    0.39548  
## Age                  1 2.5931    0.10733  
## WRATtotal            1 1.7173    0.19004  
## TrailsB:Sex          1 0.0000    0.99872  
## TrailsB:PovStat      1 0.5469    0.45960  
## Sex:PovStat          1 0.3112    0.57692  
## TrailsB:Sex:PovStat  1 1.8611    0.17249  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
########Compare to null model 
#Difference in Deviance
with(TMTBlog3,null.deviance - deviance)
## [1] 14.41466
#Degrees of freedom for the difference between two models
with(TMTBlog3,df.null - df.residual)
## [1] 9
#p-value
with(TMTBlog3,pchisq(null.deviance-deviance,df.null-df.residual,lower.tail=FALSE))
## [1] 0.1083207
#Pseudo R-Squared
nagelkerke(TMTBlog3)
## $Models
##                                                                                              
## Model: "glm, PsychAggress ~ (TrailsB + Sex + PovStat)^3 + Age + WRATtotal, binomial, Allvars"
## Null:  "glm, PsychAggress ~ 1, binomial, Allvars"                                            
## 
## $Pseudo.R.squared.for.model.vs.null
##                              Pseudo.R.squared
## McFadden                            0.0285212
## Cox and Snell (ML)                  0.0222368
## Nagelkerke (Cragg and Uhler)        0.0407675
## 
## $Likelihood.ratio.test
##  Df.diff LogLik.diff  Chisq p.value
##       -9     -7.2073 14.415 0.10832
## 
## $Number.of.observations
##           
## Model: 641
## Null:  641
## 
## $Messages
## [1] "Note: For models fit with REML, these statistics are based on refitting with ML"
## 
## $Warnings
## [1] "None"

Compare Models 1 & 3

anova(TMTBlog1,TMTBlog3,test = "LR")
## Analysis of Deviance Table
## 
## Model 1: PsychAggress ~ TrailsB + WRATtotal
## Model 2: PsychAggress ~ (TrailsB + Sex + PovStat)^3 + Age + WRATtotal
##   Resid. Df Resid. Dev Df Deviance Pr(>Chi)
## 1       638     502.60                     
## 2       631     490.99  7   11.617   0.1139

Trail Making Test Part B - Physical Assault

Model 1

options(scipen = 999)
TMTBlog1 <- glm(PhysAssault ~ TrailsB + WRATtotal, data=Allvars,family = "binomial")
summary(TMTBlog1)
## 
## Call:
## glm(formula = PhysAssault ~ TrailsB + WRATtotal, family = "binomial", 
##     data = Allvars)
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -0.5637  -0.5337  -0.5159  -0.4854   2.2079  
## 
## Coefficients:
##               Estimate Std. Error z value Pr(>|z|)  
## (Intercept) -2.2512544  0.9100576  -2.474   0.0134 *
## TrailsB     -0.0009631  0.0019131  -0.503   0.6147  
## WRATtotal    0.0092431  0.0181183   0.510   0.6099  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 482.53  on 640  degrees of freedom
## Residual deviance: 481.59  on 638  degrees of freedom
## AIC: 487.59
## 
## Number of Fisher Scoring iterations: 4
confint(TMTBlog1)
##                    2.5 %      97.5 %
## (Intercept) -4.080575386 -0.50337326
## TrailsB     -0.004912096  0.00262842
## WRATtotal   -0.025640019  0.04556428
exp(cbind(OR = coef(TMTBlog1), confint(TMTBlog1)))
##                    OR      2.5 %    97.5 %
## (Intercept) 0.1052671 0.01689774 0.6044881
## TrailsB     0.9990374 0.99509995 1.0026319
## WRATtotal   1.0092860 0.97468590 1.0466183
Anova(TMTBlog1, type="II", test="Wald")
## Analysis of Deviance Table (Type II tests)
## 
## Response: PhysAssault
##           Df  Chisq Pr(>Chisq)
## TrailsB    1 0.2534     0.6147
## WRATtotal  1 0.2603     0.6099
########Compare to null model 
#Difference in Deviance
with(TMTBlog1,null.deviance - deviance)
## [1] 0.941138
#Degrees of freedom for the difference between two models
with(TMTBlog1,df.null - df.residual)
## [1] 2
#p-value
with(TMTBlog1,pchisq(null.deviance-deviance,df.null-df.residual,lower.tail=FALSE))
## [1] 0.6246467
#Pseudo R-Squared
nagelkerke(TMTBlog1)
## $Models
##                                                                   
## Model: "glm, PhysAssault ~ TrailsB + WRATtotal, binomial, Allvars"
## Null:  "glm, PhysAssault ~ 1, binomial, Allvars"                  
## 
## $Pseudo.R.squared.for.model.vs.null
##                              Pseudo.R.squared
## McFadden                           0.00195041
## Cox and Snell (ML)                 0.00146716
## Nagelkerke (Cragg and Uhler)       0.00277374
## 
## $Likelihood.ratio.test
##  Df.diff LogLik.diff   Chisq p.value
##       -2    -0.47057 0.94114 0.62465
## 
## $Number.of.observations
##           
## Model: 641
## Null:  641
## 
## $Messages
## [1] "Note: For models fit with REML, these statistics are based on refitting with ML"
## 
## $Warnings
## [1] "None"

Model 3

options(scipen = 999)
TMTBlog3 <- glm(PhysAssault ~ (TrailsB + Sex + PovStat)^3 + Age + WRATtotal, data = Allvars, family = "binomial")
summary(TMTBlog3)
## 
## Call:
## glm(formula = PhysAssault ~ (TrailsB + Sex + PovStat)^3 + Age + 
##     WRATtotal, family = "binomial", data = Allvars)
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -0.8076  -0.5530  -0.4680  -0.3874   2.3898  
## 
## Coefficients:
##                               Estimate Std. Error z value Pr(>|z|)  
## (Intercept)                 -1.3070879  1.1474161  -1.139    0.255  
## TrailsB                     -0.0003952  0.0033321  -0.119    0.906  
## SexMen                      -0.4164733  0.5404079  -0.771    0.441  
## PovStatBelow                 0.3301475  0.5989564   0.551    0.581  
## Age                         -0.0339108  0.0142097  -2.386    0.017 *
## WRATtotal                    0.0193090  0.0188812   1.023    0.306  
## TrailsB:SexMen               0.0022476  0.0043351   0.518    0.604  
## TrailsB:PovStatBelow         0.0012567  0.0049259   0.255    0.799  
## SexMen:PovStatBelow          0.5698502  0.9182035   0.621    0.535  
## TrailsB:SexMen:PovStatBelow -0.0046844  0.0073815  -0.635    0.526  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 482.53  on 640  degrees of freedom
## Residual deviance: 468.86  on 631  degrees of freedom
## AIC: 488.86
## 
## Number of Fisher Scoring iterations: 5
confint(TMTBlog3)
##                                    2.5 %       97.5 %
## (Intercept)                 -3.586519885  0.922804562
## TrailsB                     -0.007675075  0.005630066
## SexMen                      -1.488985092  0.639884285
## PovStatBelow                -0.853851868  1.506410081
## Age                         -0.062201434 -0.006373086
## WRATtotal                   -0.016975165  0.057248566
## TrailsB:SexMen              -0.006319224  0.011010130
## TrailsB:PovStatBelow        -0.008693041  0.011011262
## SexMen:PovStatBelow         -1.229855510  2.384454883
## TrailsB:SexMen:PovStatBelow -0.019760664  0.009613506
exp(cbind(OR = coef(TMTBlog3), confint(TMTBlog3)))
##                                    OR      2.5 %     97.5 %
## (Intercept)                 0.2706069 0.02769454  2.5163377
## TrailsB                     0.9996049 0.99235430  1.0056459
## SexMen                      0.6593681 0.22560150  1.8962614
## PovStatBelow                1.3911733 0.42577175  4.5105093
## Age                         0.9666577 0.93969358  0.9936472
## WRATtotal                   1.0194966 0.98316810  1.0589190
## TrailsB:SexMen              1.0022501 0.99370070  1.0110710
## TrailsB:PovStatBelow        1.0012575 0.99134463  1.0110721
## SexMen:PovStatBelow         1.7680022 0.29233481 10.8531448
## TrailsB:SexMen:PovStatBelow 0.9953265 0.98043330  1.0096599
Anova(TMTBlog3, type="II", test="Wald")
## Analysis of Deviance Table (Type II tests)
## 
## Response: PhysAssault
##                     Df  Chisq Pr(>Chisq)  
## TrailsB              1 0.0593    0.80762  
## Sex                  1 0.4079    0.52305  
## PovStat              1 3.7284    0.05349 .
## Age                  1 5.6952    0.01701 *
## WRATtotal            1 1.0458    0.30647  
## TrailsB:Sex          1 0.0323    0.85735  
## TrailsB:PovStat      1 0.0489    0.82501  
## Sex:PovStat          1 0.0262    0.87131  
## TrailsB:Sex:PovStat  1 0.4027    0.52568  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
########Compare to null model 
#Difference in Deviance
with(TMTBlog3,null.deviance - deviance)
## [1] 13.67086
#Degrees of freedom for the difference between two models
with(TMTBlog3,df.null - df.residual)
## [1] 9
#p-value
with(TMTBlog3,pchisq(null.deviance-deviance,df.null-df.residual,lower.tail=FALSE))
## [1] 0.1345244
#Pseudo R-Squared
nagelkerke(TMTBlog3)
## $Models
##                                                                                             
## Model: "glm, PhysAssault ~ (TrailsB + Sex + PovStat)^3 + Age + WRATtotal, binomial, Allvars"
## Null:  "glm, PhysAssault ~ 1, binomial, Allvars"                                            
## 
## $Pseudo.R.squared.for.model.vs.null
##                              Pseudo.R.squared
## McFadden                            0.0283315
## Cox and Snell (ML)                  0.0211016
## Nagelkerke (Cragg and Uhler)        0.0398937
## 
## $Likelihood.ratio.test
##  Df.diff LogLik.diff  Chisq p.value
##       -9     -6.8354 13.671 0.13452
## 
## $Number.of.observations
##           
## Model: 641
## Null:  641
## 
## $Messages
## [1] "Note: For models fit with REML, these statistics are based on refitting with ML"
## 
## $Warnings
## [1] "None"

Compare Models 1 & 3

anova(TMTBlog1,TMTBlog3,test = "LR")
## Analysis of Deviance Table
## 
## Model 1: PhysAssault ~ TrailsB + WRATtotal
## Model 2: PhysAssault ~ (TrailsB + Sex + PovStat)^3 + Age + WRATtotal
##   Resid. Df Resid. Dev Df Deviance Pr(>Chi)  
## 1       638     481.59                       
## 2       631     468.86  7    12.73  0.07897 .
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1