# Chicken Weights by Feed Type ####
# An experiment was conducted to measure and compare the effectiveness
# of various feed supplements on the growth rate of chickens.
data("chickwts")
summary(chickwts)## weight feed
## Min. :108.0 casein :12
## 1st Qu.:204.5 horsebean:10
## Median :258.0 linseed :12
## Mean :261.3 meatmeal :11
## 3rd Qu.:323.5 soybean :14
## Max. :423.0 sunflower:12
boxplot(chickwts) #boxplot of dataqqnorm(chickwts$weight) #qq plots of data
qqline(chickwts$weight)plot(chickwts$weight~chickwts$feed) #more detailed boxplot of dataThe data is mostly normal based on what I saw from the qqplots and how close the data was to 1:1 line, and it does have homogenity of variance because the data in the Residuals vs Fitted data is good and almost has the shape of the rectangle.
qqnorm(chickwts$weight) #qq plot of our data
qqline(chickwts$weight)chickwts.aov <- aov(weight ~ feed, data = chickwts)
plot(chickwts.aov) #used this plot to determine homogenityplot(chickwts$weight~chickwts$feed) #detailed boxplot of our dataNo, I did not need to transform my data because it was normal and had equal variance so it was ready to run in ANOVA.
I reject my null hypothesis because my results were statistically different. My null hypothesis was that the means were equal, which they were not.
summary(chickwts.aov)## Df Sum Sq Mean Sq F value Pr(>F)
## feed 5 231129 46226 15.37 5.94e-10 ***
## Residuals 65 195556 3009
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Yes I performed a multiple comparison test to see which means specifally differenent. I did this because my pvalue was significantly different.
TukeyHSD(chickwts.aov)## Tukey multiple comparisons of means
## 95% family-wise confidence level
##
## Fit: aov(formula = weight ~ feed, data = chickwts)
##
## $feed
## diff lwr upr p adj
## horsebean-casein -163.383333 -232.346876 -94.41979 0.0000000
## linseed-casein -104.833333 -170.587491 -39.07918 0.0002100
## meatmeal-casein -46.674242 -113.906207 20.55772 0.3324584
## soybean-casein -77.154762 -140.517054 -13.79247 0.0083653
## sunflower-casein 5.333333 -60.420825 71.08749 0.9998902
## linseed-horsebean 58.550000 -10.413543 127.51354 0.1413329
## meatmeal-horsebean 116.709091 46.335105 187.08308 0.0001062
## soybean-horsebean 86.228571 19.541684 152.91546 0.0042167
## sunflower-horsebean 168.716667 99.753124 237.68021 0.0000000
## meatmeal-linseed 58.159091 -9.072873 125.39106 0.1276965
## soybean-linseed 27.678571 -35.683721 91.04086 0.7932853
## sunflower-linseed 110.166667 44.412509 175.92082 0.0000884
## soybean-meatmeal -30.480519 -95.375109 34.41407 0.7391356
## sunflower-meatmeal 52.007576 -15.224388 119.23954 0.2206962
## sunflower-soybean 82.488095 19.125803 145.85039 0.0038845
The chicken feed weights are significantly different when predicted by the ANOVA test because the p-value was 5.94e-10 which means that I rejected the null hypothesis stating that all means are equal. A Tukey HSD multiple comparision test assessed whether statistical differences occur between different weights of feed. The compared means that were significantly different were horsebean-casein(p=0.001), linseed-casein(p=0.001), soybean-casein(p=0.008), lineseed-horsebean(p=0.141), meatmeal-horsebean(p=0.001), soybean-horsebean, sunflower-horsebean, meatmeal-linseed, sunflower-horsebean(p=0.004), meatmeal-linseed(p=0.127), sunflower-linseed(p=0.001), sunflower-meatmeal(p=0.220) sunflower-soybean(p=0.003).
Please turn–in your homework via Sakai by saving and submitting an R Markdown PDF or HTML file from R Pubs!