Answr 1

observed <- c(244,292)

prop<-rep(1/2, 2)

\(H_0\):\(p_1\) = \(p_2\) = 1/2 \(H_a\): \(p_1\) \(\neq\) \(p_2\)

expected<- prop*sum(observed)


chisq.test(observed)
## 
##  Chi-squared test for given probabilities
## 
## data:  observed
## X-squared = 4.2985, df = 1, p-value = 0.03815

With a p-value lower than .05, there are enough evidence to support distinction within the two proportions.

Answer 2

data<-read.csv("NutritionStudy.csv")

obs_val<-table(data$Sex,data$VitaminUse)
obs_val
##         
##           No Occasional Regular
##   Female  87         77     109
##   Male    24          5      13

\(H_0\) : Vitamin use is not associated with sex \(H_a\) : Vitamin use is associated with which sex

chisq.test(obs_val)
## 
##  Pearson's Chi-squared test
## 
## data:  obs_val
## X-squared = 11.071, df = 2, p-value = 0.003944

The p-value, p = .003, is lower than .05, the usual significance level. As a result, we can conclude that vitamin use is associated with gender.

Answer 3

\(H_0\) : Average gill rate does not differ depending on the calcium level \(H_a\) : Average gill rate differs depending on the calcium level

df<- read.csv("FishGills3.csv")


result<- aov(df$GillRate~df$Calcium, data=df)
result
## Call:
##    aov(formula = df$GillRate ~ df$Calcium, data = df)
## 
## Terms:
##                 df$Calcium Residuals
## Sum of Squares    2037.222 19064.333
## Deg. of Freedom          2        87
## 
## Residual standard error: 14.80305
## Estimated effects may be unbalanced
summary(result)
##             Df Sum Sq Mean Sq F value Pr(>F)  
## df$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

The P-value, 0.0121, suggests that the mean gill rate differs depending on the calcium level.