This question involves the use of multiple linear regression on the Auto
data set.
Some of the exercises are not tested by Dodona (for example the plots), but it is still useful to try them.
Produce a scatterplot matrix which includes all of the variables in the data set.
Compute the matrix of correlations between the variables using
the function cor()
and store it in Auto.cor
.
You will need to exclude the name variable, which is qualitative.
Use the lm()
function to perform a multiple linear regression
with mpg
as the response and all other variables except name
as
the predictors. Store the model in lm.fit1
. Use the summary()
function to print the results.
year
we can conclude that more recent cars are more fuel efficient (higher mpg).
Use the plot()
function to produce diagnostic plots of the linear regression fit.
Comment on any problems you see with the fit.
Do the residual plots suggest any unusually large outliers?
Does the leverage plot identify any observations with unusually high leverage?
lm.fit2
(\(h\) stands for horsepower and \(d\) for displacement:Assume that:
ISLR2
library has been loadedAuto
dataset has been loaded and attached