logTrails A Regression Model 2 Three- and Four-Way Interaction Plots

## Loading required package: Matrix
## 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.30551    0.15427   21.43
## Age == 0                                 0.01561    0.01076    1.45
## IPVstatus1 == 0                          0.54121    0.27496    1.97
## PovStatBelow == 0                        0.31640    0.22467    1.41
## SexMen == 0                              0.15118    0.20136    0.75
## CES11 == 0                               0.45066    0.19599    2.30
## Age:IPVstatus1 == 0                      0.05086    0.02336    2.18
## Age:PovStatBelow == 0                   -0.01324    0.01615   -0.82
## Age:SexMen == 0                         -0.00178    0.01519   -0.12
## Age:CES11 == 0                           0.01273    0.01530    0.83
## IPVstatus1:PovStatBelow == 0             0.98871    0.42255    2.34
## IPVstatus1:SexMen == 0                  -0.66280    0.54993   -1.21
## IPVstatus1:CES11 == 0                   -1.03006    0.34485   -2.99
## PovStatBelow:SexMen == 0                -0.08332    0.29852   -0.28
## PovStatBelow:CES11 == 0                 -0.52057    0.16620   -3.13
## SexMen:CES11 == 0                       -0.79333    0.34596   -2.29
## Age:IPVstatus1:PovStatBelow == 0         0.11065    0.03737    2.96
## Age:IPVstatus1:SexMen == 0              -0.07175    0.03836   -1.87
## Age:IPVstatus1:CES11 == 0               -0.09548    0.02960   -3.23
## Age:PovStatBelow:SexMen == 0             0.01042    0.02638    0.39
## Age:SexMen:CES11 == 0                   -0.02649    0.02998   -0.88
## IPVstatus1:PovStatBelow:SexMen == 0     -0.64647    0.58127   -1.11
## IPVstatus1:SexMen:CES11 == 0             1.56956    0.53900    2.91
## PovStatBelow:SexMen:CES11 == 0           0.60334    0.35877    1.68
## Age:IPVstatus1:PovStatBelow:SexMen == 0 -0.07537    0.05057   -1.49
## Age:IPVstatus1:SexMen:CES11 == 0         0.15571    0.04565    3.41
##                                         Pr(>|z|)
## (Intercept) == 0                         < 2e-16
## Age == 0                                 0.14670
## IPVstatus1 == 0                          0.04903
## PovStatBelow == 0                        0.15905
## SexMen == 0                              0.45278
## CES11 == 0                               0.02148
## Age:IPVstatus1 == 0                      0.02945
## Age:PovStatBelow == 0                    0.41233
## Age:SexMen == 0                          0.90698
## Age:CES11 == 0                           0.40512
## IPVstatus1:PovStatBelow == 0             0.01929
## IPVstatus1:SexMen == 0                   0.22811
## IPVstatus1:CES11 == 0                    0.00282
## PovStatBelow:SexMen == 0                 0.78017
## PovStatBelow:CES11 == 0                  0.00173
## SexMen:CES11 == 0                        0.02184
## Age:IPVstatus1:PovStatBelow == 0         0.00307
## Age:IPVstatus1:SexMen == 0               0.06139
## Age:IPVstatus1:CES11 == 0                0.00126
## Age:PovStatBelow:SexMen == 0             0.69293
## Age:SexMen:CES11 == 0                    0.37687
## IPVstatus1:PovStatBelow:SexMen == 0      0.26607
## IPVstatus1:SexMen:CES11 == 0             0.00359
## PovStatBelow:SexMen:CES11 == 0           0.09262
## Age:IPVstatus1:PovStatBelow:SexMen == 0  0.13612
## Age:IPVstatus1:SexMen:CES11 == 0         0.00065
## (Univariate p values reported)

Age/IPV/Sex/Depression

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  30    0         0 Women   0              0  0.3175 3.748
## 2  31    0         0 Women   0              0  0.3175 3.760
## 3  32    0         0 Women   0              0  0.3175 3.771
## 4  33    0         0 Women   0              0  0.3175 3.782
## 5  34    0         0 Women   0              0  0.3175 3.794
## 6  35    0         0 Women   0              0  0.3175 3.805

par(mar = c(4, 4, 0.5, 2), las = 1, lwd = 2)

HNDcolors = HNDpltColors()

with(hatIPVcog1[hatIPVcog1$Sex == "Women" & hatIPVcog1$CES1 == "0" & hatIPVcog1$IPVstatus == 
    "0", ], plot(pAge, hat, lty = 1, col = "red", type = "l", ylim = c(1, 11), 
    ylab = "log(Trails A)", xlab = "Age"))
with(hatIPVcog1[hatIPVcog1$Sex == "Women" & hatIPVcog1$CES1 == "0" & hatIPVcog1$IPVstatus == 
    "1", ], lines(pAge, hat, lty = 2, col = "red"))
with(hatIPVcog1[hatIPVcog1$Sex == "Women" & hatIPVcog1$CES1 == "1" & hatIPVcog1$IPVstatus == 
    "0", ], lines(pAge, hat, lty = 3, col = "red"))
with(hatIPVcog1[hatIPVcog1$Sex == "Women" & hatIPVcog1$CES1 == "1" & hatIPVcog1$IPVstatus == 
    "1", ], lines(pAge, hat, lty = 4, col = "red"))

with(hatIPVcog1[hatIPVcog1$Sex == "Men" & hatIPVcog1$CES1 == "0" & hatIPVcog1$IPVstatus == 
    "0", ], lines(pAge, hat, lty = 1, col = "blue", typ = "l", ylim = c(1, 11), 
    ylab = "Trails A", xlab = "Age"))
