Use base R’s aov() function to fit one-way analysis-of-variance models. It tests whether a categorical predictor’s factor levels correspond to different means for a target variable. section 14.5.2
A practical workflow includes:
- Use plot(model, which = c(2, 1)) to examine residual normality and equal variances across groups. section 14.5.2
Comparing scoring categories with wins
fit1 <- aov(z_wins ~ o_pts_cat, data = nba_stats) fits a model relating standardized regular-season wins to four offensive-points factor levels. Its near-zero p-value indicates different group means; diagnostics then assess model integrity. section 14.5.2
