par(mfrow=c(1,2))
plot(hp ~ wt, mtcars)
lines(lm(hp ~ wt, mtcars), col="steelblue")
# add the prediction intervals in different color
plot(hp ~ wt, mtcars)
r.lm <- lm(hp ~ wt, mtcars)
lines(r.lm, col="red", pred.level=0.95, args.pband=list(col=SetAlpha("grey",0.3)) )
Run the code above in your browser using DataLab