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)

Digit Span Forward - Psychological Aggression

Model 1

DSFlog1 <- glm(PsychAggress ~ DigitSpanFwd + WRATtotal, data=Allvars,family = "binomial")
summary(DSFlog1)
## 
## Call:
## glm(formula = PsychAggress ~ DigitSpanFwd + WRATtotal, family = "binomial", 
##     data = Allvars)
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -2.2313   0.4682   0.5210   0.5643   0.7291  
## 
## Coefficients:
##              Estimate Std. Error z value Pr(>|z|)
## (Intercept)   0.78702    0.64531   1.220    0.223
## DigitSpanFwd  0.07846    0.05929   1.323    0.186
## WRATtotal     0.01168    0.01645   0.710    0.478
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 505.40  on 640  degrees of freedom
## Residual deviance: 501.43  on 638  degrees of freedom
## AIC: 507.43
## 
## Number of Fisher Scoring iterations: 4
exp(cbind(OR = coef(DSFlog1), confint(DSFlog1)))
##                    OR     2.5 %   97.5 %
## (Intercept)  2.196839 0.6382732 8.079733
## DigitSpanFwd 1.081621 0.9650907 1.218189
## WRATtotal    1.011748 0.9790101 1.044422
########Compare to null model 
#Difference in Deviance
with(DSFlog1,null.deviance - deviance)
## [1] 3.968932
#Degrees of freedom for the difference between two models
with(DSFlog1,df.null - df.residual)
## [1] 2
#p-value
with(DSFlog1,pchisq(null.deviance-deviance,df.null-df.residual,lower.tail=FALSE))
## [1] 0.137454
#Pseudo R-Squared
nagelkerke(DSFlog1)
## $Models
##                                                                         
## Model: "glm, PsychAggress ~ DigitSpanFwd + WRATtotal, binomial, Allvars"
## Null:  "glm, PsychAggress ~ 1, binomial, Allvars"                       
## 
## $Pseudo.R.squared.for.model.vs.null
##                              Pseudo.R.squared
## McFadden                           0.00785303
## Cox and Snell (ML)                 0.00617265
## Nagelkerke (Cragg and Uhler)       0.01131650
## 
## $Likelihood.ratio.test
##  Df.diff LogLik.diff  Chisq p.value
##       -2     -1.9845 3.9689 0.13745
## 
## $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

