This question uses Boston dataset, available in the MASS library.
We will use the the variables dis (the weighted mean of distances to five Boston employment centers) and nox
(nitrogen oxides concentration in parts per 10 million).
We will treat dis as the predictor and nox as the response.
Some of the exercises are not tested by Dodona (for example the plots), but it is still useful to try them.
Use the poly() function to fit a cubic polynomial regression to predict nox using dis.
Store the model in fit.poly.
rss.
i, fit an order-i polynomial of dis to predict nox.i-th element of the vector rss. Don’t forget to initialize the vector.
Hint: you can find the residuals as an attribute of the model.
deltas.poly.d.min.poly.Assume that:
MASS library has been loadedBoston dataset has been loaded and attachedboot library has been loaded