Chi-Square: Marijuana Status 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: Marijuana Status 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: Marijuana Status 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
Chi-Square: Marijuana Status and Cocaine Use
tbl = table(exdata$MedHxMarijStatusCurrent,exdata$MedHxCokeStatusNFC)
tbl
##
## 0 1 2
## 0 2026 345 80
## 1 198 77 76
chisq.test(tbl)
##
## Pearson's Chi-squared test
##
## data: tbl
## X-squared = 225.7, df = 2, p-value < 2.2e-16
Chi-Square: Marijuana Status and Alcohol Use
tbl = table(exdata$MedHxMarijStatusCurrent,exdata$MedHxAlcStatusNFC)
tbl
##
## 0 1 2
## 0 628 626 1197
## 1 32 32 287
chisq.test(tbl)
##
## Pearson's Chi-squared test
##
## data: tbl
## X-squared = 133.6, df = 2, p-value < 2.2e-16
Chi-Square: Marijuana Status and Opiate Use
tbl = table(exdata$MedHxMarijStatusCurrent,exdata$MedHxOpiateStatusNFC)
tbl
##
## 0 1 2
## 0 2159 244 48
## 1 253 55 43
chisq.test(tbl)
##
## Pearson's Chi-squared test
##
## data: tbl
## X-squared = 118.7, df = 2, p-value < 2.2e-16
Chi-Square: Marijuana Status and Cigarette Use
tbl = table(exdata$MedHxMarijStatusCurrent,exdata$MedHxCigaretteStatusNFC)
tbl
##
## 0 1 2
## 0 676 740 1035
## 1 26 59 266
chisq.test(tbl)
##
## Pearson's Chi-squared test
##
## data: tbl
## X-squared = 143.6, df = 2, p-value < 2.2e-16
Chi-Square: Marijuana Status and Age
tbl = table(exdata$MedHxMarijStatusCurrent,exdata$agecat)
tbl
##
## 30-39 40-49 50-59 60+
## 0 496 769 838 347
## 1 102 141 94 14
chisq.test(tbl)
##
## Pearson's Chi-squared test
##
## data: tbl
## X-squared = 48.21, df = 3, p-value = 1.922e-10
Education Categories
summary(EdEx$Edcat)
## 8th grade or below Associate degree
## 182 66
## Bachelor's degree Graduate Degree (MA,PhD,MD,JD)
## 158 75
## Graduate/prof school, no degree HS graduate/GED
## 63 910
## Some college, no degree Some HS
## 564 710
## NA's
## 73
tbl=table(EdEx$MedHxMarijStatusCurrent,EdEx$Edcat2)
tbl
##
## 8th grade or below Bachelor's degree HS graduate/GED
## 0 167 148 786
## 1 15 10 124
##
## Some college/Associate Degree
## 0 555
## 1 75
##
## Some Graduate School/Graduate Degree (MA,PhD,MD,JD) Some HS
## 0 133 596
## 1 5 114
chisq.test(tbl)
##
## Pearson's Chi-squared test
##
## data: tbl
## X-squared = 27.78, df = 5, p-value = 4.024e-05
#attach(EdEx)
#EdEx$Edcat2[EdEx$Education=="1st grade"| EdEx$Education=="2nd grade"|EdEx$Education=="3rd grade"|EdEx$Education=="4th grade"|EdEx$Education=="5th grade"|EdEx$Education=="6th grade"| EdEx$Education=="7th grade"|EdEx$Education=="8th grade"] <- "8th grade or below"
#EdEx$Edcat2[EdEx$Education=="9th grade"|EdEx$Education=="10th grade"|EdEx$Education=="11th grade"] <- "Some HS"
#EdEx$Edcat2[EdEx$Education=="HS graduate/GED"] <- "HS graduate/GED"
#EdEx$Edcat2[EdEx$Education == "1 year college"|EdEx$Education == "2 years college, no degree"| EdEx$Education == "3 years college, no degree"|EdEx$Education == "4 years college, no degree"|EdEx$Education == "Associate degree"] <- "Some college/Associate Degree"
#EdEx$Edcat2[EdEx$Education == "Bachelor's degree"] <- "Bachelor's degree"
#EdEx$Edcat2[EdEx$Education == "Graduate/prof school, no degree"|EdEx$Education == "Master's degree"|EdEx$Education == "Professional/technical graduate degree (PhD, MD, JD)"] <- "Some Graduate School/Graduate Degree (MA,PhD,MD,JD)"
#detach(EdEx)
#save(EdEx,file="/Users/meganwilliams/Desktop/Research/Cannabis and Cardiovascular Disease/EdEx.rdata")