Chicken farming is a multi-billion dollar industry, and any methods that increase the growth rate of young chicks can reduce consumer costs while increasing company profits, possibly by millions of dollars. An experiment was conducted to measure and compare the effectiveness of various feed supplements on the growth rate of chickens. Newly hatched chicks were randomly allocated into six groups, and each group was given a different feed supplement. Below are some summary statistics from this data set along with box plots showing the distribution of weights by feed type.
Chickens that were fed linseed had normally distributed weight, whereas chickens that were fed horsebean had nearly normally distributed weights with a slight right skew.
linseed_mean <- 218.75 # Pulled from the chart
linseed_sd <- 52.24 # Pulled from the chart
linseed_n <- 12 # Pulled from the chart
horsebean_mean <- 160.20 # Pulled from the chart
horsebean_sd <- 38.63 # Pulled from the chart
horsebean_n <- 10 # Pulled from the chart
The best way to calculate this is a two-tailed p-test.
We get the difference of the means
\(\mu_{\delta linseed, horsebean} = \mu_{linseed} - \mu_{horsebean}\)
\(\mu_{\delta linseed, horsebean} = 218.75 - 160.20\)
\(\mu_{\delta linseed, horsebean} = 58.55\)
feed_mean_diff <- linseed_mean - horsebean_mean # Difference of the linseed and horsebean weight means
Then we get the degrees of freedom.
\(df = (n_{linseed} - 1) + (n_{horsebean} - 1)\)
\(df = (n_{linseed} + n_{horsebean}) - 2\)
\(df = (12 + 10) - 2\)
\(df = 22 - 2\)
\(df = 20\)
feed_degrees_of_freedom <- (linseed_n + horsebean_n) - 2 # subtracting one for each sample and adding the sample sizes
After this, we get the pooled variance
\(s_p^2 = \frac{(n_{linseed}-1)*s_{linseed}^2 + (n_{horsebean}-1)*s_{horsebean}^2}{df}\)
\(s_p^2 = \frac{(12-1)*(52.24)^2 + (10-1)*(38.63)^2}{20}\)
\(s_p^2 = \frac{(11*2729.018) + (9*1492.277)}{20}\)
\(s_p^2 = \frac{30019.2 + 13430.49}{20}\)
\(s_p^2 = \frac{43449.69}{20}\)
\(s_p^2 = 2172.485\)
feed_pooled_var <- (((linseed_sd)^2 * (linseed_n-1)) + ((horsebean_sd)^2 * (horsebean_n-1)))/ feed_degrees_of_freedom
And then the standard error of the difference
\(se_{\delta linseed, horsebean} = \sqrt{\frac{s_p^2}{n_{linseed}-1}+\frac{s_p^2}{n_{horsbean}-1}}\)
\(se_{\delta linseed, horsebean} = \sqrt{\frac{2172.485}{12-1}+\frac{2172.485}{10-1}}\)
\(se_{\delta linseed, horsebean} = \sqrt{\frac{2172.485}{11}+\frac{2172.485}{9}}\)
\(se_{\delta linseed, horsebean} = \sqrt{197.4987+241.3873}\)
\(se_{\delta linseed, horsebean} = \sqrt{438.8859}\)
\(se_{\delta linseed, horsebean} = 20.9496\)
feed_se_diff <- sqrt((feed_pooled_var/(linseed_n-1)) + (feed_pooled_var/(horsebean_n-1)))
We can use this information to get the t value.
\(t = \frac{\mu_{\delta linseed, horsebean}}{se_{\delta linseed, horsebean}}\)
\(t = \frac{58.55}{20.9496}\)
\(t = 2.794803\)
feed_t <- feed_mean_diff/feed_se_diff
Using this we’ll get the two-tailed p-value.
feed_p <- 2 * pt(abs(feed_t), df=feed_degrees_of_freedom, lower.tail=F)
0.05 > feed_p
## [1] TRUE
When compared to the alpha value of 0.05, even when the alpha value is halved, the p-value of 0.0111848 is still less. This means we can reject the null hypothesis and conclude that the average weights of chickens that were fed linseed and horsebean are different.
If we indeed committed an error, it would be a Type I error. Type I errors occur when we mistakenly reject the null hypothesis, which would imply that the average weights of chickens that were fed linseed and horsebean are not different.
0.01 > feed_p
## [1] FALSE
Yes, the conclusion would change. Even assuming the lack of halving the alpha value, we still can tell the p-value is greater. In this instance, the null hypothesis would be found to be true and could not be rejected.