Does the sample provide evidence that the ACTN3 alleles R and X are not equally likely?
If equally likely: - R = 218 - X = 218
observed <- c(244, 192)
expected <- c(218, 218)
chisq.test(x = observed, p = c(0.5, 0.5))
##
## Chi-squared test for given probabilities
##
## data: observed
## X-squared = 6.2018, df = 1, p-value = 0.01276
P-value p-value ≈ 0.0128
###Conclusion Since the p-value is less than 0.05, we reject the null hypothesis. There is statistically significant evidence that the ACTN3 alleles R and X are not equally distributed in this sample.
##Problem 2: Chi-Square Test of Association (Vitamin Use and Gender) Research Question Is there an association between Vitamin Use and Gender?
###Hypotheses Null hypothesis (H₀): Vitamin use and gender are independent.
Alternative hypothesis (H₁): Vitamin use and gender are associated.
###Data Preparation
nutrition <- read.csv("NutritionStudy.csv")
table_vitamin_gender <- table(nutrition$VitaminUse, nutrition$Sex)
table_vitamin_gender
##
## Female Male
## No 87 24
## Occasional 77 5
## Regular 109 13
#Chi-Square Test
chisq.test(table_vitamin_gender)
##
## Pearson's Chi-squared test
##
## data: table_vitamin_gender
## X-squared = 11.071, df = 2, p-value = 0.003944
P-value p-value ≈ 0.003
###Conclusion Because the p-value is less than 0.05, we reject the null hypothesis. There is a significant association between gender and vitamin use, indicating that males and females differ in vitamin consumption behavior.
##Problem 3: One-Way ANOVA (Gill Rate and Calcium Level) Research Question Does the mean gill beat rate differ based on calcium level in water?
###Hypotheses Null hypothesis (H₀): Mean gill rate is the same for all calcium levels.
###Alternative hypothesis (H₁): At least one calcium level has a different mean gill rate.
###Data Preparation
# Read data
fish <- read.csv("FishGills3.csv")
str(fish)
## 'data.frame': 90 obs. of 2 variables:
## $ Calcium : chr "Low" "Low" "Low" "Low" ...
## $ GillRate: int 55 63 78 85 65 98 68 84 44 87 ...
# Convert Calcium to factor
fish$Calcium <- as.factor(fish$Calcium)
# One-Way ANOVA
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
P-value p-value ≈ 0.012
###Conclusion Since the p-value is less than 0.05, we reject the null hypothesis. There is statistically significant evidence that the mean gill beat rate differs depending on the calcium level in the water.