Let \(p_R\) = proportion of R allele in the population
Let \(p_X\) = proportion of X allele in the population
\[H_0: p_R = p_X\] \[H_a: p_R \neq p_X\]
observed <- c(244, 192)
names(observed) <- c("R", "X")
expected <- c(218, 218)
chisq_test1 <- chisq.test(observed, p = c(0.5, 0.5))
print(chisq_test1)
##
## Chi-squared test for given probabilities
##
## data: observed
## X-squared = 6.2018, df = 1, p-value = 0.01276
Since the p-value (0.0128) is less than 0.05, we reject the null hypothesis.
There is sufficient evidence to conclude that the two ACTN3 alleles (R and X) are not equally likely in the population.
Let \(p_{male}\) = proportion of males who use vitamins regularly
Let \(p_{female}\) = proportion of females who use vitamins regularly
\[H_0: p_{male} = p_{female}\] \[H_a: p_{male} \neq p_{female}\]
nutrition <- read_csv("NutritionStudy.csv")
## Rows: 315 Columns: 17
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (3): Smoke, Sex, VitaminUse
## dbl (14): ID, Age, Quetelet, Vitamin, Calories, Fat, Fiber, Alcohol, Cholest...
##
## ℹ 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.
contingency_table <- table(nutrition$Sex, nutrition$VitaminUse)
print(contingency_table)
##
## No Occasional Regular
## Female 87 77 109
## Male 24 5 13
chisq_test2 <- chisq.test(contingency_table)
# Display results
print(chisq_test2)
##
## Pearson's Chi-squared test
##
## data: contingency_table
## X-squared = 11.071, df = 2, p-value = 0.003944
Since the p-value (0.0039) is less than 0.05, we reject the null hypothesis.
There is sufficient evidence to conclude that there is a significant association between vitamin use and gender. Males and females differ in their vitamin use patterns.
Let \(\mu_{low}\) = mean gill rate for low calcium level
Let \(\mu_{medium}\) = mean gill rate for medium calcium level
Let \(\mu_{high}\) = mean gill rate for high calcium level
\[H_0: \mu_{low} = \mu_{medium} = \mu_{high}\] \[H_a: \text{At least one mean differs from the others}\]
fish <- 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.
anova_model <- aov(GillRate ~ Calcium, data = fish)
anova_result <- summary(anova_model)
print(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
Since the p-value (0.0121) is less than 0.05, we reject the null hypothesis.
There is sufficient evidence to conclude that the mean gill rate differs significantly depending on the calcium level of the water. At least one calcium level produces a different mean gill rate than the others.