IPV and Cognition: Updated Black and White Plots

## Loading required package: Matrix
## 
## Attaching package: 'lme4'
## 
## The following object is masked from 'package:ggplot2':
## 
##     fortify
## 
## Loading required package: mvtnorm
## Loading required package: TH.data
## Warning: number of observations <= rank(Z); variance-covariance matrix
## will be unidentifiable
## 
##   Simultaneous Tests for General Linear Hypotheses
## 
## Fit: lmer(formula = log(TrailsAtestSec) ~ Age + IPVstatus + PovStat + 
##     Sex + CES1 + (Age | HNDid) + (1 | subclass) + Age:IPVstatus + 
##     Age:PovStat + Age:Sex + Age:CES1 + IPVstatus:PovStat + IPVstatus:Sex + 
##     IPVstatus:CES1 + PovStat:Sex + PovStat:CES1 + Sex:CES1 + 
##     Age:IPVstatus:PovStat + Age:IPVstatus:Sex + Age:IPVstatus:CES1 + 
##     Age:PovStat:Sex + Age:Sex:CES1 + IPVstatus:PovStat:Sex + 
##     IPVstatus:Sex:CES1 + PovStat:Sex:CES1 + Age:IPVstatus:PovStat:Sex + 
##     Age:IPVstatus:Sex:CES1, data = IPVandCognitionDataSet2, na.action = na.omit)
## 
## Linear Hypotheses:
##                                         Estimate Std. Error z value
## (Intercept) == 0                         3.33888    0.15151   22.04
## Age == 0                                 0.01541    0.01058    1.46
## IPVstatus1 == 0                          0.52046    0.27764    1.87
## PovStatBelow == 0                        0.06531    0.22812    0.29
## SexMen == 0                              0.04786    0.20260    0.24
## CES11 == 0                               0.56162    0.21589    2.60
## Age:IPVstatus1 == 0                      0.04911    0.02308    2.13
## Age:PovStatBelow == 0                   -0.02151    0.01582   -1.36
## Age:SexMen == 0                         -0.00831    0.01538   -0.54
## Age:CES11 == 0                           0.02193    0.01553    1.41
## IPVstatus1:PovStatBelow == 0             1.11844    0.43889    2.55
## IPVstatus1:SexMen == 0                  -0.50893    0.59436   -0.86
## IPVstatus1:CES11 == 0                   -1.12804    0.36396   -3.10
## PovStatBelow:SexMen == 0                 0.31044    0.33102    0.94
## PovStatBelow:CES11 == 0                 -0.43739    0.16015   -2.73
## SexMen:CES11 == 0                       -0.86284    0.36807   -2.34
## Age:IPVstatus1:PovStatBelow == 0         0.11210    0.03810    2.94
## Age:IPVstatus1:SexMen == 0              -0.06167    0.04061   -1.52
## Age:IPVstatus1:CES11 == 0               -0.10191    0.02999   -3.40
## Age:PovStatBelow:SexMen == 0             0.02842    0.02713    1.05
## Age:SexMen:CES11 == 0                   -0.03213    0.03002   -1.07
## IPVstatus1:PovStatBelow:SexMen == 0     -1.02604    0.63179   -1.62
## IPVstatus1:SexMen:CES11 == 0             1.50363    0.58314    2.58
## PovStatBelow:SexMen:CES11 == 0           0.59532    0.36539    1.63
## Age:IPVstatus1:PovStatBelow:SexMen == 0 -0.08707    0.05190   -1.68
## Age:IPVstatus1:SexMen:CES11 == 0         0.15271    0.04701    3.25
##                                         Pr(>|z|)
## (Intercept) == 0                         < 2e-16
## Age == 0                                 0.14498
## IPVstatus1 == 0                          0.06085
## PovStatBelow == 0                        0.77464
## SexMen == 0                              0.81324
## CES11 == 0                               0.00928
## Age:IPVstatus1 == 0                      0.03337
## Age:PovStatBelow == 0                    0.17382
## Age:SexMen == 0                          0.58884
## Age:CES11 == 0                           0.15774
## IPVstatus1:PovStatBelow == 0             0.01082
## IPVstatus1:SexMen == 0                   0.39185
## IPVstatus1:CES11 == 0                    0.00194
## PovStatBelow:SexMen == 0                 0.34833
## PovStatBelow:CES11 == 0                  0.00631
## SexMen:CES11 == 0                        0.01907
## Age:IPVstatus1:PovStatBelow == 0         0.00326
## Age:IPVstatus1:SexMen == 0               0.12883
## Age:IPVstatus1:CES11 == 0                0.00068
## Age:PovStatBelow:SexMen == 0             0.29474
## Age:SexMen:CES11 == 0                    0.28449
## IPVstatus1:PovStatBelow:SexMen == 0      0.10437
## IPVstatus1:SexMen:CES11 == 0             0.00992
## PovStatBelow:SexMen:CES11 == 0           0.10325
## Age:IPVstatus1:PovStatBelow:SexMen == 0  0.09343
## Age:IPVstatus1:SexMen:CES11 == 0         0.00116
## (Univariate p values reported)

