hw8.docx - Code install.packages"gdata library(gdata...

Info icon This preview shows pages 1–2. Sign up to view the full content.

Code: install.packages("gdata") library(gdata) setwd("\\\\hd.ad.syr.edu/02/7b907f/Documents") #setting working directory getwd() tuna <- read.csv("mlr01.csv") tuna colnames(tuna) colnames(tuna) <- c("PopBabyAntelope", "PopAdultAntelope", "AnnualPrecipitation", "winterCondition") colnames(tuna) str(tuna) plot(tuna$PopAdultAntelope, tuna$PopBabyAntelope) #number of baby fawns versus adult antelope population plot(tuna$AnnualPrecipitation, tuna$PopBabyAntelope) #number of baby fawns versus the precipitation that year plot(tuna$winterCondition, tuna$PopBabyAntelope)#number of baby fawns versus the severity of the winter #I think the number of fawns should go on Y-Axis RegressionModel1 <- lm(formula = tuna$PopBabyAntelope ~ tuna$winterCondition) RegressionModel1 predict(RegressionModel1, tuna, type = "response") summary(RegressionModel1) #winter weather’s stats are significant RegressionModel2 <- lm(formula = tuna$PopBabyAntelope ~ tuna$PopAdultAntelope+tuna$winterCondition) RegressionModel2 #annual pr predict(RegressionModel2, tuna, type = "response") summary(RegressionModel2) #adult population is statistically significant RegressionModel3 <- lm(formula = tuna$PopBabyAntelope ~ tuna$PopAdultAntelope+tuna$AnnualPrecipitation+tuna$winterCondition) RegressionModel3 predict(RegressionModel3, tuna, type = "response") summary(RegressionModel3) #I think the third model will work the best because R squared multiple time is closest to 1 and all the three variables are stastistically important #I think all the three variables need to be considered to create a parsimonious model step(RegressionModel3, data= tuna, direction = "backward") parsimoniousModel <- lm(formula = tuna$PopBabyAntelope ~ tuna$PopAdultAntelope+tuna$AnnualPrecipitation+tuna$winterCondition) parsimoniousModel
Image of page 1

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

Image of page 2
This is the end of the preview. Sign up to access the rest of the document.
  • Winter '17
  • Saltz
  • Errors and residuals in statistics, setwd, #Adult, #annual, #setting, #winter

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    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.

    Student Picture

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

  • Left Quote Icon

    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.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    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.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern