7.29: Chicken diet and weight, Part II Page 276
Casein is a common weight gain supplement for humans. Does it have an effect on chickens? Using data provided in Exercise 7.27, test the hypothesis that the average weight of chickens that were fed casein is different than the average weight of chickens that were fed soybean. If your hypothesis test yields a statistically significant result, discuss whether or not the higher average weight of chickens can be attributed to the casein diet. Assume that conditions for inference are satisfied.
mean_cas <- 323.58
sd_cas <- 64.43
n_cas <- 12
mean_soy <- 246.43
sd_soy <- 54.13
n_soy <- 14
# Calculate standard error
std_error <- sqrt( (sd_cas ^2 / n_cas) + (sd_soy ^2 / n_soy) )
# Calculate T statistic and degrees of freedom
t_statistic <- (mean_cas - mean_soy) / std_error
deg_freedom <- ifelse(n_cas < n_soy, n_cas - 1, n_soy - 1)
# Find p-value
p_value <- 2 * pt(t_statistic, deg_freedom, lower.tail = FALSE)
cat("The p-value is:", round(p_value, 3))
## The p-value is: 0.007
Does it have an effect on chickens?
Yes, the data strongly suggests an effect on chickens (in particular the largely different means).
Test the hypothesis that the average weight of chickens that were fed casein is different than the average weight of chickens that were fed soybean.
Null hypothesis: The average weight of chickens that were fed casein is equal to those fed soybeans Alternative hypothesis: The average weight of chickens that were fed casein is different than those fed soybeans
The p-value is .007, which is less than .05 and thus we must reject the null hypothesis.
Discuss whether or not the higher average weight of chickens can be attributed to the casein diet.
Given that this was a randomized experiment, yes the observed difference can be attributed to the diet (i.e.ย the independent variable).