DSFlog3 <- glm(PsychAggress ~ (DigitSpanFwd + Sex + PovStat)^3 + Age + WRATtotal, data = Allvars, family = "binomial")
summary(DSFlog3)
## 
## Call:
## glm(formula = PsychAggress ~ (DigitSpanFwd + Sex + PovStat)^3 + 
##     Age + WRATtotal, family = "binomial", data = Allvars)
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -2.2630   0.4174   0.4864   0.5671   0.8936  
## 
## Coefficients:
##                                  Estimate Std. Error z value Pr(>|z|)  
## (Intercept)                       2.05209    1.11257   1.844   0.0651 .
## DigitSpanFwd                      0.04840    0.09789   0.494   0.6210  
## SexMen                           -0.95692    0.94536  -1.012   0.3114  
## PovStatBelow                      0.19631    1.31460   0.149   0.8813  
## Age                              -0.02016    0.01320  -1.527   0.1267  
## WRATtotal                         0.01412    0.01657   0.852   0.3939  
## DigitSpanFwd:SexMen               0.05684    0.12434   0.457   0.6476  
## DigitSpanFwd:PovStatBelow        -0.01234    0.17920  -0.069   0.9451  
## SexMen:PovStatBelow               0.20818    1.84272   0.113   0.9100  
## DigitSpanFwd:SexMen:PovStatBelow  0.02781    0.25559   0.109   0.9134  
## ---
## 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: 491.88  on 631  degrees of freedom
## AIC: 511.88
## 
## Number of Fisher Scoring iterations: 5
exp(cbind(OR = coef(DSFlog3), confint(DSFlog3)))
##                                         OR      2.5 %    97.5 %
## (Intercept)                      7.7841672 0.91152064 72.181868
## DigitSpanFwd                     1.0495926 0.87188396  1.282729
## SexMen                           0.3840725 0.05929822  2.438312
## PovStatBelow                     1.2169073 0.09333419 16.695902
## Age                              0.9800401 0.95480585  1.005630
## WRATtotal                        1.0142231 0.98123115  1.047252
## DigitSpanFwd:SexMen              1.0584906 0.82721892  1.349796
## DigitSpanFwd:PovStatBelow        0.9877360 0.69974951  1.421807
## SexMen:PovStatBelow              1.2314393 0.03214253 45.408760
## DigitSpanFwd:SexMen:PovStatBelow 1.0281966 0.62385173  1.711342
########Compare to null model 
#Difference in Deviance
with(DSFlog3,null.deviance - deviance)
## [1] 13.52276
#Degrees of freedom for the difference between two models
with(DSFlog3,df.null - df.residual)
## [1] 9
#p-value
with(DSFlog3,pchisq(null.deviance-deviance,df.null-df.residual,lower.tail=FALSE))
## [1] 0.1403431
#Pseudo R-Squared
nagelkerke(DSFlog3)
## $Models
##                                                                                                   
## Model: "glm, PsychAggress ~ (DigitSpanFwd + 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.0267565
## Cox and Snell (ML)                  0.0208754
## Nagelkerke (Cragg and Uhler)        0.0382715
## 
## $Likelihood.ratio.test
##  Df.diff LogLik.diff  Chisq p.value
##       -9     -6.7614 13.523 0.14034
## 
## $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(DSFlog1,DSFlog3,test = "LR")
## Analysis of Deviance Table
## 
## Model 1: PsychAggress ~ DigitSpanFwd + WRATtotal
## Model 2: PsychAggress ~ (DigitSpanFwd + Sex + PovStat)^3 + Age + WRATtotal
##   Resid. Df Resid. Dev Df Deviance Pr(>Chi)
## 1       638     501.43                     
## 2       631     491.88  7   9.5538   0.2153

Digit Span Forward - Physical Assault

Model 1

DSFlog1 <- glm(PhysAssault ~ DigitSpanFwd + WRATtotal, data=Allvars,family = "binomial")

summary(DSFlog1)
## 
## Call:
## glm(formula = PhysAssault ~ DigitSpanFwd + WRATtotal, family = "binomial", 
##     data = Allvars)
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -0.5618  -0.5322  -0.5148  -0.4907   2.1702  
## 
## Coefficients:
##               Estimate Std. Error z value Pr(>|z|)    
## (Intercept)  -2.532311   0.732701  -3.456 0.000548 ***
## DigitSpanFwd  0.001784   0.058017   0.031 0.975469    
## WRATtotal     0.013030   0.018186   0.716 0.473706    
## ---
## 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.85  on 638  degrees of freedom
## AIC: 487.85
## 
## Number of Fisher Scoring iterations: 4
exp(cbind(OR = coef(DSFlog1), confint(DSFlog1)))
##                      OR      2.5 %    97.5 %
## (Intercept)  0.07947516 0.01776384 0.3163918
## DigitSpanFwd 1.00178564 0.89231857 1.1207414
## WRATtotal    1.01311505 0.97850173 1.0509656
########Compare to null model 
#Difference in Deviance
with(DSFlog1,null.deviance - deviance)
## [1] 0.6824734
#Degrees of freedom for the difference between two models
with(DSFlog1,df.null - df.residual)
## [1] 2
#p-value
with(DSFlog1,pchisq(null.deviance-deviance,df.null-df.residual,lower.tail=FALSE))
## [1] 0.7108906
#Pseudo R-Squared
nagelkerke(DSFlog1)
## $Models
##                                                                        
## Model: "glm, PhysAssault ~ DigitSpanFwd + WRATtotal, binomial, Allvars"
## Null:  "glm, PhysAssault ~ 1, binomial, Allvars"                       
## 
## $Pseudo.R.squared.for.model.vs.null
##                              Pseudo.R.squared
## McFadden                           0.00141436
## Cox and Snell (ML)                 0.00106413
## Nagelkerke (Cragg and Uhler)       0.00201180
## 
## $Likelihood.ratio.test
##  Df.diff LogLik.diff   Chisq p.value
##       -2    -0.34124 0.68247 0.71089
## 
## $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

