mastree

Box plots and informal confidence intervals

What this lesson covers

  • A box plot shows the median and the middle 50%.
  • The interval is median ± 1.5 × IQR ÷ √n.
  • Bigger samples give narrower intervals.
Key idea

The informal interval

  • Find the sample median and interquartile range, the IQR.
  • The interval is median ± 1.5 × IQR ÷ √n.
Worked example

Sample of 36

  • Median 52, IQR 18, n = 36.
  1. 1.5 × 18 ÷ √36 = 4.5
  2. 52 − 4.5 = 47.5
  3. 52 + 4.5 = 56.5
  4. interval: 47.5 to 56.5
Key idea

Try it: box plots side by side

Worked example

Why sample size matters

  • The same median and IQR with other sample sizes.
nMarginInterval
255.446.6 to 57.4
364.547.5 to 56.5
1002.749.3 to 54.7
Key idea

From the box to the interval

  • The interval is centred on the median and is much narrower than the box.
A box plot with median 52 and an interval from 47.5 to 56.5 below it.
Key idea

Try it: change the sample size

  • Move n and watch the interval narrow.
Key idea

Statistics explorer

Common mistakes

  • Saying the interval holds all the data.
    It estimates the population median, not individual values.
  • Dividing by n instead of √n.
    The formula uses the square root.
Key idea

Try it: build and test the interval

Your turn

1

Q1 = 10 and Q3 = 20. Find the IQR.

2

IQR 12, n = 36. Find the margin.

3

Median 40 with margin 3. Find the interval.

4

What happens as n grows?

5

A box plot of 25 travel times shows Q1 = 20, median 30 and Q3 = 40 minutes. Find the informal interval for the median.

6

What does the informal interval median ± 1.5 × IQR ÷ √n tell us about?

7

A sample of n = 36 gives the interval 46 to 54. What was the IQR?

8

With n = 25 the margin is 6. Keeping the same IQR, what is the margin with n = 100?

Show answer

1. 10 2. 1.5 × 12 ÷ 6 = 3 3. 37 to 43 4. The interval narrows 5. 24 to 36 minutes. IQR = 40 − 20 = 20, margin = 1.5 × 20 ÷ √25 = 6, so 30 ± 6. 6. Where the population median is likely to lie. The box shows the middle 50% of the sample; the interval is about the population median. 7. 16. The margin is 4, so 1.5 × IQR ÷ √36 = 4, giving 1.5 × IQR = 24 and IQR = 16. 8. 3. √100 ÷ √25 = 2, so the margin halves: 6 ÷ 2 = 3.

Your turn

Sample question: Achieved

A random sample of 25 Year 12 students gave a median of 64 minutes of homework a night, with an interquartile range of 20 minutes. Construct an informal confidence interval for the population median.

Hint

Use median ± 1.5 × IQR ÷ √n with n = 25.

Answer

58 to 70 minutes

Step by step
  1. Recall the informal interval: median ± 1.5 × IQR ÷ √n.
  2. Write down the pieces: median 64, IQR 20, n = 25, so √n = 5.
  3. Margin: 1.5 × 20 ÷ 5 = 30 ÷ 5 = 6 minutes.
  4. Lower end: 64 − 6 = 58. Upper end: 64 + 6 = 70.
  5. So the interval is 58 to 70 minutes, and it estimates the median homework time of all Year 12 students in the population.
  6. The classic mistake is dividing by n = 25 instead of √25 = 5. That gives a margin of 1.2, far too narrow.
  7. Check: the interval is centred on the sample median, 64, and is narrower than the box, which is 20 minutes wide.
Full working
  1. median 64, IQR 20, √25 = 5
  2. margin = 1.5 × 20 ÷ 5 = 61.5 × IQR ÷ √n
  3. 64 − 6 = 58, 64 + 6 = 70
  4. 58 to 70 minutes
Your turn

Sample questions: Merit

1

A random sample of 49 Year 12 students at an Auckland school recorded their weekly screen time in hours. Minimum 8, lower quartile 18, median 24, upper quartile 32, maximum 55. Construct an informal confidence interval for the median and write a sentence interpreting it in context.

Hint

First find the IQR from the quartiles, then use median ± 1.5 × IQR ÷ √n.

Answer

21 to 27 hours: I am fairly sure the median weekly screen time of all Year 12 students at this school is between 21 and 27 hours

