Nutrition <- read.csv("/Users/danielmedlin/Downloads/NutritionStudy.csv")
Gills <- read.csv("/Users/danielmedlin/Downloads/FishGills3.csv")

##Question 1 #Hypotheses

Null Hypothesis \(H_0\): The R and X alleles are equally likely.

Alternative Hypothesis \(H_1\): The R and X alleles are not equally likely.

alleles <- c(244, 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

#Conclusion Since the p-value of 0.01276 is less than the p-value of 0.05, we reject the null hypothesis since there’s not enough evidence the R and X alleles can happen equally.

##Question 2 #Hypotheses

Null Hypothesis \(H_0\): Vitamin use and Gender are not associated.

Alternative Hypothesis \(H_1\): Vitamin use and Gender are associated.

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

#Conclusion The test came back with a p-value of 0.003944, which is less than 0.05. With this, we reject the null hypothesis and conclude there is a significant association between gender and vitamin use.

##Question 3 #Hypotheses

Null \(H_0\): Mean gill rates are equal in all levels of calcium.

Alternative \(H_1\): At least on of the calcium levels have a different mean gill rate.

gill_rates <- aov(GillRate ~ Calcium, data = Gills)
summary(gill_rates)
##             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

#Conclusion Since the p-value of 0.0121 is less than 0.05, we reject the null hypothesis. There is enough evidence to conclude that mean gill rates do differ in different calcium levels.