In-Class Exercise 8
Shih Chien University
2026-09-16
Use the advertising and sales data from Exercise 6, and the fitted model model <- lm(sales ~ ads).
Coefficient of Determination
cor(), and confirm it with summary(model)$r.squared.Standard Error of the Estimate
The standard error of the estimate is
s_{est}=\sqrt{\frac{\sum(y-y')^2}{n-2}}
resid() and sqrt().summary(model)$sigma.Residual Analysis
resid() and verify that they sum to approximately zero.ggplot() and geom_point(), and add a horizontal line at zero with geom_hline().Elementary Statistics: A Step by Step Approach