Step by step
  1. The formula needs the IQR, which is not given directly. IQR = upper quartile − lower quartile = 32 − 18 = 14 hours.
  2. The minimum and maximum are not needed for the interval. They describe single students, not the centre.
  3. n = 49, so √n = 7.
  4. Margin: 1.5 × 14 ÷ 7 = 21 ÷ 7 = 3 hours.
  5. Interval: 24 − 3 = 21 to 24 + 3 = 27 hours.
  6. Interpret it about the population, not the sample: the median weekly screen time for all Year 12 students at this school is likely to be between 21 and 27 hours.
  7. The classic mistake is to say "most students watch 21 to 27 hours". The interval is about the population median, not about individual students. Many students are outside it.
  8. Check: 21 and 27 sit inside the box (18 to 32), and the interval is centred on 24.
Full working
  1. IQR = 32 − 18 = 14upper quartile − lower quartile
  2. margin = 1.5 × 14 ÷ √49 = 3
  3. 24 − 3 = 21, 24 + 3 = 27
  4. about the population median, with units
  5. 21 to 27 hours for the population median
2

A random sample of 25 gave an informal confidence interval of 40 to 50 for a population median. Find the sample median and the IQR. If a sample of 100 gave the same median and IQR, what interval would it give? What happens to the width?

Hint

The median is the middle of the interval and the margin is half its width. Then work the formula backwards for the IQR.

Answer

Median 45, IQR ≈ 16.67; with n = 100 the interval is 42.5 to 47.5, half as wide

Step by step
  1. An informal interval is median ± margin, so the median is in the middle: (40 + 50) ÷ 2 = 45.
  2. The margin is half the width: (50 − 40) ÷ 2 = 5.
  3. Recall margin = 1.5 × IQR ÷ √n. With n = 25: 5 = 1.5 × IQR ÷ 5.
  4. Multiply by 5: 25 = 1.5 × IQR, so IQR = 25 ÷ 1.5 = 16.67.
  5. Now n = 100, so √n = 10. Margin = 1.5 × 16.67 ÷ 10 = 25 ÷ 10 = 2.5.
  6. Interval: 45 − 2.5 = 42.5 to 45 + 2.5 = 47.5.
  7. The width drops from 10 to 5, so it halves. Four times the sample gave half the width, because √100 is twice √25.
  8. The classic mistake is to think four times the sample makes the interval four times narrower. The formula divides by √n, not n.
  9. Check: 1.5 × 16.67 ÷ 5 = 5, which matches the first interval.
Full working
  1. median = (40 + 50) ÷ 2 = 45, margin = 5the middle and the half-width
  2. 5 = 1.5 × IQR ÷ √25, IQR = 25 ÷ 1.5 ≈ 16.67
  3. n = 100: margin = 1.5 × 16.67 ÷ 10 = 2.5
  4. 45 ± 2.5 gives 42.5 to 47.5
  5. width 10 becomes 5√100 = 2 × √25
  6. median 45, IQR ≈ 16.67; 42.5 to 47.5, half as wide
Your turn

Sample questions: Excellence

1

A pilot survey of Year 12 students' daily travel time to school gave an IQR of about 16 minutes. A student wants an informal confidence interval for the median with a margin of at most 2 minutes. Find the smallest sample size needed, and give two reasons why the final interval might still not have a margin of exactly 2 minutes or might be misleading.

Hint

Set 1.5 × 16 ÷ √n ≤ 2 and solve for n. Remember n is a whole number of students.

Answer

n = 144 students; the IQR of the new sample may differ from 16, and a biased sample gives a narrow interval in the wrong place

Step by step
  1. Recall the margin: 1.5 × IQR ÷ √n. We want it at most 2 with IQR = 16.
  2. Set up the inequality: 1.5 × 16 ÷ √n ≤ 2, so 24 ÷ √n ≤ 2.
  3. Multiply both sides by √n and divide by 2: √n ≥ 12.
  4. Square both sides: n ≥ 144. The smallest sample is 144 students.
  5. Check: with n = 144 the margin is 24 ÷ 12 = 2. With n = 143 it is 24 ÷ 11.96 = 2.007, just too big.
  6. Reason 1: the IQR of 16 came from a pilot. The real sample's IQR could be bigger, which would make the margin bigger than 2.
  7. Reason 2: the formula only measures random sampling variation. If the sample is not random, say only students who arrive early, the interval can be narrow but centred in the wrong place.
  8. Reason 3: the interval estimates the population median only. It says nothing about how long a single student travels.
  9. The classic mistake is to solve 24 ÷ n ≤ 2 and get n = 12. The formula has √n, so n must be squared at the end.
