Stroop Color-Word Test - Psychological Aggression
Model 1
SCWTlog1 <- glm(PsychAggress ~ HIscore, data=Stroop,family = "binomial")
summary(SCWTlog1)
##
## Call:
## glm(formula = PsychAggress ~ HIscore, family = "binomial", data = Stroop)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -2.1581 0.5161 0.5480 0.5782 0.7187
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 1.1499 0.4743 2.425 0.0153 *
## HIscore 1.2230 0.9230 1.325 0.1852
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 449.84 on 540 degrees of freedom
## Residual deviance: 448.10 on 539 degrees of freedom
## AIC: 452.1
##
## Number of Fisher Scoring iterations: 4
confint(SCWTlog1)
## 2.5 % 97.5 %
## (Intercept) 0.2400607 2.104197
## HIscore -0.5986857 3.027263
exp(cbind(OR = coef(SCWTlog1), confint(SCWTlog1)))
## OR 2.5 % 97.5 %
## (Intercept) 3.157877 1.2713263 8.200514
## HIscore 3.397350 0.5495334 20.640652
plot(predictorEffect("HIscore",SCWTlog1))

########Compare to null model
#Difference in Deviance
with(SCWTlog1,null.deviance - deviance)
## [1] 1.740722
#Degrees of freedom for the difference between two models
with(SCWTlog1,df.null - df.residual)
## [1] 1
#p-value
with(SCWTlog1,pchisq(null.deviance-deviance,df.null-df.residual,lower.tail=FALSE))
## [1] 0.1870473
Model 2
SCWTlog2 <- glm(PsychAggress ~ HIscore + Age + Sex + PovStat + WRATtotal, data=Stroop, family = "binomial")
summary(SCWTlog2)
##
## Call:
## glm(formula = PsychAggress ~ HIscore + Age + Sex + PovStat +
## WRATtotal, family = "binomial", data = Stroop)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -2.2798 0.4236 0.5145 0.6025 0.8921
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 1.48268 1.17371 1.263 0.2065
## HIscore 0.62656 0.95026 0.659 0.5097
## Age -0.02668 0.01441 -1.852 0.0640 .
## SexMen -0.33190 0.24766 -1.340 0.1802
## PovStatBelow 0.23283 0.28695 0.811 0.4171
## WRATtotal 0.03072 0.01682 1.826 0.0678 .
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 449.84 on 540 degrees of freedom
## Residual deviance: 438.05 on 535 degrees of freedom
## AIC: 450.05
##
## Number of Fisher Scoring iterations: 4
confint(SCWTlog2)
## 2.5 % 97.5 %
## (Intercept) -0.803552777 3.807007178
## HIscore -1.245798078 2.488498312
## Age -0.055219621 0.001387377
## SexMen -0.821089462 0.152635240
## PovStatBelow -0.316324569 0.813326850
## WRATtotal -0.002734323 0.063417124
exp(cbind(OR = coef(SCWTlog2), confint(SCWTlog2)))
## OR 2.5 % 97.5 %
## (Intercept) 4.4047483 0.4477354 45.015514
## HIscore 1.8711605 0.2877112 12.043177
## Age 0.9736684 0.9462773 1.001388
## SexMen 0.7175609 0.4399521 1.164900
## PovStatBelow 1.2621678 0.7288229 2.255399
## WRATtotal 1.0311924 0.9972694 1.065471
plot(allEffects(SCWTlog2))

