problem-10.11
problem-10.11
The predicted value can be found with predict(). Though
you may not want to believe it, as the model has some issues. The
simple plot of the residuals shows values that are scattered
around 0, with nothing unusual. However, the second plot using the
1970 values on the x-axis instead of the index, shows that the
variance increases with the price of the house.
> res = lm(y2000 ~ y1970, data=homedata)
> pred(res, newdata=dataframe(y1970=80000))
> predict(res, newdata=data.frame(y1970=80000))
[1] 321185
> plot(resid(res)) # simple plot
> plot(homedata$y1970,resid(res)) # shows spread