##Problem 1 We conduct a chi-square goodness-of-fit to examine if the two alleles (R and X) are not equally likely. Hypotheses H0: PR = PX Ha: PR ≠ PX

#Chi-Square Goodness-of-Fit Test for ACTN3 Alleles
## Observed counts
observed <- c(R = 244, X = 192)
# Null values
theoritical_prop <- rep(1/2, 2)

\(H_0\):\(p_R\) = \(p_X\) = 1/2 \(H_a\): at least on \(p_i\) \(\neq\) 1/2

# Expected values
expected_values <- theoritical_prop*sum(observed) 
expected_values
## [1] 218 218
#Chi-Square Test
test_result <- chisq.test(observed)
test_result
## 
##  Chi-squared test for given probabilities
## 
## data:  observed
## X-squared = 6.2018, df = 1, p-value = 0.01276

**Interpretation* -The test statistic, X-squared = 6.2018, df = 1, p-value = 0.01276. -We reject the null hypothesis since the p-value is less than 0.05. -It implies there is sufficient statistically significant evidence that the two ACTN3 allele options (R and X) are not equally likely. -Conclusion: The alleles R and X are not equally likely.

Problem 2

The dataset imported R-studio.

#Create contingency table
tableVG <- table(NutritionStudy$VitaminUse, NutritionStudy$Sex)
tableVG 
##             
##              Female Male
##   No             87   24
##   Occasional     77    5
##   Regular       109   13

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

#Chi-square test of association
chisq.test(tableVG)
## 
##  Pearson's Chi-squared test
## 
## data:  tableVG
## X-squared = 11.071, df = 2, p-value = 0.003944

-The test statistic, X-squared = 11.071, df = 1, -The p-value = 0.003944. -Since the p-value is less than 0.05, we reject the null hypothesis. - This implies there is enough evidence of significant association between vitamin use and gender. -Conclusion: Female are statistically more likely to take vitamins compared to male.

Problem 3

Is there a significant difference in gill rates by Calcium Level? Hypotheses H0: µL = µM = µH Ha: µL ≠ µM ≠ µH

#LOading FishGills3 dataset
setwd("C:/Users/user/Downloads")
Gill_rate <- read_csv("FishGills3.csv")
## Rows: 90 Columns: 2
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (1): Calcium
## dbl (1): GillRate
## 
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
head(Gill_rate)
## # A tibble: 6 × 2
##   Calcium GillRate
##   <chr>      <dbl>
## 1 Low           55
## 2 Low           63
## 3 Low           78
## 4 Low           85
## 5 Low           65
## 6 Low           98

Hypothesis

\(H_0\): \(\mu_L\) = \(\mu_M\) = \(\mu_H\)

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

# Perform One-way ANOVA model
fit=aov(GillRate ~ Calcium, data = Gill_rate)
# summary results
summary(fit)
##             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

interpretation -The test statistic, F (2, 87) = 4.648, p = 0.0121. -The null hypothesis is rejected since the p-value is less than 0.05. -Hence, there is sufficient evidence to support the claim. -Conclusion: There is a statistically significant difference in gill rate based on the calcium level of the water.