The median is the middle value after observations are sorted. With an even number of observations, it is the average of the two middle values. Unlike the mean, it is less affected by extreme values, making it useful for describing a typical NBA outcome when a few stars produce unusually high results. section 2.5.1
Use the median to:
- Compare a typical result with the mean and investigate whether unusually large or small observations are pulling the average away from the data’s center. section 2.5.1
- Summarize grouped data, such as career games played across draft-pick segments, alongside each group’s mean and share of total games. section 3.5.1
- Read the horizontal line inside a boxplot as the population median and compare groups using notched confidence-interval displays. section 14.5.1
NBA career games
For first-round selections, grouped results show different centers: picks 1–5 average 716 regular-season games but have a median of 750, while picks 11–15 average 444 and have a median of 400. Plotting mean and median bars makes these differences visible. 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
Inspect the R workflow that groups regular-season games by draft segment and computes mean, median, and percentage of total games. section 3.5.1






