The mean is the arithmetic average of numeric observations: add the values and divide by the number of observations. It gives one central value for a group, making it useful for comparing NBA seasons, draft segments, or model errors. section 3.5.1 section 5.7.7
A mean answers a concrete question such as: How many regular-season games does a typical player from each draft segment play? Group the data by segment, summarize games with mean(G), and compare the resulting averages alongside medians. For first-round selections in the example, the 1–5 segment averages about 716 career games, versus about 444 for picks 11–15. section 3.5.1
sumG <- sum(draft2$G)
draft2 %>%
group_by(Pk2) %>%
summarize(mean = mean(G),
median = median(G),
pct = sum(G)/sumG) -> tibble1
print(tibble1)
## # A tibble: 6 × 4
## Pk2 mean median pct
## <fct> <dbl> <dbl> <dbl>
## 1 1-5 716. 750. 0.234
## 2 11-15 444. 400 0.142
## 3 16-20 498. 550 0.163
## 4 21-25 453. 420 0.148
## 5 26-30 456. 478 0.125
## 6 6-10 579. 602. 0.189
This R workflow totals all games, groups players by draft-pick segment, and creates a table containing each segment’s mean, median, and share of all games played. section 3.5.1
Means become easier to interpret when displayed. A bar chart can plot the mean for each group, while a histogram can mark the mean with a vertical line and place it beside the median. The two measures provide different views of a distribution, so comparing them is often more informative than relying on either one alone. section 3.5.1 section 14.3
Average points by NBA season
To find whether scoring changed over time, group team records by season and compute mean(PTS). The resulting seasonal averages range from 96.26 points per game in 2012 to 105.59 in 2017, revealing meaningful variation across the ten seasons. section 14.3
The mean also supplies a baseline for standardization. Centering subtracts the annual mean from each player’s points per game, so a positive result is above that year’s average. Z-scores go further by subtracting the population mean and dividing by the standard deviation, expressing distance from the mean in standard deviations. section 19.4.3 section 19.4.1
In model evaluation, mean() can average absolute differences between predicted and actual wins. An average error of 9.94 wins on test data summarizes overall prediction accuracy, while the individual differences still show where the model performs better or worse. section 5.7.7




