Full working
  1. 1.5 × 16 ÷ √n ≤ 2margin at most 2
  2. √n ≥ 12
  3. n ≥ 144n = 143 gives 2.007
  4. the real IQR may differ from the pilot
  5. a biased sample is narrow but in the wrong place
  6. n = 144
2

Show that to make the margin of an informal confidence interval k times smaller, with the same IQR, you need a sample k² times as big. Hence, a researcher with a sample of 30 wants an interval one third as wide. How many must she sample? Comment on whether this is a sensible plan.

Hint

Write the margin with n, then with k²n, and compare. The square root does the work.

Answer

Margin with k²n is (1.5 × IQR ÷ √n) ÷ k; she needs 270 people; it costs nine times the effort for three times the precision

Step by step
  1. Start with the margin for a sample of n: 1.5 × IQR ÷ √n.
  2. Replace n by k²n: 1.5 × IQR ÷ √(k²n).
  3. The square root splits: √(k²n) = √k² × √n = k√n, because k is positive.
  4. So the new margin is 1.5 × IQR ÷ (k√n) = (1.5 × IQR ÷ √n) ÷ k. It is the old margin divided by k. That proves it.
  5. Hence part: one third as wide means k = 3, so the sample must be 3² = 9 times as big.
  6. 9 × 30 = 270 people.
  7. Check with an IQR of 10: n = 30 gives 1.5 × 10 ÷ 5.477 = 2.739, and n = 270 gives 1.5 × 10 ÷ 16.43 = 0.913, which is one third of 2.739.
  8. Is it sensible? Each extra bit of precision costs more and more people. Going from 30 to 270 is nine times the work for three times the precision.
  9. It may be worth it if the decision needs a narrow interval. If not, a more modest gain, such as k = 2 with 120 people, may be the better trade.
  10. And a bigger sample does not fix a biased one: 270 people chosen badly is still a poor sample.
Full working
  1. margin with n: 1.5 × IQR ÷ √n
  2. margin with k²n: 1.5 × IQR ÷ (k√n)√(k²n) = k√n
  3. = (1.5 × IQR ÷ √n) ÷ kk times smaller, proved
  4. k = 3: 9 × 30 = 270
  5. 9 times the effort for 3 times the precision
  6. 270 people
Summary

What to take away

  • The interval is about the population median.
  • A larger sample gives a narrower interval.

Challenge

1

Show that for any sample, the width of the informal confidence interval divided by the width of the box is 3 ÷ √n. Hence find the sample size that makes the interval exactly one fifth as wide as the box, and the sample sizes for which the interval is wider than the box.

Hint

The box is IQR wide. The interval reaches the margin either side of the median, so it is two margins wide. Write the ratio and see what cancels.

Answer

Interval width ÷ box width = (3 × IQR ÷ √n) ÷ IQR = 3 ÷ √n; one fifth needs n = 225; the interval is wider than the box when n < 9

Step by step
  1. The box runs from the lower to the upper quartile, so its width is the IQR.
  2. The interval is median ± 1.5 × IQR ÷ √n, so its width is two margins: 3 × IQR ÷ √n.
  3. Divide: (3 × IQR ÷ √n) ÷ IQR. The IQR cancels, leaving 3 ÷ √n. It does not depend on the data at all, only on n.
  4. One fifth: 3 ÷ √n = 15 gives √n = 15, so n = 225.
  5. Wider than the box: 3 ÷ √n > 1 means √n < 3, so n < 9. At n = 9 the interval is exactly as wide as the box.
  6. So with fewer than 9 values the interval is wider than the middle half of the data itself, too wide to be useful.
Full working
  1. box width = IQRupper quartile − lower quartile
  2. interval width = 2 × 1.5 × IQR ÷ √n = 3 × IQR ÷ √ntwo margins
  3. ratio = 3 ÷ √nthe IQR cancels
  4. 3 ÷ √n = 15, √n = 15, n = 225one fifth
  5. 3 ÷ √n > 1 means √n < 3wider than the box
  6. ratio 3 ÷ √n; n = 225; wider than the box when n < 9
2

From a random sample of 36 Year 12 students, Mere reports an informal confidence interval of 31.5 to 38.5 minutes for the median time spent on homework a night. Her box plot's box starts at 24 minutes. Find the sample median, the IQR and where the box ends. Describe what the box shows about the middle half of the data. Then find the interval a sample of 81 would give with the same median and IQR.

Hint

The median is the centre of the interval and the margin is half its width. Work 1.5 × IQR ÷ √36 backwards for the IQR, then add the IQR to the start of the box.

Answer

Median 35, IQR 14, the box ends at 38; the middle half is stretched towards the lower values (11 minutes below the median, only 3 above); with n = 81 the interval is 35 ± 73, about 32.7 to 37.3 minutes

