nutrition <- read.csv("/Users/zen/Downloads/NutritionStudy.csv")
fish <- read.csv("/Users/zen/Downloads/FishGills3.csv")
We test whether the two alleles (R and X) are equally likely.
Hypotheses:
\(H_0: p_R = p_X\)
\(H_a: p_R \ne p_X\)
observed <- c(244, 192)
chisq.test(x = observed, p = c(0.5, 0.5))
##
## Chi-squared test for given probabilities
##
## data: observed
## X-squared = 6.2018, df = 1, p-value = 0.01276
p value:
0.01276
Conclusion:
Since the p value is less than 0.05, we reject H₀. There is enough evidence to say the two alleles (R and X) are not equally likely.
We test if there is an association between vitamin use and sex.
Hypotheses:
\(H_0\): VitaminUse and Sex are independent
\(H_a\): VitaminUse and Sex are associated
table_data <- table(nutrition$VitaminUse, nutrition$Sex)
chisq.test(table_data)
##
## Pearson's Chi-squared test
##
## data: table_data
## X-squared = 11.071, df = 2, p-value = 0.003944
p value:
0.003944
Conclusion:
Since the p value is less than 0.05, we reject H₀. There is enough evidence to conclude that vitamin use and sex are associated.
We test if mean gill rate differs by calcium level.
Hypotheses:
\(H_0: \mu_1 = \mu_2 = \mu_3\)
\(H_a\): At least one mean is different
anova_result <- aov(GillRate ~ Calcium, data = fish)
summary(anova_result)
## 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
p value:
0.0121
Conclusion:
Since the p value is less than 0.05, we reject H₀. There is enough evidence to say that mean gill rate differs across calcium levels.