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
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
########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
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
########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
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
########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
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
########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