Quiz Code

Question 2.2

null.probs <- c(1/4, 1/4, 1/4, 1/4)
cowpea <- c(167, 176, 174, 194)
chisq.test(cowpea, p=null.probs)
## 
##  Chi-squared test for given probabilities
## 
## data:  cowpea
## X-squared = 2.2321, df = 3, p-value = 0.5257

Question 3d.1

female <- c(11, 52)
male <- c(8, 54)
test <- data.frame(female, male)
chisq.test(test)
## 
##  Pearson's Chi-squared test with Yates' continuity correction
## 
## data:  test
## X-squared = 0.21197, df = 1, p-value = 0.6452