########Compare to null model
#Difference in Deviance
with(SCWTlog2,null.deviance - deviance)
## [1] 11.79121
#Degrees of freedom for the difference between two models
with(SCWTlog2,df.null - df.residual)
## [1] 5
#p-value
with(SCWTlog2,pchisq(null.deviance-deviance,df.null-df.residual,lower.tail=FALSE))
## [1] 0.03776346
Model 3
SCWTlog3 <- glm(PsychAggress ~ (HIscore + Sex + PovStat)^3 + Age + WRATtotal, data=Stroop, family = "binomial")
summary(SCWTlog3)
##
## Call:
## glm(formula = PsychAggress ~ (HIscore + Sex + PovStat)^3 + Age +
## WRATtotal, family = "binomial", data = Stroop)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -2.4000 0.4216 0.5111 0.5951 0.9187
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 1.46256 1.36088 1.075 0.2825
## HIscore 0.67780 1.59668 0.425 0.6712
## SexMen -0.23111 1.14615 -0.202 0.8402
## PovStatBelow 0.01302 1.62888 0.008 0.9936
## Age -0.02656 0.01446 -1.837 0.0662 .
## WRATtotal 0.03177 0.01696 1.873 0.0610 .
## HIscore:SexMen -0.40484 2.21338 -0.183 0.8549
## HIscore:PovStatBelow 0.05517 3.18209 0.017 0.9862
## SexMen:PovStatBelow -0.13367 2.10088 -0.064 0.9493
## HIscore:SexMen:PovStatBelow 1.08307 4.14946 0.261 0.7941
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 449.84 on 540 degrees of freedom
## Residual deviance: 437.39 on 531 degrees of freedom
## AIC: 457.39
##
## Number of Fisher Scoring iterations: 4
confint(SCWTlog3)
## 2.5 % 97.5 %
## (Intercept) -1.165263019 4.189108879
## HIscore -2.518183249 3.794475536
## SexMen -2.507598935 2.009977851
## PovStatBelow -3.192792121 3.240740926
## Age -0.055203887 0.001612524
## WRATtotal -0.001913851 0.064799335
## HIscore:SexMen -4.731676666 3.976659958
## HIscore:PovStatBelow -6.052311844 6.516984144
## SexMen:PovStatBelow -4.249369940 4.030441268
## HIscore:SexMen:PovStatBelow -7.206346203 9.135070138
exp(cbind(OR = coef(SCWTlog3), confint(SCWTlog3)))
## OR 2.5 % 97.5 %
## (Intercept) 4.3170040 0.3118406313 65.963983
## HIscore 1.9695349 0.0806059147 44.454915
## SexMen 0.7936522 0.0814636040 7.463152
## PovStatBelow 1.0131031 0.0410570744 25.552647
## Age 0.9737890 0.9462921914 1.001614
## WRATtotal 1.0322808 0.9980879789 1.066945
## HIscore:SexMen 0.6670817 0.0088116844 53.338583
## HIscore:PovStatBelow 1.0567185 0.0023524173 676.534973
## SexMen:PovStatBelow 0.8748749 0.0142732241 56.285743
## HIscore:SexMen:PovStatBelow 2.9537456 0.0007418628 9274.928128
plot(predictorEffect("HIscore",SCWTlog3))

########Compare to null model
#Difference in Deviance
with(SCWTlog3,null.deviance - deviance)
## [1] 12.45958
#Degrees of freedom for the difference between two models
with(SCWTlog3,df.null - df.residual)
## [1] 9
#p-value
with(SCWTlog3,pchisq(null.deviance-deviance,df.null-df.residual,lower.tail=FALSE))
## [1] 0.1886225
Compare Models 1,2, & 3
anova(SCWTlog1,SCWTlog2,test = "LR")
## Analysis of Deviance Table
##
## Model 1: PsychAggress ~ HIscore
## Model 2: PsychAggress ~ HIscore + Age + Sex + PovStat + WRATtotal
## Resid. Df Resid. Dev Df Deviance Pr(>Chi)
## 1 539 448.10
## 2 535 438.05 4 10.05 0.03959 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
anova(SCWTlog2,SCWTlog3,test = "LR")
## Analysis of Deviance Table
##
## Model 1: PsychAggress ~ HIscore + Age + Sex + PovStat + WRATtotal
## Model 2: PsychAggress ~ (HIscore + Sex + PovStat)^3 + Age + WRATtotal
## Resid. Df Resid. Dev Df Deviance Pr(>Chi)
## 1 535 438.05
## 2 531 437.39 4 0.66837 0.9552
anova(SCWTlog1,SCWTlog3,test = "LR")
## Analysis of Deviance Table
##
## Model 1: PsychAggress ~ HIscore
## Model 2: PsychAggress ~ (HIscore + Sex + PovStat)^3 + Age + WRATtotal
## Resid. Df Resid. Dev Df Deviance Pr(>Chi)
## 1 539 448.10
## 2 531 437.39 8 10.719 0.2181
Suggested Model by Predictors
anova(SCWTlog3, test="Chisq")
## Analysis of Deviance Table
##
## Model: binomial, link: logit
##
## Response: PsychAggress
##
## Terms added sequentially (first to last)
##
##
## Df Deviance Resid. Df Resid. Dev Pr(>Chi)
## NULL 540 449.84
## HIscore 1 1.7407 539 448.10 0.18705
## Sex 1 2.3295 538 445.77 0.12694
## PovStat 1 0.7180 537 445.06 0.39679
## Age 1 3.7545 536 441.30 0.05267 .
## WRATtotal 1 3.2485 535 438.05 0.07149 .
## HIscore:Sex 1 0.0020 534 438.05 0.96452
## HIscore:PovStat 1 0.1008 533 437.95 0.75083
## Sex:PovStat 1 0.4977 532 437.45 0.48051
## HIscore:Sex:PovStat 1 0.0678 531 437.39 0.79450
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
SCWTlog4 <- glm(PsychAggress ~ HIscore, data=Stroop, family = "binomial")
summary(SCWTlog4)
##
## Call:
## glm(formula = PsychAggress ~ HIscore, family = "binomial", data = Stroop)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -2.1581 0.5161 0.5480 0.5782 0.7187
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 1.1499 0.4743 2.425 0.0153 *
## HIscore 1.2230 0.9230 1.325 0.1852
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 449.84 on 540 degrees of freedom
## Residual deviance: 448.10 on 539 degrees of freedom
## AIC: 452.1
##
## Number of Fisher Scoring iterations: 4
plot(allEffects(SCWTlog4))

