Hypothesis:
observed <- c(244, 192)
theoretical <- c(1/2, 1/2)
\(H_0\):\(p_1\) = \(p_2\) = 1/2
\(H_a\): at least one \(p_i\) \(\neq\) 1/2
P-Value:
expected <- theoretical * sum(observed)
expected
## [1] 218 218
All are greater than 5.
chisq.test(observed, p = theoretical)
##
## Chi-squared test for given probabilities
##
## data: observed
## X-squared = 6.2018, df = 1, p-value = 0.01276
p-value = 0.01276
Conclusion: With a p-value of 0.01276, which is less than the typical significance level of 0.05, there is sufficient evidence to reject the null hypothesis.
Therefore, we can conclude that R and X alleles are not equally likely.
nutrition_study <- read.csv("NutritionStudy.csv")
head(nutrition_study)
## 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
Hypothesis:
\(H_0\) : Vitamin usage is not
associated with gender.
\(H_a\) : Vitamin usage is associated
with gender.
P-Value:
observed_dataset <- table(nutrition_study$Sex, nutrition_study$VitaminUse)
observed_dataset
##
## No Occasional Regular
## Female 87 77 109
## Male 24 5 13
chisq.test(observed_dataset)
##
## Pearson's Chi-squared test
##
## data: observed_dataset
## X-squared = 11.071, df = 2, p-value = 0.003944
p-value: 0.003944
Conclusion: With the p-value being 0.003944 which is less than the the typical significance level of 0.05, there is sufficient evidence to reject the null hypothesis.
Therefore, it can be concluded that there is evidence of a significant association between gender and vitamin usage.
fish_gills <- read.csv("FishGills3.csv")
head(fish_gills)
## Calcium GillRate
## 1 Low 55
## 2 Low 63
## 3 Low 78
## 4 Low 85
## 5 Low 65
## 6 Low 98
Hypothesis:
\(H_0\): \(\mu_A\) = \(\mu_B\) = \(\mu_C\)
\(H_a\): not all \(\mu_i\) are equal
P-Value:
anova_result <- aov(GillRate ~ Calcium, data = fish_gills)
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
TukeyHSD(anova_result)
## Tukey multiple comparisons of means
## 95% family-wise confidence level
##
## Fit: aov(formula = GillRate ~ Calcium, data = fish_gills)
##
## $Calcium
## diff lwr upr p adj
## Low-High 10.333333 1.219540 19.4471264 0.0222533
## Medium-High 0.500000 -8.613793 9.6137931 0.9906108
## Medium-Low -9.833333 -18.947126 -0.7195402 0.0313247
P-value: 0.0121
Conclusion: With the p-value of 0.0121 being less than the typical significance level of 0.05, there is sufficient evidence to reject the null hypothesis.
Therefore, the test suggests that the mean gill rate does differ depending on the calcium level of the water.
The most significant difference is between low-high and medium-low because the p-adj is less than 0.05.