DSFlog3 <- glm(PhysAssault ~ (DigitSpanFwd + Sex + PovStat)^3 + Age + WRATtotal, data = Allvars, family = "binomial")
summary(DSFlog3)
## 
## Call:
## glm(formula = PhysAssault ~ (DigitSpanFwd + Sex + PovStat)^3 + 
##     Age + WRATtotal, family = "binomial", data = Allvars)
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -0.8189  -0.5530  -0.4756  -0.3929   2.4095  
## 
## Coefficients:
##                                  Estimate Std. Error z value Pr(>|z|)  
## (Intercept)                      -1.19141    1.18123  -1.009   0.3132  
## DigitSpanFwd                     -0.01788    0.09490  -0.188   0.8505  
## SexMen                           -0.47145    1.09257  -0.432   0.6661  
## PovStatBelow                      0.30840    1.14433   0.270   0.7875  
## Age                              -0.03343    0.01381  -2.421   0.0155 *
## WRATtotal                         0.01844    0.01896   0.973   0.3306  
## DigitSpanFwd:SexMen               0.03636    0.13301   0.273   0.7846  
## DigitSpanFwd:PovStatBelow         0.01956    0.14872   0.131   0.8954  
## SexMen:PovStatBelow               0.55778    1.74829   0.319   0.7497  
## DigitSpanFwd:SexMen:PovStatBelow -0.06336    0.22405  -0.283   0.7773  
## ---
## 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: 469.30  on 631  degrees of freedom
## AIC: 489.3
## 
## Number of Fisher Scoring iterations: 5
exp(cbind(OR = coef(DSFlog3), confint(DSFlog3)))
##                                         OR      2.5 %     97.5 %
## (Intercept)                      0.3037925 0.02850390  2.9521760
## DigitSpanFwd                     0.9822779 0.81000265  1.1779150
## SexMen                           0.6240948 0.07160496  5.2782498
## PovStatBelow                     1.3612487 0.14165469 12.8327101
## Age                              0.9671185 0.94088741  0.9933439
## WRATtotal                        1.0186144 0.98239582  1.0583396
## DigitSpanFwd:SexMen              1.0370278 0.79841304  1.3478636
## DigitSpanFwd:PovStatBelow        1.0197475 0.75939339  1.3652236
## SexMen:PovStatBelow              1.7467977 0.05645784 54.5444613
## DigitSpanFwd:SexMen:PovStatBelow 0.9386075 0.60233209  1.4547645
########Compare to null model 
#Difference in Deviance
with(DSFlog3,null.deviance - deviance)
## [1] 13.23718
#Degrees of freedom for the difference between two models
with(DSFlog3,df.null - df.residual)
## [1] 9
#p-value
with(DSFlog3,pchisq(null.deviance-deviance,df.null-df.residual,lower.tail=FALSE))
## [1] 0.1521644
#Pseudo R-Squared
nagelkerke(DSFlog3)
## $Models
##                                                                                                  
## Model: "glm, PhysAssault ~ (DigitSpanFwd + 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.0274327
## Cox and Snell (ML)                  0.0204391
## Nagelkerke (Cragg and Uhler)        0.0386412
## 
## $Likelihood.ratio.test
##  Df.diff LogLik.diff  Chisq p.value
##       -9     -6.6186 13.237 0.15216
## 
## $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(DSFlog1,DSFlog3,test = "LR")
## Analysis of Deviance Table
## 
## Model 1: PhysAssault ~ DigitSpanFwd + WRATtotal
## Model 2: PhysAssault ~ (DigitSpanFwd + Sex + PovStat)^3 + Age + WRATtotal
##   Resid. Df Resid. Dev Df Deviance Pr(>Chi)  
## 1       638     481.85                       
## 2       631     469.30  7   12.555  0.08373 .
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1