Question

Install and load the dataset named Carseats (in the ISLR package) into R. Obtain the residual...

Install and load the dataset named Carseats (in the ISLR package) into R.
Obtain the residual plots vs the predicted values of the model.
Can you see a pattern in the plots ? do we need to transform the predicted values ?


Homework Answers

Answer #1

R-codes :

library(ISLR)
data("Carseats")

csData=Carseats
str(csData)

lmModel<-lm(Sales~.,data = csData)


plot(lmModel,1)

plot(lmModel,3)

Plot-1:

Plot-2:

Conclusion:

After studying above Plot-1 and Plot-2, we observe there is no pattern and Red line is almost horizontal.

Hence, no need to transform the predicted values.

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
(1) Write R code to install the package named "MASS" only if the package is not...
(1) Write R code to install the package named "MASS" only if the package is not already installed on the machine. Then attach that package to your current workspace to use it in your programming. Your code below (2) Write R code to find what datasets are available only for the MASS package by creating a file named "R data sets". Your code below (3) Write R code to bring up the documentation page for the "Boston" dataset. Your code...
Use the following commands to install the `marketing` dataset and load the `datarium` package into your...
Use the following commands to install the `marketing` dataset and load the `datarium` package into your session. ```{r} #install.packages("datarium") library(datarium) data("marketing", package = "datarium") str(marketing) Use the regression line to predict the `Sales` amount when `newspaper` budget is `$136.80K` and `facebook` is `$43.92K`. This should be done in Rstudio 3.6.1
r code Load the “star” data from the “faraway” package, and model “temp” using “light”. library(faraway)...
r code Load the “star” data from the “faraway” package, and model “temp” using “light”. library(faraway) data(star) fit = lm(temp ~ light, data = star) One may also suspect that the residuals (use all the data) follow a t distribution instead of normal. Using the same logic that we produced the QQ plot for comparing to the normal distribution, produce a QQ plot for comparing to a t distribution. You need to decide the degrees of freedom yourself (consider df...
n this CT assignment, we will use R software to analyze a dataset GoogleAmazonStock.xlsx. It contains...
n this CT assignment, we will use R software to analyze a dataset GoogleAmazonStock.xlsx. It contains daily closing stock prices for Google and Amazon from 8/22/2017 to 8/22/2018. When we examine stock prices (or other financial assets) we often transform them into a (simple) return series. The return series are computed by the formula: (present price/past price) - 1. The dataset contains both stock prices and return series. 1. Using R, construct time series (line) plots for both stock prices...
Imagine you fit a regression model to a dataset and find that R‐squared = 0.69. Is...
Imagine you fit a regression model to a dataset and find that R‐squared = 0.69. Is this a good regression model or not? If you cannot tell, what additional information do you need? Explain. Research and then explain the “regression fallacy”. Provide at least one example.
Built in Data In R: This Question uses "cystfibr" data found in "ISwR" package. to access...
Built in Data In R: This Question uses "cystfibr" data found in "ISwR" package. to access this data you need to first install "ISwR" package. then load the library. Type data() to check which built in data are in the package "ISwR". This should show all the available built in data as: We use nickel data for this part. Type >cystfibr to see the data, and then answer the following questions using the data: (a) type ?cystfibr this will open...
Using the data Anscombe, included in the car package, perform a regression to examine whether the...
Using the data Anscombe, included in the car package, perform a regression to examine whether the number of people living in an urban area have an effect on income. Remember to provide the code for everything. Hint: load data from the package with the following command A<-Anscombe you’re going to need the car package install.packages(“car”) library(car) income = y urban = x obs: this is not code, it’s just identifying x and y for you. Report the coefficients for urban....
The following question can be answered in R code (using R-Studio or a program of your...
The following question can be answered in R code (using R-Studio or a program of your choice). Load the “star” data from the “faraway” package, and model “temp” using “light”. One may also suspect that the residuals (use all the data) follow a t distribution instead of normal. Using the same logic that we produced the QQ plot for comparing to the normal distribution, produce a QQ plot for comparing to a t distribution. You need to decide the degrees...
R work (must be done in R) Copy and paste your R code and output into...
R work (must be done in R) Copy and paste your R code and output into a word document, along with your written answers to the questions. Follow these instructions to import the necessary dataset:  Before opening the dataset needed for this problem, you’ll need to call the “car” package. Run the following line of code: > library(car)  Now you can import the “ States” dataset and use it to answer the question below. Name the data frame...
The built-in R dataset swiss gives Standardized fertility measure and socio-economic indicators for each of 47...
The built-in R dataset swiss gives Standardized fertility measure and socio-economic indicators for each of 47 French-speaking provinces of Switzerland at about 1888. The dataset is a data frame containing 6 columns (variables). The column Infant.Mortality represents the average number of live births who live less than 1 year over a 3-year period. We are interested in the Infant.Mortality column. We can convert the data in this colun to an ordinary vector x by making the assignment x <- swiss$Infant.Mortality....