In what context are residuals from a plot important?
Plot with residual I have a plot that has residuals vertically dashed to the regression line. I also am using the function resid to derive all residuals. I am not entirely sure what good is finding residuals. Someone please explain and show an example.
library("MASS") # data survey # data plot(survey$Height ~ survey$Wr.Hnd, xlab = "Writing Handspan (cm)", ylab = "Height (cm)") survfit <- lm(Height ~ Wr.Hnd, data = survey) survfit abline(survfit, lwd = 2) resid(survfit) # residuals obsA <- c(survey$Wr.Hnd, survey$Height) obsA obsB <- c(survey$Wr.Hnd, survey$Height) obs mycoefs <- coef(survfit) mycoefs beta0.hat <- mycoefs beta1.hat <- mycoefs segments(x0 = c(obsA,obsB), y0 = beta0.hat + beta1.hat * c(obsA, obsB), x1 = c(obsA, obsB), y1 = c(obsA, obsB), lty = 2) # residual dashed vertical line