Age/IPV/Sex/Depression (Stratified by Gender)

hatIPVcog1 = zMixHat(IPVandCognitionDataSet2, mm2, vary = "Age=pAge, CES1=zQ(0,1),IPVstatus=zQ(0,1),Sex=zQ(Women,Men)",fixedCov="PovStat")

head(hatIPVcog1)
##   Age CES1 IPVstatus   Sex log TrailsAtestSec PovStat   hat
## 1 -20    0         0 Women   0              0  0.3333 3.196
## 2 -19    0         0 Women   0              0  0.3333 3.204
## 3 -18    0         0 Women   0              0  0.3333 3.212
## 4 -17    0         0 Women   0              0  0.3333 3.221
## 5 -16    0         0 Women   0              0  0.3333 3.229
## 6 -15    0         0 Women   0              0  0.3333 3.237
par(mar=c(4,4,.3,.1),las = 1, lwd = 2,mfrow=c(1,2))

HNDcolors = HNDpltColors()

with(hatIPVcog1[hatIPVcog1$Sex == "Women" & hatIPVcog1$CES1 == "1" & hatIPVcog1$IPVstatus == "0", ], plot(pAge,hat, lty = 1, col = "dimgray", type = "l",ylim = c(1,8), ylab = "log(Trails A)",yaxt="n", xlab = "Age",xaxt="n",lwd=1.5))
axis(2,cex.axis=.8)
with(hatIPVcog1[hatIPVcog1$Sex == "Women" & hatIPVcog1$CES1 == "1" & hatIPVcog1$IPVstatus == "1", ], lines(pAge,hat, lty = 1, col = "black",lwd=1.5))
with(hatIPVcog1[hatIPVcog1$Sex == "Women" & hatIPVcog1$CES1 == "0" & hatIPVcog1$IPVstatus == "0", ], lines(pAge,hat, lty = 2, col = "dimgray",lwd=1.5))
with(hatIPVcog1[hatIPVcog1$Sex == "Women" & hatIPVcog1$CES1 == "0" & hatIPVcog1$IPVstatus == "1", ], lines(pAge, hat, lty = 2, col = "black",lwd=1.5))

axis(1,at=c(-20,-15,-10,-5,0,5,10,15,20),labels = c("30","35","40","45","50","55","60","65","70"))

legend(-20,8, zQ("Depressive Symptoms", "No Depressive Symptoms"), lty = 1:2, col = "black",cex=.75,bty="n")
text(-20,2,"Women", adj = c(0,0), col = "black",cex=.8)
text(10,2,"IPV in Black", adj = c(0,0), col = "black",cex=.8)


