Users vs Non-Users by Race and Sex
tbl = table(exdata$MedHxMarijStatusCurrent, exdata$Race, exdata$Sex)
tbl
## , , = Women
##
##
## White AfrAm
## 0 622 810
## 1 47 101
##
## , , = Men
##
##
## White AfrAm
## 0 455 563
## 1 61 142
T-test and chi-square analyses comparing marijuana users (1) to non-users (0) by age, race, sex, and poverty status
t-test for marijuana use and age
x = exdata$MedHxMarijStatusCurrent
y = exdata$Age0
t.test(y~x)
##
## Welch Two Sample t-test
##
## data: y by x
## t = 7.627, df = 475, p-value = 1.324e-13
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## 2.794 4.734
## sample estimates:
## mean in group 0 mean in group 1
## 48.53 44.76
chi-square for marijuana use and sex
tbl = table(exdata$MedHxMarijStatusCurrent,exdata$Sex)
tbl
##
## Women Men
## 0 1432 1018
## 1 148 203
chisq.test(tbl)
##
## Pearson's Chi-squared test with Yates' continuity correction
##
## data: tbl
## X-squared = 32.45, df = 1, p-value = 1.224e-08
chi-square for marijuana use and race
tbl = table(exdata$MedHxMarijStatusCurrent,exdata$Race)
tbl
##
## White AfrAm
## 0 1077 1373
## 1 108 243
chisq.test(tbl)
##
## Pearson's Chi-squared test with Yates' continuity correction
##
## data: tbl
## X-squared = 21.35, df = 1, p-value = 3.834e-06
chi-square for marijuana use and poverty status
tbl = table(exdata$MedHxMarijStatusCurrent,exdata$PovStat)
tbl
##
## Above Below
## 0 1465 985
## 1 194 157
chisq.test(tbl)
##
## Pearson's Chi-squared test with Yates' continuity correction
##
## data: tbl
## X-squared = 2.42, df = 1, p-value = 0.1198