H0: The R and X alleles are equally likely.
Ha: The R and X alleles are not equally likely.
alleles <- c(R = 244, X = 192)
chisq.test(
alleles,
p = c(0.5, 0.5)
)
##
## Chi-squared test for given probabilities
##
## data: alleles
## X-squared = 6.2018, df = 1, p-value = 0.01276
The p-value is approximately 0.0128.
Since the p-value is less than 0.05, I reject H0. There is enough evidence to show that the R and X alleles are not equally likely.
H0: Vitamin use and gender are not associated.
Ha: Vitamin use and gender are associated.
nutrition <- read.csv("NutritionStudy.csv")
vitamin_table <- table(
nutrition$VitaminUse,
nutrition$Sex
)
vitamin_table
##
## Female Male
## No 87 24
## Occasional 77 5
## Regular 109 13
chisq.test(vitamin_table)
##
## Pearson's Chi-squared test
##
## data: vitamin_table
## X-squared = 11.071, df = 2, p-value = 0.003944
The p-value is approximately 0.0039.
Since the p-value is less than 0.05, I reject H0. There is enough evidence to show that vitamin use and gender are significantly associated.
H0: The mean gill rate is the same for the low,
medium, and high calcium groups.
Ha: At least one mean gill rate is different.
fish <- read.csv("FishGills3.csv")
aggregate(GillRate ~ Calcium, data = fish, mean)
## Calcium GillRate
## 1 High 58.16667
## 2 Low 68.50000
## 3 Medium 58.66667
anova_model <- aov(
GillRate ~ Calcium,
data = fish
)
summary(anova_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
The ANOVA p-value is approximately 0.0121.
Since the p-value is less than 0.05, I reject H0. There is enough evidence to show that the mean gill rate differs depending on the calcium level of the water.