Step by step
  1. The median is the centre of the interval: (31.5 + 38.5) ÷ 2 = 35. The margin is half the width: 7 ÷ 2 = 3.5.
  2. Work the formula backwards: 1.5 × IQR ÷ 6 = 3.5, so IQR = 3.5 × 6 ÷ 1.5 = 14.
  3. The box starts at the lower quartile, 24, so it ends at the upper quartile 24 + 14 = 38.
  4. Inside the box the median is 11 minutes above the lower quartile but only 3 below the upper quartile. A quarter of the students are bunched between 35 and 38 minutes, while another quarter are spread from 24 to 35.
  5. With n = 81: margin = 1.5 × 14 ÷ 9 = 73 ≈ 2.33, so the interval is about 32.7 to 37.3 minutes.
  6. Check: 81 is 2.25 times 36 and √2.25 = 1.5, so the margin shrinks from 3.5 to 3.5 ÷ 1.5 = 73. It matches.
Full working
  1. median = (31.5 + 38.5) ÷ 2 = 35, margin = 3.5centre and half-width
  2. 1.5 × IQR ÷ 6 = 3.5, IQR = 14√36 = 6, worked backwards
  3. upper quartile = 24 + 14 = 38box start + IQR
  4. 35 − 24 = 11, 38 − 35 = 3the box is lopsided
  5. 1.5 × 14 ÷ 9 = 73 ≈ 2.33n = 81
  6. median 35, IQR 14, box 24 to 38; new interval about 32.7 to 37.3 minutes
3

A random sample of 16 patients at a Christchurch medical centre gave these waiting times in minutes: 3, 6, 8, 10, 10, 11, 12, 12, 12, 15, 22, 30, 30, 38, 45, 70. Using the median of each half for the quartiles, construct the informal confidence interval for the median. Explain what is unusual about where its lower end sits. Then the receptionist finds the 70 was a typing error for 17. Recalculate, and explain why changing the largest value changed the interval.

Hint

With 16 values, the median is halfway between the 8th and 9th, and each quartile is the median of 8 values. After the correction, sort the list again before finding anything.

Answer

Q1 10, median 12, Q3 30, interval 4.5 to 19.5 minutes, whose lower end is below the box because the data are skewed; after the correction Q3 is 26 and the interval is 6 to 18 minutes

Step by step
  1. Median: the 8th and 9th values are 12 and 12, so 12. Lower half 3 to 12: Q1 is between 10 and 10, so 10. Upper half 12 to 70: Q3 is between 30 and 30, so 30. IQR = 20.
  2. Margin = 1.5 × 20 ÷ √16 = 30 ÷ 4 = 7.5. Interval: 4.5 to 19.5 minutes.
  3. The lower end, 4.5, is below the lower quartile, 10, so the interval pokes out of the box. The median sits close to Q1 (skewed data), but the formula puts the same margin on both sides. With such a small, skewed sample the interval is rough, and its lower end is probably too low.
  4. Corrected and re-sorted, 17 lands between 15 and 22: 3, 6, 8, 10, 10, 11, 12, 12, 12, 15, 17, 22, 30, 30, 38, 45.
  5. The median and Q1 do not change, but the upper half is now 12, 15, 17, 22, 30, 30, 38, 45, so Q3 = (22 + 30) ÷ 2 = 26 and IQR = 16. Margin = 1.5 × 16 ÷ 4 = 6: interval 6 to 18 minutes.
  6. Why: 70 was not just made smaller, it moved into the middle of the upper half and pushed 22 into the 12th position. Q3 changed, so the IQR and the interval changed. Lowering 70 to anything 30 or more would have changed nothing.
Full working
  1. median = (12 + 12) ÷ 2 = 12, Q1 = 10, Q3 = 30, IQR = 20median of each half
  2. margin = 1.5 × 20 ÷ 4 = 7.5, interval 4.5 to 19.5√16 = 4
  3. 4.5 < Q1 = 10the interval pokes out below the box: skew
  4. 3, 6, 8, 10, 10, 11, 12, 12, 12, 15, 17, 22, 30, 30, 38, 45re-sorted with 17
  5. Q3 = (22 + 30) ÷ 2 = 26, IQR = 16, margin = 1.5 × 16 ÷ 4 = 617 moved into the upper half's middle
  6. 4.5 to 19.5 minutes at first; 6 to 18 minutes after the correction

More challenge problems

Practice

Practise this

Worksheet with answersWithout answersDownload PDF
Report a mistake

More in AS 91264