Stroop Color-Word Test - Physical Assault
Model 1
SCWTlog1 <- glm(PhysAssault ~ HIscore, data=Stroop,family = "binomial")
summary(SCWTlog1)
##
## Call:
## glm(formula = PhysAssault ~ HIscore, family = "binomial", data = Stroop)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -0.4962 -0.4901 -0.4888 -0.4873 2.0971
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) -2.03041 0.55047 -3.688 0.000226 ***
## HIscore -0.06363 1.04522 -0.061 0.951455
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 381.12 on 540 degrees of freedom
## Residual deviance: 381.11 on 539 degrees of freedom
## AIC: 385.11
##
## Number of Fisher Scoring iterations: 4
confint(SCWTlog1)
## 2.5 % 97.5 %
## (Intercept) -3.148671 -0.987511
## HIscore -2.090665 2.011360
exp(cbind(OR = coef(SCWTlog1), confint(SCWTlog1)))
## OR 2.5 % 97.5 %
## (Intercept) 0.1312816 0.04290911 0.3725027
## HIscore 0.9383495 0.12360494 7.4734715
########Compare to null model
#Difference in Deviance
with(SCWTlog1,null.deviance - deviance)
## [1] 0.003703459
#Degrees of freedom for the difference between two models
with(SCWTlog1,df.null - df.residual)
## [1] 1
#p-value
with(SCWTlog1,pchisq(null.deviance-deviance,df.null-df.residual,lower.tail=FALSE))
## [1] 0.9514738
Model 2
SCWTlog2 <- glm(PhysAssault ~ HIscore + Age + Sex + PovStat + WRATtotal, data=Stroop, family = "binomial")
summary(SCWTlog2)
##
## Call:
## glm(formula = PhysAssault ~ HIscore + Age + Sex + PovStat + WRATtotal,
## family = "binomial", data = Stroop)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -0.8337 -0.5227 -0.4382 -0.3630 2.4610
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) -1.56392 1.36920 -1.142 0.2534
## HIscore -0.71323 1.13322 -0.629 0.5291
## Age -0.03107 0.01611 -1.929 0.0538 .
## SexMen -0.28621 0.28153 -1.017 0.3093
## PovStatBelow 0.64215 0.29072 2.209 0.0272 *
## WRATtotal 0.02638 0.02144 1.230 0.2186
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 381.12 on 540 degrees of freedom
## Residual deviance: 368.40 on 535 degrees of freedom
## AIC: 380.4
##
## Number of Fisher Scoring iterations: 5
confint(SCWTlog2)
## 2.5 % 97.5 %
## (Intercept) -4.28681197 1.0938703854
## HIscore -2.92965977 1.5190711122
## Age -0.06319529 0.0001295182
## SexMen -0.84831765 0.2601640470
## PovStatBelow 0.06679474 1.2106481058
## WRATtotal -0.01428789 0.0700105028
exp(cbind(OR = coef(SCWTlog2), confint(SCWTlog2)))
## OR 2.5 % 97.5 %
## (Intercept) 0.2093136 0.01374869 2.985808
## HIscore 0.4900590 0.05341521 4.567980
## Age 0.9694083 0.93876012 1.000130
## SexMen 0.7511040 0.42813460 1.297143
## PovStatBelow 1.9005549 1.06907601 3.355659
## WRATtotal 1.0267327 0.98581370 1.072519
########Compare to null model
#Difference in Deviance
with(SCWTlog2,null.deviance - deviance)
## [1] 12.72144
#Degrees of freedom for the difference between two models
with(SCWTlog2,df.null - df.residual)
## [1] 5
#p-value
with(SCWTlog2,pchisq(null.deviance-deviance,df.null-df.residual,lower.tail=FALSE))
## [1] 0.02613384
Model 3
SCWTlog3 <- glm(PhysAssault ~ (HIscore + Sex + PovStat)^3 + Age + WRATtotal, data=Stroop, family = "binomial")
summary(SCWTlog3)
##
## Call:
## glm(formula = PhysAssault ~ (HIscore + Sex + PovStat)^3 + Age +
## WRATtotal, family = "binomial", data = Stroop)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -0.8328 -0.5473 -0.4372 -0.3347 2.5457
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) -2.35283 1.63275 -1.441 0.1496
## HIscore 0.81880 1.96754 0.416 0.6773
## SexMen 1.93488 1.54059 1.256 0.2091
## PovStatBelow 0.46270 1.65923 0.279 0.7803
## Age -0.03060 0.01613 -1.897 0.0579 .
## WRATtotal 0.02818 0.02136 1.320 0.1870
## HIscore:SexMen -4.89935 2.99915 -1.634 0.1023
## HIscore:PovStatBelow -0.12944 3.08404 -0.042 0.9665
## SexMen:PovStatBelow -1.19694 2.29936 -0.521 0.6027
## HIscore:SexMen:PovStatBelow 3.60078 4.40845 0.817 0.4140
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 381.12 on 540 degrees of freedom
## Residual deviance: 364.11 on 531 degrees of freedom
## AIC: 384.11
##
## Number of Fisher Scoring iterations: 5
confint(SCWTlog3)
## 2.5 % 97.5 %
## (Intercept) -5.66028700 7.612328e-01
## HIscore -2.91692385 4.814069e+00
## SexMen -1.11014656 4.983019e+00
## PovStatBelow -2.80026941 3.748583e+00
## Age -0.06277306 6.609005e-04
## WRATtotal -0.01236495 7.163728e-02
## HIscore:SexMen -10.87277984 9.322144e-01
## HIscore:PovStatBelow -6.29086794 5.861839e+00
## SexMen:PovStatBelow -5.75139161 3.307767e+00
## HIscore:SexMen:PovStatBelow -4.97623370 1.235623e+01
exp(cbind(OR = coef(SCWTlog3), confint(SCWTlog3)))
## OR 2.5 % 97.5 %
## (Intercept) 0.095099264 3.481518e-03 2.140914e+00
## HIscore 2.267767101 5.409985e-02 1.232321e+02
## SexMen 6.923235436 3.295107e-01 1.459143e+02
## PovStatBelow 1.588353575 6.079368e-02 4.246086e+01
## Age 0.969860480 9.391566e-01 1.000661e+00
## WRATtotal 1.028585429 9.877112e-01 1.074266e+00
## HIscore:SexMen 0.007451393 1.896757e-05 2.540128e+00
## HIscore:PovStatBelow 0.878583000 1.853151e-03 3.513697e+02
## SexMen:PovStatBelow 0.302118182 3.178355e-03 2.732405e+01
## HIscore:SexMen:PovStatBelow 36.626830786 6.900001e-03 2.324028e+05
interact_plot(model = SCWTlog3, pred = HIscore, modx = Sex)

