The R functions resid
and fitted
can be used to extract residuals and fitted values from an lm
object.
Find the residuals of the fitted regression model using the
resid
function:IO_lm_resid <- resid(IO_lm)
.We need six plots, and hence we invoke the graphics editor with
par(mfrow = c(3,2))
.Sketch the plot of residuals against the predictor variable with
plot(No_of_IO, IO_lm_resid)
.To check whether the regression model is linear or not, obtain the plots of absolute residual values against the predictor variable and also that of squared residual values against the predictor variable respectively with
plot(No_of_IO, abs(IO_lm_resid),…)
andplot(No_of_IO, IO_lm_resid^2,…)
.The assumption that errors have constant variance may be verified by the plot of residuals against the fitted values of the regressand. The required plot is obtained by using
plot(IO_lm$fitted.values,IO_lm_resid)
.The assumption that the errors are independent of each other...