with(hatIPVcog1[hatIPVcog1$Sex == "Men" & hatIPVcog1$CES1 == "1" & hatIPVcog1$IPVstatus == "0", ], plot(pAge,hat, lty = 1, col = "dimgray", typ = "l", ylim = c(1,8),ylab="log(Trails A)",yaxt="n",xlab="Age",xaxt="n",lwd=1.5))
axis(2,cex.axis=.8)
with(hatIPVcog1[hatIPVcog1$Sex == "Men" & hatIPVcog1$CES1 == "1" & hatIPVcog1$IPVstatus == "1", ], lines(pAge,hat, lty = 1, col = "black",lwd=1.5))
with(hatIPVcog1[hatIPVcog1$Sex == "Men" & hatIPVcog1$CES1 == "0" & hatIPVcog1$IPVstatus == "0", ], lines(pAge,hat, lty = 2, col = "dimgray",lwd=1.5))
with(hatIPVcog1[hatIPVcog1$Sex == "Men" & hatIPVcog1$CES1 == "0" & hatIPVcog1$IPVstatus == "1", ], lines(pAge,hat, lty = 2, col = "black",lwd=1.5))

axis(1,at=c(-20,-15,-10,-5,0,5,10,15,20),labels = c("30","35","40","45","50","55","60","65","70"))

legend(-20,8, zQ("Depressive Symptoms","No Depressive Symptoms"), lty = 1:2, col = "black",cex=.75,bty="n")
text(-20,2,"Men", adj = c(0,0), col = "black",cex=.8)
text(10,2,"IPV in Black", adj = c(0,0), col = "black",cex=.8)

plot of chunk unnamed-chunk-1

Age/IPV/PovertyStatus

hatIPVcog1 = zMixHat(IPVandCognitionDataSet2, mm2, vary = "Age=pAge, PovStat=zQ(abovePovStat,belowPovStat),IPVstatus=zQ(0,1)",fixedCov=c("Sex","CES1"))

head(hatIPVcog1)
##   Age      PovStat IPVstatus log TrailsAtestSec    Sex   CES1   hat
## 1 -20 abovePovStat         0   0              0 0.4286 0.4286 3.135
## 2 -19 abovePovStat         0   0              0 0.4286 0.4286 3.150
## 3 -18 abovePovStat         0   0              0 0.4286 0.4286 3.165
## 4 -17 abovePovStat         0   0              0 0.4286 0.4286 3.181
## 5 -16 abovePovStat         0   0              0 0.4286 0.4286 3.196
## 6 -15 abovePovStat         0   0              0 0.4286 0.4286 3.211
par(mar=c(4,4,.5,2),las = 1, lwd = 2)

HNDcolors = HNDpltColors()

with(hatIPVcog1[hatIPVcog1$PovStat == "abovePovStat" & hatIPVcog1$IPVstatus == "0", ],plot(pAge,hat, lty = 1, col = "dimgrey", type = "l",ylim = c(1,12), ylab = "log(Trails A)", xlab = "Age",xaxt="n"))
with(hatIPVcog1[hatIPVcog1$PovStat == "abovePovStat" & hatIPVcog1$IPVstatus == "1", ], lines(pAge,hat, lty = 1, col = "black"))
with(hatIPVcog1[hatIPVcog1$PovStat == "belowPovStat" & hatIPVcog1$IPVstatus == "0", ], lines(pAge,hat, lty = 2, col = "dimgrey"))
with(hatIPVcog1[hatIPVcog1$PovStat == "belowPovStat" & hatIPVcog1$IPVstatus == "1", ], lines(pAge,hat, lty = 2, col = "black"))

axis(1,at=c(-20,-15,-10,-5,0,5,10,15,20),labels = c("30","35","40","45","50","55","60","65","70"))
legend(-20,12, zQ("Above Poverty Status","Below Poverty Status"), lty = 1:2, col = "black",cex=.95,bty="n")
text(-20,2,"IPV in Black", adj = c(0,0), col = "black",cex=.95)

plot of chunk unnamed-chunk-2