sim_slopes(SCWTlog3, pred = HIscore, modx = Sex, centered = "all",jnplot = TRUE)
## Warning: Johnson-Neyman intervals are not available for factor moderators.
## SIMPLE SLOPES ANALYSIS
##
## Slope of HIscore when Sex = Men:
##
## Est. S.E. z val. p
## ------- ------ -------- ------
## -3.02 1.76 -1.72 0.09
##
## Slope of HIscore when Sex = Women:
##
## Est. S.E. z val. p
## ------ ------ -------- ------
## 0.78 1.56 0.50 0.62
########Compare to null model
#Difference in Deviance
with(SCWTlog3,null.deviance - deviance)
## [1] 17.01248
#Degrees of freedom for the difference between two models
with(SCWTlog3,df.null - df.residual)
## [1] 9
#p-value
with(SCWTlog3,pchisq(null.deviance-deviance,df.null-df.residual,lower.tail=FALSE))
## [1] 0.04852095
Compare Models 1,2, & 3
anova(SCWTlog1,SCWTlog2,test = "LR")
## Analysis of Deviance Table
##
## Model 1: PhysAssault ~ HIscore
## Model 2: PhysAssault ~ HIscore + Age + Sex + PovStat + WRATtotal
## Resid. Df Resid. Dev Df Deviance Pr(>Chi)
## 1 539 381.11
## 2 535 368.40 4 12.718 0.01274 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
anova(SCWTlog2,SCWTlog3,test = "LR")
## Analysis of Deviance Table
##
## Model 1: PhysAssault ~ HIscore + Age + Sex + PovStat + WRATtotal
## Model 2: PhysAssault ~ (HIscore + Sex + PovStat)^3 + Age + WRATtotal
## Resid. Df Resid. Dev Df Deviance Pr(>Chi)
## 1 535 368.40
## 2 531 364.11 4 4.291 0.368
anova(SCWTlog2,SCWTlog3,test = "LR")
## Analysis of Deviance Table
##
## Model 1: PhysAssault ~ HIscore + Age + Sex + PovStat + WRATtotal
## Model 2: PhysAssault ~ (HIscore + Sex + PovStat)^3 + Age + WRATtotal
## Resid. Df Resid. Dev Df Deviance Pr(>Chi)
## 1 535 368.40
## 2 531 364.11 4 4.291 0.368
anova(SCWTlog3,SCWTlog2,test = "LR")
## Analysis of Deviance Table
##
## Model 1: PhysAssault ~ (HIscore + Sex + PovStat)^3 + Age + WRATtotal
## Model 2: PhysAssault ~ HIscore + Age + Sex + PovStat + WRATtotal
## Resid. Df Resid. Dev Df Deviance Pr(>Chi)
## 1 531 364.11
## 2 535 368.40 -4 -4.291 0.368
anova(SCWTlog1,SCWTlog3,test = "LR")
## Analysis of Deviance Table
##
## Model 1: PhysAssault ~ HIscore
## Model 2: PhysAssault ~ (HIscore + Sex + PovStat)^3 + Age + WRATtotal
## Resid. Df Resid. Dev Df Deviance Pr(>Chi)
## 1 539 381.11
## 2 531 364.11 8 17.009 0.03002 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Suggested Model by Predictors
anova(SCWTlog3, test="Chisq")
## Analysis of Deviance Table
##
## Model: binomial, link: logit
##
## Response: PhysAssault
##
## Terms added sequentially (first to last)
##
##
## Df Deviance Resid. Df Resid. Dev Pr(>Chi)
## NULL 540 381.12
## HIscore 1 0.0037 539 381.11 0.95147
## Sex 1 1.5311 538 379.58 0.21595
## PovStat 1 5.6270 537 373.96 0.01769 *
## Age 1 3.9789 536 369.98 0.04607 *
## WRATtotal 1 1.5807 535 368.40 0.20866
## HIscore:Sex 1 2.0632 534 366.33 0.15089
## HIscore:PovStat 1 0.3813 533 365.95 0.53692
## Sex:PovStat 1 1.1743 532 364.78 0.27852
## HIscore:Sex:PovStat 1 0.6722 531 364.11 0.41228
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
SCWTlog4 <- glm(PhysAssault ~ PovStat + Age, data=Stroop, family = "binomial")
summary(SCWTlog4)
##
## Call:
## glm(formula = PhysAssault ~ PovStat + Age, family = "binomial",
## data = Stroop)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -0.7229 -0.5215 -0.4464 -0.3765 2.3812
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) -0.83926 0.73667 -1.139 0.2546
## PovStatBelow 0.57643 0.28196 2.044 0.0409 *
## Age -0.03142 0.01561 -2.012 0.0442 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 381.12 on 540 degrees of freedom
## Residual deviance: 371.17 on 538 degrees of freedom
## AIC: 377.17
##
## Number of Fisher Scoring iterations: 5