Three problems — one chi-square goodness-of-fit, one chi-square test of independence, and one one-way ANOVA. Each one follows the same pattern: state hypotheses, run the test, interpret the result.


Problem 1 — Chi-Square Goodness of Fit (ACTN3 alleles)

ACTN3 is a gene that encodes alpha-actinin-3, a protein in fast-twitch muscle fibers. The gene has two main alleles: R (functional) and X (non-functional). The R allele is linked to better performance in strength/speed/power sports; the X allele is associated with endurance.

A study of 436 people classified 244 as R and 192 as X. Does this provide evidence that the two options are NOT equally likely?

State your hypotheses:

getwd()
## [1] "/Users/darrenabou/Desktop/Spring 26/Summer I/Data 101"
library(tidyverse)
## Warning: package 'ggplot2' was built under R version 4.5.2
## Warning: package 'tibble' was built under R version 4.5.2
## Warning: package 'tidyr' was built under R version 4.5.2
## Warning: package 'readr' was built under R version 4.5.2
## Warning: package 'purrr' was built under R version 4.5.2
## Warning: package 'dplyr' was built under R version 4.5.2
## Warning: package 'lubridate' was built under R version 4.5.2
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr     1.2.0     ✔ readr     2.1.6
## ✔ forcats   1.0.1     ✔ stringr   1.6.0
## ✔ ggplot2   4.0.2     ✔ tibble    3.3.1
## ✔ lubridate 1.9.5     ✔ tidyr     1.3.2
## ✔ purrr     1.2.1     
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag()    masks stats::lag()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
# Q1. Run a chi-square goodness-of-fit test.
#     (Hint: observed <- c(244, 192); chisq.test(observed))

 observed <- c(244, 192); chisq.test(observed)
## 
##  Chi-squared test for given probabilities
## 
## data:  observed
## X-squared = 6.2018, df = 1, p-value = 0.01276
# Q2. What is the p-value? At α = 0.05, do you reject H₀?
# p-value = 0.01276, Yes, reject H₀ at α = 0.05

Q3. Write your conclusion in plain English: There is sufficient evidence at the 5% significance level to conclude that the two ACTN3 alleles (R and X) are not equally likely in the population. —

Problem 2 — Chi-Square Test of Independence (Vitamin Use & Gender)

The NutritionStudy.csv dataset contains data on vitamin use (VitaminUse) and gender (Sex) for many participants. Is there a significant association between these two variables?

Download NutritionStudy.csv from the Datasets folder on Blackboard.

nutrition <- read_csv("~/Desktop/Spring 26/Summer I/Data 101/Datasets/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.

State your hypotheses:

# Q4. Build a contingency table of VitaminUse and Sex using table().

table(nutrition$VitaminUse, nutrition$Sex)
##             
##              Female Male
##   No             87   24
##   Occasional     77    5
##   Regular       109   13
# Q5. Run a chi-square test of independence on that table.
chisq.test(table(nutrition$VitaminUse, nutrition$Sex))
## 
##  Pearson's Chi-squared test
## 
## data:  table(nutrition$VitaminUse, nutrition$Sex)
## X-squared = 11.071, df = 2, p-value = 0.003944
# Q6. What is the p-value? Do you reject H₀ at α = 0.05?
# p-value = 0.003944, Yes, reject H₀ at α = 0.05.

Q7. Write your conclusion in plain English: There is a statistically significant association between VitaminUse and Sex. The way people use vitamins is related to their gender. —

Problem 3 — One-Way ANOVA (Fish Gills)

Researchers wanted to know how water chemistry affects fish ventilation. Fish were randomly assigned to one of three tanks with different calcium levels:

The team counted gill rates (beats per minute) for 30 fish in each tank. The data is in FishGills3.csv.

Download FishGills3.csv from the Datasets folder on Blackboard.

fish <- read_csv('/Users/darrenabou/Desktop/Spring 26/Summer I/Data 101/Datasets/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.

State your hypotheses:

# Q8. Run a one-way ANOVA testing GillRate by Calcium.
#     (Hint: aov(GillRate ~ Calcium, data = fish))
 model <- aov(GillRate ~ Calcium, data = fish)

# Q9. Use summary() on the result. What is the F statistic and p-value?
summary(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
# Q10. At α = 0.05, do you reject H₀?
# Yes, reject H₀ at α = 0.05

Q11. Write your conclusion in plain English:

There is sufficient evidence at the 5% significance level to conclude that the mean gill rate differs across at least one of the calcium concentration levels (Low, Medium, High).