setwd("C:/Users/SwagD/Desktop/Data 101")

Problem 1: ACTN3 Gene

This is going to test whether the R and X alleles are equally likely.

Hypotheses

\[ H_0: p_R = p_X = 0.5 \]

\[ H_A: p_R \ne p_X \]

\[ \alpha = 0.05 \]

observed <- c(244, 192)
expected <- c(0.5, 0.5)

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

The p-value is 0.01276.

Since the p-value is less than the significance level of 0.05, we reject the null hypothesis.

This is enough evidence to come to the conclusion that the R and X alleles are not equally likely in the population.

Problem 2: Vitamin Use vs Gender

We test whether vitamin use is associated with gender.

Hypotheses:

H₀: Vitamin Use and Gender are independent Hₐ: Vitamin Use and Gender are associated

α=0.05

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


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

The p-value is 0.003944.

Since the p-value is less than the significance level of 0.05, we reject the null hypothesis.

This is enough evidence to come to the conclusion that the vitamin useage and sex are associated, meaning vitamin usage is different between males and females.

Problem 3: Fish Gill Rates

We test whether mean gill rate differs by calcium level.

Hypotheses:

H₀: μ₁=μ₂=μ₃ Hₐ: At least one mean is different

α=0.05

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

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 p-value is 0.0121.

Since the p-value is less than the significance level of 0.05, we reject the null hypothesis.

This is enough evidence to come to the conclusion that the mean gill rate is different depending on the calcium level of the water.