Load datasets

nutrition <- read.csv("NutritionStudy.csv")
fish <- read.csv("FishGills3.csv")

Problem 1:

Hypotheses:

\(H_0\):\(p_1\) = \(p_2\) = 1/2
\(H_a\): at least one \(p_i\) \(\neq\) 1/2

# Observed Counts
observed <- c(244, 192)

# Null values
theoritical_prop <- rep(1/2, 2)

# Make sure Chi-square test can be performed
expected_values <- theoritical_prop*sum(observed)
expected_values
## [1] 218 218

Results

chisq.test(observed)
## 
##  Chi-squared test for given probabilities
## 
## data:  observed
## X-squared = 6.2018, df = 1, p-value = 0.01276

P Value: 0.01276

Conclusion: There is statistically significant evidence to reject the null hypothesis that the alleles are equally likely.

Problem 2:

Hypotheses:

\(H_0\) : Vitamin use is not associated with gender
\(H_a\) : Vitamin use is associated with gender

observed_dataset<- table(nutrition$VitaminUse, nutrition$Sex)
observed_dataset
##             
##              Female Male
##   No             87   24
##   Occasional     77    5
##   Regular       109   13
chisq.test(observed_dataset)
## 
##  Pearson's Chi-squared test
## 
## data:  observed_dataset
## X-squared = 11.071, df = 2, p-value = 0.003944

P value: 0.003944

Conclusion: There is statistically significant evidence to reject the null hypothesis that vitamin use is not associated with gender.

Problem 3:

Hypotheses:

\(H_0\): \(\mu_l\) = \(\mu_m\) = \(\mu_h\)

\(H_a\): not all \(\mu_i\) are equal

anova_result <- aov(GillRate ~ Calcium, data = fish)
anova_result
## Call:
##    aov(formula = GillRate ~ Calcium, data = fish)
## 
## Terms:
##                   Calcium Residuals
## Sum of Squares   2037.222 19064.333
## Deg. of Freedom         2        87
## 
## Residual standard error: 14.80305
## Estimated effects may be unbalanced
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: There is statistically sufficient evidence to reject the null hypothesis that the mean gill rates are equal, showing that there are significant differences among different calcium levels.