NutritionStudy <- read.csv("/Users/ShelsyChouakong/Downloads/NutritionStudy.csv")
str(NutritionStudy)
## 'data.frame': 315 obs. of 17 variables:
## $ ID : int 1 2 3 4 5 6 7 8 9 10 ...
## $ Age : int 64 76 38 40 72 40 65 58 35 55 ...
## $ Smoke : chr "No" "No" "No" "No" ...
## $ Quetelet : num 21.5 23.9 20 25.1 21 ...
## $ Vitamin : int 1 1 2 3 1 3 2 1 3 3 ...
## $ Calories : num 1299 1032 2372 2450 1952 ...
## $ Fat : num 57 50.1 83.6 97.5 82.6 56 52 63.4 57.8 39.6 ...
## $ Fiber : num 6.3 15.8 19.1 26.5 16.2 9.6 28.7 10.9 20.3 15.5 ...
## $ Alcohol : num 0 0 14.1 0.5 0 1.3 0 0 0.6 0 ...
## $ Cholesterol : num 170.3 75.8 257.9 332.6 170.8 ...
## $ BetaDiet : int 1945 2653 6321 1061 2863 1729 5371 823 2895 3307 ...
## $ RetinolDiet : int 890 451 660 864 1209 1439 802 2571 944 493 ...
## $ BetaPlasma : int 200 124 328 153 92 148 258 64 218 81 ...
## $ RetinolPlasma: int 915 727 721 615 799 654 834 825 517 562 ...
## $ Sex : chr "Female" "Female" "Female" "Female" ...
## $ VitaminUse : chr "Regular" "Regular" "Occasional" "No" ...
## $ PriorSmoke : int 2 1 2 2 1 2 1 1 1 2 ...
table(NutritionStudy$Sex, NutritionStudy$VitaminUse)
##
## No Occasional Regular
## Female 87 77 109
## Male 24 5 13
chisq.test(NutritionStudy$Sex, NutritionStudy$VitaminUse)
##
## Pearson's Chi-squared test
##
## data: NutritionStudy$Sex and NutritionStudy$VitaminUse
## X-squared = 11.071, df = 2, p-value = 0.003944
observed <-c(244,192)
chisq.test(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
For the null hypothesis, I think the R and X alleles are equally likely in the population to each other but in the alternative hypothesis they aren’t equally likely. The p-value is 0.0127.The null hypothesis is not correct due to the fact that the p-value is less than the significance level. With the information this means that the ACTN3 R and X alleles arent equally likely.
#getwd()
#NutritionStudy <-read.csv("NutritionStudy.csv")
str(NutritionStudy)
## 'data.frame': 315 obs. of 17 variables:
## $ ID : int 1 2 3 4 5 6 7 8 9 10 ...
## $ Age : int 64 76 38 40 72 40 65 58 35 55 ...
## $ Smoke : chr "No" "No" "No" "No" ...
## $ Quetelet : num 21.5 23.9 20 25.1 21 ...
## $ Vitamin : int 1 1 2 3 1 3 2 1 3 3 ...
## $ Calories : num 1299 1032 2372 2450 1952 ...
## $ Fat : num 57 50.1 83.6 97.5 82.6 56 52 63.4 57.8 39.6 ...
## $ Fiber : num 6.3 15.8 19.1 26.5 16.2 9.6 28.7 10.9 20.3 15.5 ...
## $ Alcohol : num 0 0 14.1 0.5 0 1.3 0 0 0.6 0 ...
## $ Cholesterol : num 170.3 75.8 257.9 332.6 170.8 ...
## $ BetaDiet : int 1945 2653 6321 1061 2863 1729 5371 823 2895 3307 ...
## $ RetinolDiet : int 890 451 660 864 1209 1439 802 2571 944 493 ...
## $ BetaPlasma : int 200 124 328 153 92 148 258 64 218 81 ...
## $ RetinolPlasma: int 915 727 721 615 799 654 834 825 517 562 ...
## $ Sex : chr "Female" "Female" "Female" "Female" ...
## $ VitaminUse : chr "Regular" "Regular" "Occasional" "No" ...
## $ PriorSmoke : int 2 1 2 2 1 2 1 1 1 2 ...
table(NutritionStudy$Sex, NutritionStudy$VitaminUse)
##
## No Occasional Regular
## Female 87 77 109
## Male 24 5 13
chisq.test(NutritionStudy$Sex, NutritionStudy$VitaminUse)
##
## Pearson's Chi-squared test
##
## data: NutritionStudy$Sex and NutritionStudy$VitaminUse
## X-squared = 11.071, df = 2, p-value = 0.003944
-With the null hypothesis there is not a correlation between the genders and vitamin’s they use but with the alternative hypothesis there is a correlation between the two. The p-value found is 0.003944 and since the p-value is less than the significant value then this shows support to the alternative hypothesis since there is proof that the data between gender and vitamin usage correlates.
#Question 3
#data(NutritionStudy)
FishGills3 <- read.csv("/Users/ShelsyChouakong/Downloads/FishGills3.csv")
str(FishGills3)
## '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 ...
anova_result <- aov(GillRate ~ Calcium, data = FishGills3)
summary(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
-With the null hypothesis it supports that the grill rate mean is the same as the calcium level where as the alternative hypothesis supports that the mean grill rate doesn’t match the calcium level.The p-value is 0.0121 and since this number is smaller than the significance level then the null hypothesis is wrong since this shows that the mean grill rate is different to the calcium level.