Practice: Centre, Spread and Boxplots by Hand
Questions to solve on paper: mean, median and standard deviation, quartiles by the method of halves, the IQR rule, drawing a boxplot by hand and reading one on small sets of real answers from the 2026 Stack Overflow Developer Survey, and choosing a time margin from the real delays of a flight.
Last updated:
On this practice page we practise on paper the tools of Same Statistics, Different Pictures and Comparing and Relating:
mean, median and standard deviation, quartiles by the method of halves, the IQR rule for outliers, drawing a boxplot by hand and reading one, and choosing a statistic by the decision to be made.
Almost every question is about real answers to the 2026 Stack Overflow Developer Survey (the reduced file, under the Open Database License: Stack Overflow Developer Survey 2026, Stack Exchange, Inc.; licence details).
The number of tools at nine workplaces
The survey asked: “In a typical month over the past year, about how many distinct software tools, platforms, or services did you personally use to do your primary work?”.
Nine respondents from Israel who work in an organization of 500 to 999 employees answered the question.
These are all their answers, in the order of the file:
Question 1. Compute by hand the mean and the median of the nine answers.
Which of the two measures is closer to most of the answers?
Hint
For the median, sort the answers from smallest to largest. With nine values, the value in the middle is the fifth.
Solution
Mean: the answers add up to , so .
Median: in the order the fifth value is 9, so the median is 9.
Eight of the nine answers are below the mean of 14; only the answer 69 is above it.
The median of 9 is closer to most of the answers: the answer 69 pulls the mean up, and the median depends only on the order.
Question 2. Compute by hand the standard deviation of the same nine answers, , whose mean is 14.
Which answer contributes most of the sum of the squared deviations?
Hint
Build a table with three columns: the value, its deviation from the mean, and the squared deviation.
Divide the sum of the squares by , then take the square root.
Solution
| Value | Deviation | Squared deviation |
|---|---|---|
| 9 | −5 | 25 |
| 3 | −11 | 121 |
| 3 | −11 | 121 |
| 10 | −4 | 16 |
| 10 | −4 | 16 |
| 8 | −6 | 36 |
| 4 | −10 | 100 |
| 69 | 55 | 3,025 |
| 10 | −4 | 16 |
The deviations add up to zero, and the squares to 3,476. The sample variance is , and the standard deviation is tools.
The answer 69 contributes 3,025 of the 3,476, about 87% of the sum.
A standard deviation of about 21 tools is larger than every distance of the other eight answers from the mean (at most 11):
it reflects mainly one answer.
Question 3. These are the nine answers: .
- Find and by the method of halves, and compute the IQR.
- Compute the limits of the IQR rule. Which answers are flagged as outliers?
- Draw a horizontal boxplot on an axis from 0 to 70: the box, the median line, the whiskers and the points.
Hint
With nine values the median is the fifth value, and it belongs to neither half:
each half has four values, and the median of four values is the mean of the two middle ones.
A whisker extends to the furthest value still inside the limits.
Solution
- In the order the lower half is , so ; the upper half is , so . .
- The upper limit is , and the lower limit is . Only 69 lies beyond the limits, so only it is flagged as an outlier.
- The box runs from 3.5 to 10, with the median line at 9, close to the right end of the box. The left whisker reaches 3, the smallest value. The right whisker reaches 10, the largest value that is not an outlier; that is also , so the right whisker has no length. One point at 69, far to the right of the box.
In pandas, quantile(0.25) of the nine answers returns 4, not 3.5, and quantile(0.75) returns 10. pandas interpolates between neighbouring values (explained in Same Statistics, Different Pictures), so on small data the result can differ a little from the method of halves.
Question 4. Suppose that the answer 69 is a typing error, and we drop it.
Eight answers remain: . What happens to the mean, the median and the standard deviation?
Predict before you compute, then compute.
Hint
With eight values the median is the mean of the fourth and fifth values in order.
For the standard deviation, the new mean is .
Solution
- Mean: , almost half of what it was (14).
- Median: in the order the median is , down by only half a tool (from 9).
- Standard deviation: the sum of the squared deviations from 7.125 is about 72.9, so , instead of about 20.8.
One extreme answer changed the mean and the standard deviation a great deal, and the median hardly at all.
The same happens in Same Statistics, Different Pictures when a salary of about 32 million dollars is added to the salaries of seven respondents.
Years of experience of ten respondents
Ten respondents from Israel whose highest education is secondary school wrote how many years of professional work experience they have.
These are all their answers, in the order of the file:
Question 5.
- Find the median, and and by the method of halves.
- Check with the IQR rule which values are flagged as outliers, and draw a horizontal boxplot on an axis from 0 to 30.
- Without computing: is the mean larger or smaller than the median? Explain from the picture, then compute the mean and check.
Hint
When the number of values is even, the median is the mean of the two middle values, and every value belongs to one of the halves:
five values in each half.
Solution
- In order: . The median is . The lower half is , so ; the upper half is , so .
- , the upper limit is and the lower one . Only 26 lies beyond the limits. In the picture: a box from 2 to 11, a median line at 6, a left whisker to 1, a right whisker to 20 (the largest value that is not an outlier), and a point at 26.
- The mean is larger than the median: the right part of the box (from 6 to 11) is longer than the left part (from 2 to 6), the right whisker is long, and there is a point on the right. The large values pull the mean to the right. The computation: , larger than the median of 6.
In pandas the quartiles of the ten answers are 2.25 and 10.75, close to the hand result but not the same.
Years of coding of twelve respondents
Twelve respondents from Israel who are not employed wrote how many years they have been coding, including education.
These are all their answers, in the order of the file:
Question 6.
- Find the median, and and by the method of halves. Which values does the IQR rule flag as outliers?
- Suppose that we checked the answer 45 and decided to drop it. Compute the quartiles and the limits again for the eleven remaining values. Is another value flagged as an outlier now? Why?
Hint
With twelve values each half has six values, and the median of six values is the mean of the third and the fourth.
With eleven values the median, the sixth value, belongs to neither half.
Solution
- In order: . The median is . The lower half is , so ; the upper half is , so . , the upper limit is and the lower one . Only 45 is flagged as an outlier.
- Without 45 the order is and the median is 10. The lower half is , so ; the upper half is , so . and the upper limit is . Now 36 lies beyond the limit, so it is flagged as an outlier. The limits depend on the quartiles, and dropping a value moves from 20 to 15: the box shrinks, and the limit comes closer. That is why we do not drop values “until there are no outliers”; each flagged value is checked on its own.
In pandas the quartiles of the twelve values are 6.75 and 17.5:
here the difference from the method of halves in is larger, because the two values around it, 15 and 25, are far apart.
Reading a boxplot: years of coding by employment status
The survey also asked: “Including any education, how many years have you been coding in total?”.
The figure has one boxplot for each of four employment groups.
On screen you can hover over a box to see its numbers.
Question 7. Answer from the figure.
- What is the median number of years of coding among the students, and among the self-employed?
- About what share of the employed have been coding for 25 years or more?
- Which group has the largest IQR, and what is it?
- The students’ group has an answer of 20 years of coding. Is it drawn as a point beyond the whisker? Check with the IQR rule.
Hint
The box runs from to , and the line inside it is the median.
For item 4, read the students’ and .
Solution
- Among the students the median is 5 years, and among the self-employed 20 years.
- About a quarter: among the employed , and a quarter of the values are greater than or equal to . In the data it is 25.9%, a little more than a quarter, because many respondents answered exactly 25.
- The self-employed: and , so . For the employed it is 15, for those not employed 14 and for the students 5.
- Yes. Among the students and , so and the upper limit is . 20 is greater than 15.5, so the answer is drawn as a point. “Outlier” here means “far from most of the students”: people who study for another degree after years of work can well have been coding for 20 years.
Question 8. Which of the statements follows from the figure?
A: The figure shows that the self-employed group has more respondents than the group of those not employed
The reasoning: the box of the self-employed is wider, so it seems to hold more people.
The mistake: the width of the box is the IQR, a distance on the axis of years of coding, not the number of respondents.
A boxplot does not show how many observations a group has; that is written next to the picture.
In the data the self-employed are indeed more numerous (3,774 against 1,308 not employed), but the figure does not show it:
the same boxes could come from any group sizes.
B: At least half of the self-employed have been coding for 20 years or more
The reasoning: the median of the self-employed is 20. At least half of the values are greater than or equal to the median, so at least half of the self-employed have been coding for 20 years or more.
C: The mean number of years of coding among the employed is 15
The reasoning: the line inside the box is at 15.
The mistake: the line is the median. A boxplot does not show the mean.
The employed have a long right tail and points up to 100 years, so the mean is larger than the median:
in the data it is 17.8.
D: No student has been coding for more than 15 years
The reasoning: the students’ right whisker ends at 15.
The mistake: a whisker ends at the largest value that is not an outlier.
To its right there are points: answers of students who have been coding for more than 15.5 years.
The data have 50 such answers.
Arrival delays: how much time to leave?
We are booking a holiday in Orlando and planning the day of arrival around the landing.
How much time should we leave between the scheduled landing and the next thing in the plan?
To decide, we look at real delays of that flight.
These are the arrival delays, in minutes, of JetBlue flight 1783 from New York (JFK) to Orlando on the first 15 days of July 2013, in the order of the days.
A negative number means an early arrival. Source: the US Department of Transportation on-time data for every flight that left New York in 2013, from the package nycflights13 (public domain, CC0; the flight’s data for the whole year and details of the source and of the selection).
Question 9.
- Find the median and the mean, and by the method of halves and . Does the IQR rule flag any value as an outlier?
- Suppose that on each of the 15 days we set the next thing in the plan so that we have a margin of minutes after the scheduled landing. On how many days would we be late, with a margin of 1 minute (about the median), 4 minutes (about the mean), 30 minutes and 60 minutes?
- What would you set in two cases: dinner at a restaurant, which can be postponed by phone, and the last ferry to an island, where missing it means missing the first night? Why do the median and the mean not answer the question?
Hint
With fifteen values the median is the eighth value, and it belongs to neither half:
each half has seven values. In part 2, count the days on which the delay is larger than the margin.
Solution
- In order: . The median is 1. The lower half is , so ; the upper half is , so . , the upper limit is and the lower one , so 70 is flagged as an outlier. The sum is 61, so : the mean is larger than the median, because the long delays pull it up, and early arrivals cannot be early by as much.
- We are late when the delay is larger than the margin. A margin of 1 minute: 7 days (). A margin of 4 minutes: the same 7 days. A margin of 30 minutes: 2 days (45 and 70). A margin of 60 minutes: 1 day (70).
- A margin set by the median or the mean makes us late on almost half of the days: the median describes the typical day, and the question is about the bad days. The decision depends on the cost of being late. For dinner a margin of about (a quarter of an hour) is enough, and on the few days when we are late we postpone the booking. For the ferry we look at the high values: on these 15 days even a 30-minute margin would have failed twice, and over the whole year (365 flights) 14.5% of the flights landed more than half an hour late and 4.9% more than an hour late. So for the ferry we leave more than an hour, or prefer an earlier flight.
In pandas the quartiles of the 15 values are and 11.5, close to the result by hand.