Problem 1

ACTN3 is a gene that encodes alpha-actinin-3, a protein in fast-twitch muscle fibers, important for activities like sprinting and weightlifting. The gene has two main alleles: R (functional) and X (non-functional). The R allele is linked to better performance in strength, speed, and power sports, while the X allele is associated with endurance due to a greater reliance on slow-twitch fibers. However, athletic performance is influenced by various factors, including training, environment, and other genes, making the ACTN3 genotype just one contributing factor. A study examines the ACTN3 genetic alleles R and X, also associated with fast-twitch muscles. Of the 436 people in this sample, 244 were classified as R, and 192 were classified as X. Does the sample provide evidence that the two options are not equally likely? Conduct the test using a chi-square goodness-of-fit test.

#Observed countts
observed <- c(R = 244, X = 192)

Hypotheses

\(H_0\): The alleles R and X are equally likely in the population. \(p_1\) = 0.5, \(p_2\) = 0.5 \(H_a\): The alleles R and X are not equally likely in the population

#Expexted proportions
expected <- c(0.5, 0.5)

Test

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

Conclusion P-value = 0.01276 Since the p-value is less than 0.05, we reject the null hypothesis. There is enough evidence that shows that the two alleles R and X , are not equally likely in the population.

Problem 2

Who Is More Likely to Take Vitamins: Males or Females? The dataset NutritionStudy contains, among other things, information about vitamin use and the gender of the participants. Is there a significant association between these two variables? Use the variables VitaminUse and Gender to conduct a chi-square analysis and give the results. (Test for Association)

getwd()
## [1] "C:/Users/leyla/Documents/DATA 101"
NutritionStudy <- read.csv("NutritionStudy.csv")
head(NutritionStudy)
##   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

Hypotesis

\(H_0\): VitaminUse and Gender are independent \(H_a\): VitaminUse and Gender are not independent

#Table of VitaminUse by Sex
data_table <- table(NutritionStudy$VitaminUse, NutritionStudy$Sex)
data_table
##             
##              Female Male
##   No             87   24
##   Occasional     77    5
##   Regular       109   13

Test

#Chi square Test
tresult <- chisq.test(data_table)
tresult
## 
##  Pearson's Chi-squared test
## 
## data:  data_table
## X-squared = 11.071, df = 2, p-value = 0.003944

Conclusion

p-value = 0.003944 Since the p-value is less than 0.05, we reject the null. There is evidence of an association between gender and vitamin use in this study, meaning that it appears that Vitamin use depends on whether the participant is male or female.

Problem 3

Most fish use gills for respiration in water, and researchers can observe how fast a fish’s gill cover beats to study ventilation, much like we might observe a person’s breathing rate. Professor Brad Baldwin is interested in how water chemistry might affect gill beat rates. In one experiment, he randomly assigned fish to tanks with different calcium levels. One tank was low in calcium (0.71 mg/L), the second tank had a medium amount (5.24 mg/L), and the third tank had water with a high calcium level (18.24 mg/L). His research team counted gill rates (beats per minute) for samples of 30 fish in each tank. The results are stored in FishGills3. Perform ANOVA test to see if the mean gill rate differs depending on the calcium level of the water.

FishGills3 <- read.csv("FishGills3.csv")
head(FishGills3)
##   Calcium GillRate
## 1     Low       55
## 2     Low       63
## 3     Low       78
## 4     Low       85
## 5     Low       65
## 6     Low       98
#Convertng Calcium as a factor
FishGills3$Calcium <- as.factor(FishGills3$Calcium)
class(FishGills3$Calcium)
## [1] "factor"

Hypothesis

\(H_o\): \(mu_1\) = \(mu_2\) = \(mu_3\) \(H_A\): At least one mean gill differs

Where: \(mu_1\) = \(mu_2\) = \(mu_3\) are low, medium, and high calcium levels correspondingly.

Test

#Anova testing
test_result <- aov(GillRate ~ Calcium, data = FishGills3)
summary(test_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

Conclusion p-value = 0.0121 The p-value is less than 0.05, so we reject the null. Meaning that there is evidence that at least one calcium level leads to a different mean gill rate in the fish.

tapply(FishGills3$GillRate, FishGills3$Calcium, mean)
##     High      Low   Medium 
## 58.16667 68.50000 58.66667

In fact, the low Calcium group has a higher mean gill rate than the Medium and High groups which have similar means.