# C Here are the diagnostic plots for the model in b &gt;...

• Homework Help
• 13
• 100% (50) 50 out of 50 people found this document helpful

This preview shows page 1 - 4 out of 13 pages.

1 STAT 425, Spring 2015 Homework 6 Solution 1. a) First we fit the full interaction model: > library(faraway) > attach(butterfat) > ?butterfat > mod=lm(Butterfat~Breed*Age) > anova(mod) Analysis of Variance Table Response: Butterfat Df Sum Sq Mean Sq F value Pr(>F) Breed 4 34.321 8.5803 49.5651 <2e-16 *** Age 1 0.274 0.2735 1.5801 0.2120 Breed:Age 4 0.514 0.1285 0.7421 0.5658 Residuals 90 15.580 0.1731 After checking the data, the design is balanced. So the F test for Breed:Age in the table is the appropriate test for interaction. The p-value for interaction part is large, much bigger than 0.05 indicating there may be no interaction effect. b) Since the interaction is not significant use the additive model to test the two factors: > mod2=lm(Butterfat~Breed+Age) > anova(mod2) Analysis of Variance Table Response: Butterfat Df Sum Sq Mean Sq F value Pr(>F) Breed 4 34.321 8.5803 50.1150 <2e-16 *** Age 1 0.274 0.2735 1.5976 0.2094 Residuals 94 16.094 0.1712 Breed has a significant difference (p<<.01) but Age is not statistically significant.
2 c) Here are the diagnostic plots for the model in b) > par(mfrow=c(2,2)) > plot(mod2) Based on the four diagnostic plots, there is no obvious problem for the assumptions and the model appears adequate.
3 d) First examine the estimated coefficients to order the breeds: > summary(mod2) Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 4.00770 0.10135 39.541 < 2e-16 *** BreedCanadian 0.37850 0.13085 2.893 0.00475 ** BreedGuernsey 0.89000 0.13085 6.802 9.48e-10 *** BreedHolstein-Fresian -0.39050 0.13085 -2.984 0.00362 ** BreedJersey 1.23250 0.13085 9.419 3.16e-15 *** AgeMature 0.10460 0.08276 1.264 0.20937 Based on the main effect coefficients the best Breed is Jersey and the second best is Guernsey. To determine if they are significantly different we use Tukey’s adjustment for multiple comparisons as follows > Tukey=TukeyHSD(aov(Butterfat~Breed+Age))\$Breed > Tukey Tukey multiple comparisons of means 95% family-wise confidence level Fit: aov(formula = Butterfat ~ Breed + Age) \$Breed diff lwr upr p adj Canadian-Ayrshire 0.3785 0.0145538 0.7424462 0.0373310 Guernsey-Ayrshire 0.8900 0.5260538 1.2539462 0.0000000 Holstein-Fresian-Ayrshire -0.3905 -0.7544462 -0.0265538 0.0290906