# Plot residuals vs. fitted values
plot(model, which = 1)
abline(h = 0, col = "red")
What Are Residuals?
\[ \text{Residual} = \text{Observed} - \text{Predicted} \]
Why Analyze Residuals?
# Plot residuals vs. fitted values
plot(model, which = 1)
abline(h = 0, col = "red")
# Plot a histogram of residuals
hist(residuals(model),
main = "Histogram of Residuals",
xlab = "Residuals",
col = "lightblue",
breaks = 10)
# Q-Q plot for residuals
qqnorm(residuals(model))
qqline(residuals(model), col = "red")
This lecture guides students through the residual diagnostics process, emphasizing the importance of evaluating the model’s assumptions before drawing conclusions.