with(hatIPVcog1[hatIPVcog1$Sex == "Men" & hatIPVcog1$CES1 == "0" & hatIPVcog1$IPVstatus == 
    "1", ], lines(pAge, hat, lty = 2, col = "blue"))
with(hatIPVcog1[hatIPVcog1$Sex == "Men" & hatIPVcog1$CES1 == "1" & hatIPVcog1$IPVstatus == 
    "0", ], lines(pAge, hat, lty = 3, col = "blue"))
with(hatIPVcog1[hatIPVcog1$Sex == "Men" & hatIPVcog1$CES1 == "1" & hatIPVcog1$IPVstatus == 
    "1", ], lines(pAge, hat, lty = 4, col = "blue"))


legend(30, 11, zQ(nonDepressednoIPV, nonDepressedIPV, DepressednoIPV, DepressedIPV), 
    lty = 1:4, col = "black", cex = 0.9, bty = "n")
text(30, 1.7, "Women in red", adj = c(0, 0), col = "red", cex = 0.95)
text(30, 1, "Men in blue", adj = c(0, 0), col = "blue", cex = 0.95)

plot of chunk unnamed-chunk-1

Age/IPV/Poverty

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  30 abovePovStat         0   0              0 0.4603 0.4444 3.864
## 2  31 abovePovStat         0   0              0 0.4603 0.4444 3.879
## 3  32 abovePovStat         0   0              0 0.4603 0.4444 3.894
## 4  33 abovePovStat         0   0              0 0.4603 0.4444 3.909
## 5  34 abovePovStat         0   0              0 0.4603 0.4444 3.924
## 6  35 abovePovStat         0   0              0 0.4603 0.4444 3.939

par(mar = c(4, 4, 0.5, 2), las = 1, lwd = 2)

HNDcolors = HNDpltColors()

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


legend(30, 11, zQ(AbovePovStatnoIPV, AbovePovStatIPV, BelowPovStatnoIPV, belowPovStatIPV), 
    lty = 1:4, col = "black", cex = 0.95, bty = "n")
text(30, 1.5, "IPV in red", adj = c(0, 0), col = "red", cex = 0.95)
text(30, 1, "No IPV in black", adj = c(0, 0), col = "black", cex = 0.95)

plot of chunk unnamed-chunk-2

Age/IPV/Depression

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

head(hatIPVcog1)
##   Age CES1 IPVstatus log TrailsAtestSec    Sex PovStat   hat
## 1  30    0         0   0              0 0.4603  0.3175 3.827
## 2  31    0         0   0              0 0.4603  0.3175 3.839
## 3  32    0         0   0              0 0.4603  0.3175 3.851
## 4  33    0         0   0              0 0.4603  0.3175 3.863
## 5  34    0         0   0              0 0.4603  0.3175 3.875
## 6  35    0         0   0              0 0.4603  0.3175 3.887

par(mar = c(4, 4, 0.5, 2), las = 1, lwd = 2)

HNDcolors = HNDpltColors()

with(hatIPVcog1[hatIPVcog1$CES1 == "0" & hatIPVcog1$IPVstatus == "0", ], plot(pAge, 
    hat, lty = 1, col = "black", type = "l", ylim = c(1, 8), ylab = "log(Trails A)", 
    xlab = "Age"))
with(hatIPVcog1[hatIPVcog1$CES1 == "0" & hatIPVcog1$IPVstatus == "1", ], lines(pAge, 
    hat, lty = 2, col = "red"))
with(hatIPVcog1[hatIPVcog1$CES1 == "1" & hatIPVcog1$IPVstatus == "0", ], lines(pAge, 
    hat, lty = 3, col = "black"))
with(hatIPVcog1[hatIPVcog1$CES1 == "1" & hatIPVcog1$IPVstatus == "1", ], lines(pAge, 
    hat, lty = 4, col = "red"))


legend(30, 8, zQ(nonDepressednoIPV, nonDepressedIPV, DepressednoIPV, DepressedIPV), 
    lty = 1:4, col = "black", cex = 0.95)
text(30, 1.5, "IPV in red", adj = c(0, 0), col = "red", cex = 0.95)
text(30, 1, "No IPV in black", adj = c(0, 0), col = "black", cex = 0.95)

plot of chunk unnamed-chunk-3

##IPV/Sex/Depression ##```{r} Depression=(c("No Depression","Depression"))

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

head(hatIPVcog1)

par(mar=c(4,4,.5,2),las = 1, lwd = 2)

HNDcolors = HNDpltColors()

with(hatIPVcog1[hatIPVcog1$Sex == "Women" & hatIPVcog1$IPVstatus == "0", ], plot(CES1,hat, lty = 1, col = "red", type = "l",ylim = c(1,4), ylab = "log(Trails A)", xlab = "Depression")) with(hatIPVcog1[hatIPVcog1$Sex == "Women" & hatIPVcog1$IPVstatus == "1", ], lines(CES1,hat, lty = 2, col = "red"))

with(hatIPVcog1[hatIPVcog1$Sex == "Men" & hatIPVcog1$IPVstatus == "0", ], lines(CES1,hat, lty = 1, col = "blue", typ = "l", ylim = c(1,4), ylab = "Trails A", xlab = "Depression")) with(hatIPVcog1[hatIPVcog1$Sex == "Men" & hatIPVcog1$IPVstatus == "1", ], lines(CES1,hat, lty = 2, col = "blue"))

legend(0,3, zQ(NoIPV,IPV), lty = 1:2, col = "black",cex=.90,bty="n") text(0,1.5,"Women in red", adj = c(0,0), col = "red",cex=.95) text(0,1,"Men in blue", adj = c(0,0), col = "blue",cex=.95)