{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

hw4sol

# hw4sol - STAT 4220 HW4 Solution 1 Problem 1(a See the...

This preview shows pages 1–3. Sign up to view the full content.

STAT 4220 HW4 Solution 1 Problem 1 (a) See the appendix for R code. Fitting the model yields the following output: > summary(g) Call: lm(formula = y ˜ factor(x)) Residuals: Min 1Q Median 3Q Max -2.64889 -0.44889 -0.04889 0.55111 2.15111 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 22.2989 0.1355 164.515 < 2e-16 *** factor(x)2 0.7911 0.2711 2.918 0.00424 ** factor(x)3 0.8225 0.2783 2.956 0.00379 ** factor(x)4 0.2761 0.2647 1.043 0.29903 factor(x)5 0.6044 0.2711 2.230 0.02773 * factor(x)6 -1.1689 0.2711 -4.312 3.46e-05 *** --- Signif. codes: 0 *** 0.001 ** 0.01 * 0.05 . 0.1 1 Residual standard error: 0.9093 on 114 degrees of freedom Multiple R-squared: 0.313, Adjusted R-squared: 0.2829 F-statistic: 10.39 on 5 and 114 DF, p-value: 3.152e-08 > summary.aov(g) Df Sum Sq Mean Sq F value Pr(>F) factor(x) 5 42.940 8.5879 10.388 3.152e-08 *** Residuals 114 94.248 0.8267 --- Signif. codes: 0 *** 0.001 ** 0.01 * 0.05 . 0.1 1 From the ANOVA table, we see that with p ¿ . 0001, the type of bird is very significant in determining the length of the cuckoo eggs. (b) The residual plot is generated with the following code: > plot(x,g\$res,xlab="Cuckoo",ylab="Residuals",pch=20,col=3, main="Plot of residual versus factor levels",xaxt="n") > mtext(paste("MDWP"),side=1,at=1) > mtext(paste("TRP"),side=1,at=2) > mtext(paste("HGSPRW"),side=1,at=3) > mtext(paste("RBN"),side=1,at=4) > mtext(paste("PWGTL"),side=1,at=5) > mtext(paste("WREN"),side=1,at=6) 1

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
-2 -1 0 1 2 Plot of residual versus factor levels Cuckoo Residuals MDWP TRP HGSPRW RBN PWGTL WREN (c) For the most part, the spread of the residuals seems to be fairly even across factor levels. We may have slightly smaller variance at the RBN and WREN factor levels, but it is negligible for our purposes. Deciding whether the assumption of constant variance holds based on these plots is always subjective. (d) The boxplot is generated with the following: plot(x,g\$res,xlab="Cuckoo",ylab="Residuals",pch=20,col=3, main="Plot of residual versus factor levels",xaxt="n") mtext(paste("MDWP"),side=1,at=1) mtext(paste("TRP"),side=1,at=2) mtext(paste("HGSPRW"),side=1,at=3) mtext(paste("RBN"),side=1,at=4)
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern