
i
i
“K23166” — 2015/1/28 — 9:35 — page 72 — #98
i
i
i
i
i
i
72 CHAPTER 6. LINEAR REGRESSION AND ANOVA
6.3.1 Predicted values
Example: 6.6.2
mod1 = lm(y ~ x, data=ds)
predicted.varname = predict(mod1)
Note: The command predict() operates on any lm object and by default generates a vector
of predicted values.
6.3.2 Residuals
Example: 6.6.2
mod1 = lm(y ~ x, data=ds)
residual.varname = residuals(mod1)
Note: The command residuals() operates on any lm object and generates a vector of
residuals. Other functions exist for aov, glm, or lme objects (see help(residuals.glm)).
6.3.3 Standardized and Studentized residuals
Example: 6.6.2
Standardized residuals are calculated by ...