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:

The proportion of the R allele and the X allele are both equal to 0.5

# 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₀?

Q3. Write your conclusion in plain English: p-value = 0.01276

The null hypothesis would be rejected since the proportion of the R allele and the X allele are not equal to 0.5

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("NutritionStudy.csv")

dim(nutrition)
## [1] 315  17
head(nutrition)
##   ID Age Smoke Quetelet Vitamin Calories  Fat Fiber Alcohol Cholesterol
## 1  1  64    No  21.4838       1   1298.8 57.0   6.3     0.0       170.3
## 2  2  76    No  23.8763       1   1032.5 50.1  15.8     0.0        75.8
## 3  3  38    No  20.0108       2   2372.3 83.6  19.1    14.1       257.9
## 4  4  40    No  25.1406       3   2449.5 97.5  26.5     0.5       332.6
## 5  5  72    No  20.9850       1   1952.1 82.6  16.2     0.0       170.8
## 6  6  40    No  27.5214       3   1366.9 56.0   9.6     1.3       154.6
##   BetaDiet RetinolDiet BetaPlasma RetinolPlasma    Sex VitaminUse PriorSmoke
## 1     1945         890        200           915 Female    Regular          2
## 2     2653         451        124           727 Female    Regular          1
## 3     6321         660        328           721 Female Occasional          2
## 4     1061         864        153           615 Female         No          2
## 5     2863        1209         92           799 Female    Regular          1
## 6     1729        1439        148           654 Female         No          2

State your hypotheses:

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


table(nutrition$Vitamin, nutrition$Sex)              
##    
##     Female Male
##   1    109   13
##   2     77    5
##   3     87   24
# Q5. Run a chi-square test of independence on that table.
chisq.test(nutrition$Vitamin, nutrition$Sex)
## 
##  Pearson's Chi-squared test
## 
## data:  nutrition$Vitamin and 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?

Q7. Write your conclusion in plain English: The p-value is p-value = 0.003944; therefore, we would not accept the Null Hypothesis —

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("FishGills3.csv")

State your hypotheses:

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

aov(GillRate ~ Calcium, data = fish)
## Call:
##    aov(formula = GillRate ~ Calcium, data = fish)
## 
## Terms:
##                   Calcium Residuals
## Sum of Squares   2037.222 19064.333
## Deg. of Freedom         2        87
## 
## Residual standard error: 14.80305
## Estimated effects may be unbalanced
# Q9. Use summary() on the result. What is the F statistic and p-value?
summary(aov(GillRate ~ Calcium, data = fish))
##             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₀?

Q11. Write your conclusion in plain English: No we will not reject the Null Hypothesis