library(readr)
# Problem 1
obs <- c(R = 244, X = 192)
exp <- c(436/2, 436/2)
chisq.test(x = obs, p = c(0.5, 0.5))
##
## Chi-squared test for given probabilities
##
## data: obs
## X-squared = 6.2018, df = 1, p-value = 0.01276
Hypotheses
H0: R and X alleles are equally likely (pR = pX).
HA: R and X alleles are not equally likely.
Conclusion
Because p = 0.0128 < 0.05, we reject the null hypothesis. There is evidence that the two alleles are not equally likely in the population.
# Problem 2
data <- read.csv("NutritionStudy.csv")
tbl <- table(data$VitaminUse, data$Sex)
chisq.test(tbl)
##
## Pearson's Chi-squared test
##
## data: tbl
## X-squared = 11.071, df = 2, p-value = 0.003944
Hypotheses
H0: Vitamin use and gender are independent.
HA: Vitamin use and gender are associated.
Conclusion
Because p = 0.00394 < 0.05, we reject H0. There is a significant association between gender and vitamin use.
# Problem 3
fish <- read.csv("FishGills3.csv")
model <- aov(GillRate ~ Calcium, data = fish)
summary(model)
## Df Sum Sq Mean Sq F value Pr(>F)
## Calcium 2 2037 1018.6 4.648 0.0121 *
## Residuals 87 19064 219.1
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Hypotheses
H0: Mean gill rate is the same across all calcium levels.
HA: At least one calcium level has a different mean gill rate.
Conclusion
Because p = 0.0121 < 0.05, we reject H0. Mean gill rate differs significantly among calcium levels.