Variance measures how widely continuous numeric values scatter around their mean. It averages squared deviations from that mean: larger values indicate greater dispersion, while lower values indicate more consistency. Because deviations are squared, unusually distant values can strongly affect the result. section 18.4.1 section 18.0
A mean alone can hide an important difference: two groups may share a similar average but have very different spreads. Variance adds that missing context for questions involving consistency, volatility, risk, compensation, temperatures, or competitive balance. section 18.4 section 11.3
Compute variance by following the spread around the mean:
- Find the mean of the observations. section 11.3
- Subtract the mean from each observation to obtain its deviation. section 11.3
- Square each deviation, then add the squared values. section 11.3
- Divide the sum of squares by the applicable observation count convention; the illustrated hand calculation uses n − 1. section 11.3
Testing NBA intra-season parity
To assess whether a salary cap changed competitive balance, calculate variance in regular-season wins for every season and compare the annual results before and after 1984–85. Higher variance means wins were less evenly distributed across teams. The resulting trend showed dispersion falling before the cap era and rising afterward. section 18.4 section 18.4.1
records %>% group_by(Season) %>% summarize(v_wins = var(W)) -> var_records head(var_records, n = 3) ## # A tibble: 3 × 2 ## Season v_wins ## <chr> <dbl> ## 1 1970-71 143. ## 2 1971-72 235. ## 3 1972-73 264. tail(var_records, n = 3) ## # A tibble: 3 × 2 ## Season v_wins ## <chr> <dbl> ## 1 1995-96 197. ## 2 1996-97 245. ## 3 1997-98 241.
Group team records by season and call var() on wins to create one league-wide variance value per season. The resulting tibble can feed a line chart for comparing parity over time. section 18.4.1
Variance is one of several dispersion measures. Standard deviation is its square root, and range, mean absolute deviation, and median absolute deviation offer other views of spread. Comparing multiple measures can give a more complete reading than relying on one alone. section 18.6 section 20.7


















