Question: using the following code please answer the 4 questions below library(knitr) library(tidyverse) library(corrplot) library(broom) # because I find it useful cbPalette

using the following code please answer the 4 questions below

library(knitr) library(tidyverse) library(corrplot) library(broom) # because I find it useful cbPalette <- c("#999999", "#E69F00", "#56B4E9", "#009E73", "#F0E442", "#0072B2", "#D55E00", "#CC79A7")

options(scipen = 4) # make output prefer not to use scientific notation bikes <- read.csv("http://www.andrew.cmu.edu/user/achoulde/95791/data/bikes.csv", header = TRUE)

# Transform temp and atemp to degrees C instead of [0,1] scale # Transform humidity to % # Transform wind speed (multiply by 67, the normalizing value)

bikes <- mutate(bikes, temp = 47 * temp - 8, atemp = 66 * atemp - 16, hum = 100 * hum, windspeed = 67 * windspeed)

# The recode() command from the dplyr library allows us to easily # rename values in our variables. Below we use this command to change season # from numeric codings to season names.

bikes <- mutate(bikes, season = recode(season, `1`="Winter",`2`="Spring", `3`="Summer", `4`="Fall")) qplot(data = bikes, x = season, y = cnt, fill = I(cbPalette[3]), geom = "boxplot") bikes <- mutate(bikes, season = factor(season, levels = c("Winter", "Spring", "Summer", "Fall"))) qplot(data = bikes, x = season, y = cnt, fill = I(cbPalette[3]), geom = "boxplot")

model1 <- lm(cnt ~ season, data = bikes) model2 <- lm(cnt ~ temp + atemp +mnth + hum + windspeed, data = bikes)

Please answer the 4 questions below:

Dealing with collinearity

(a) Use thepairs() function on the set of variables used in Problem 2 to check if any of the predictor variables are highly correlated with one another. Your pairs plot should have scatterplots above the diagonal, and correlations below the diagonal.

  • enter code here:

(b) Are any of the predictors highly correlated? Are you surprised that these predictors are highly correlated, or can you think of a reason for why it makes sense that they should be correlated?

  • Your answer here.

(c) Refit your regression model, but this time omit thetemp variable. Display the coefficients table for this model.

  • enter code here:

(d) What is the coefficient ofatemp in this new model? Is it very different from theatemp coefficient estimated in part (b)? Is it statistically significant? Explain your findings.

  • Your answer here.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Mathematics Questions!