Course 2.2Lesson 1 of 3
The quartiles cut sorted data into four parts with about the same number of values in each. With the smallest and largest values and the median they make the five-number summary. This lesson finds the quartiles by one clear rule, links them to percentiles, and warns that software may use another rule.
Try the code and the simulations beside the lesson.
A consumer group runs a made-up test. It plays videos on 15 phones until each battery is empty. The battery lives, in hours and in order, are
, , .
The median is the 8th value, hours: seven phones last less and seven last more. But one number cannot tell you how much the phones differ. The quartiles can.
You met this rule in First Steps. Here it is again, with care for the details.
For the phones, the lower half is the first seven values, and its middle is hours. The upper half is the last seven values, and its middle is hours.
With an even number of values, the halves are simply the first half and the second half. For the ten values , , the median is . The lower half gives , and the upper half gives .
The five-number summary is the minimum, , the median, and the maximum, in that order.
For the phones it is , , , and hours. The interquartile range is hours. It is the width of the middle half of the data. A box plot draws the five numbers: a box from to with a line at the median, and whiskers out to the smallest and largest values.
A percentile tells you what percentage of the values lie below a point. The 90th percentile of a test score has about of the scores below it. The quartiles are close to the 25th, 50th and 75th percentiles. So about a quarter of the values lie below , a quarter between and the median, a quarter between the median and , and a quarter above . With few values, "about" matters: 15 values cannot be cut into four equal parts.
There is more than one rule for quartiles. Spreadsheets, calculators and Python's statistics.quantiles each use their own, and they can give slightly different answers for the same data. For the 15 phones the rules happen to agree. For the 12 reaction times of the next lesson they do not. When you report quartiles, say which rule you used. In this chapter we always use the medians of the halves.
You should find that each quartile only moves while the amber value passes through a small stretch. moves between 5 and 6 minutes, the median between 9 and 11, and between 14 and 15. Outside those stretches the amber value can go anywhere, and the box does not move. Only the whiskers follow it.
The program writes a function for the five-number summary with the rule of this lesson, prints the summary of the 15 phones, and then compares it with statistics.quantiles.
Try each one on your own first. If you are stuck, open a hint. Then check with Show the answer.
Every lesson is open to read. Enrolling also lets you:
Log in to join the discussion.
Loading…
This lesson is free to read. Enroll free to keep your place and take the tests.