6.29 Off shore drilling, Part I. A 2010 survey asked 827 randomly sampled registered voters in California “Do you support? Or do you oppose? Drilling for oil and natural gas off the Coast of California? Or do you not know enough to say?” Below is the distribution of responses, separated based on whether or not the respondent graduated from college.
pc = 104/438
pn = 131/389
#college
pc
## [1] 0.2374429
#noncollege
pn
## [1] 0.3367609
Hypothesis test
Z = (0.237-0.337)/sqrt(0.254*0.716/438+0.284*0.716/389)
2*pnorm(Z,0,1)
## [1] 0.001093856
So we reject the null as the p vale is less than .05 Therefore there appears to be a stastical difference in the proportion of college graduates that do not know enough about the topic.
Chi Square test
library(data.table)
College.dt <- data.table(
rowNames = c("Support","Oppose","Do not know"),
Yes = c(154,180, 104),
No = c(132,126,131))
chisq.test(x = College.dt$Yes, y= College.dt$No, correct = T )
## Warning in chisq.test(x = College.dt$Yes, y = College.dt$No, correct = T): Chi-
## squared approximation may be incorrect
##
## Pearson's Chi-squared test
##
## data: College.dt$Yes and College.dt$No
## X-squared = 6, df = 4, p-value = 0.1991
So the Chisq test also shows that there is a p-value > .05