Homework4 STAT 425 - setwd/Users/Bcollender/STAT 425...

This preview shows page 1 out of 1 page.

setwd("/Users/Bcollender/STAT 425") getwd() #question 1 Data1 <- read.table("advertspend.dat", header=TRUE) Model1 <- lm(MILIMP~log(SPEND), data = Data1) par(mfrow = c(2,2)) plot(Model1, add.smooth=FALSE) library(MASS) boxcox(Model1) bcmod <- boxcox(Model1, plotit = FALSE) bcmod$x[which.max(bcmod$y)] #question 2 Data2 <- read.table("destroyers.dat", header = TRUE) origModel2 <- lm(Displacement~Length+Beam+Draft, data = Data2) Model2 <- lm(log(Displacement)~log(Length)+log(Beam)+log(Draft), data = Data2) par(mfrow = c(2,2)) plot(Model2, add.smooth=FALSE) summary(Model2) point <- data.frame(Length=500, Beam = 69.5, Draft = 24) predict(Model2, point, interval = "prediction") exp(predict(Model2, point, interval = "prediction")) confint(Model2) #question 3 library(faraway) help(seatpos)

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture