Analysis of variance (ANOVA) tests whether a numeric outcome has different means across three or more groups. A one-way ANOVA uses one categorical predictor, making it useful for questions such as whether NBA teams in different scoring or points-allowed categories have different average win totals. section 14.5 section 14.5.2
ANOVA needs a quantitative target and a categorical predictor. For NBA wins, standardized points allowed and points scored can be converted into four factor levels: below -1, -1 to 0, 0 to 1, and above 1 standard deviation. Check the resulting category counts and missing values before modeling. section 14.5.1 section 20.4
nba_stats %>%
mutate(o_pts_cat = case_when(z_o_pts < -1 ~ "A",
z_o_pts >= -1 & z_o_pts < 0 ~ "B",
z_o_pts >= 0 & z_o_pts <= 1 ~ "C",
z_o_pts > 1 ~ "D")) -> nba_stats
nba_stats$o_pts_cat <- as.factor(nba_stats$o_pts_cat)
Create a factor from standardized points allowed so teams can be compared as four categories rather than as one continuous measure. section 14.5.1
Plot the outcome by group before fitting the model. Boxplots show each category’s spread in standardized wins, while an overlaid mean makes group differences easier to inspect. This gives the statistical test a practical sports question: do scoring or defensive categories line up with winning? section 14.5.1
Fitting and checking two NBA ANOVAs
Fit `aov(z_wins ~ o_pts_cat, data = nba_stats)` for points allowed, then fit the same model with `pts_cat` for points scored. Both reported extremely small p-values, indicating differences in mean standardized wins across their four groups. Inspect Residuals vs. Fitted for equal group variances and Normal QQ for residual normality; compare the models with AIC when weighing the two predictors. section 14.5.2 section 14.5.2
A statistically significant ANOVA supports differences among group means, not the claim that one side of basketball is overwhelmingly more important. Here, points allowed and points scored showed similar effects on regular-season wins, so the broader defense-versus-offense claim remained qualified. section 14.8 section 20.4


