STAT425_HW#5_Yilun Luo.Rmd - -title"STAT425 HW#5 Yilun Luo...

This preview shows page 1 - 2 out of 3 pages.

---title: "STAT425 HW#5 Yilun Luo"author: "Yilun Luo"date: "November 3, 2016"output: word_document---### 1#### part(a)```{r}ds = read.table("destroyers.dat");fit1 = lm(log(Displacement) ~ Length+Beam, data = ds)summary(fit1)```#### part(b)```{r}fit2 = lm(log(Displacement) ~ Length+Beam+I(Length^2)+I(Beam^2)+I(Length*Beam),data = ds)summary(fit2)```#### part(c)From the output above, Beam and Length*Beam are terms that appear to be significant at the 0.05 level.This does not mean that all of the other terms can be removed.#### part(d)```{r}anova(fit1,fit2)```According to the ANOVA table, p-value is 8.388e-08 < ??=0.05 which indicates that full model is preferred.#### part(e)```{r}drop1(fit2,test ="F")``````{r}fit2 = update(fit2, .~.-Length)drop1(fit2,test ="F")```Stop here because the F-value is bigger than 3. Therefore the model obtained by backward elimination is log(Displacement) ~ Beam + I(Length^2) + I(Beam^2) + I(Length * Beam)```{r}summary(fit2)```### 2#### part(a)```{r}fit3 <- lm(weight~feed, data = chickwts)summary(fit3)```#### part(b)```{r}par(mfrow=c(2,2))plot(fit3)```Accoding to these four plots, the assumed mean function is appropriate and the constance variance seems to be satisfied.

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture