mastree

Comparing two samples

What this lesson covers

  • Compare shift, overlap and spread on the box plots.
  • Intervals that do not overlap support a claim.
  • Overlapping intervals leave the question open.
Key idea

What to compare

  • Centre: how far apart are the medians?
  • Spread: is one group more variable?
  • Overlap: how much do the boxes overlap?
Key idea

Try it: two samples will differ

Worked example

Using the intervals

  • Two groups give these intervals for the median.
GroupMedianInterval
A6460 to 68
B7269 to 75
Key idea

Try it: shift and overlap

Worked example

Reading the result

  • The intervals do not overlap.
  1. A: 60 to 68
  2. B: 69 to 75
  3. B tends to be higher in the population
Key idea

Seeing the shift

  • B sits to the right of A, but the boxes overlap, so check the intervals.
Two box plots. B's median of 72 is to the right of A's median of 64.
Key idea

Statistics explorer

Common mistakes

  • Claiming B is always higher.
    Say B tends to be higher, because individuals vary.
  • Claiming no difference when intervals overlap.
    Overlap means there is not enough evidence to decide.
Key idea

Try it: make the call

Your turn

1

Intervals are 10 to 14 and 15 to 19. What can you say?

2

Intervals are 20 to 30 and 25 to 35. What can you say?

3

Which wording is best?

4

Which feature compares centre?

5

Two groups have similar medians. Group A has IQR 8 and group B has IQR 20. Which is true?

6

B's median is to the right of A's, but the boxes overlap a lot. What should you do next?

7

Intervals are 30 to 38 for Hamilton and 40 to 46 for Tauranga. Mere writes "Every Tauranga value is higher." What should she write?

8

Group A: median 50, IQR 12, n = 36. Group B: median 58, IQR 16, n = 64. Using median ± 1.5 × IQR ÷ √n, what can you say?

Show answer

1. No overlap, so the second tends to be higher 2. They overlap, so we cannot claim a difference 3. B tends to be higher than A 4. The medians 5. B is more variable than A. The IQR measures spread, and 20 is larger than 8. 6. Check whether the intervals for the medians overlap. Overlapping boxes alone do not settle the question. 7. Tauranga values tend to be higher. The intervals do not overlap, but the claim is about the medians, not every value. 8. No overlap, so B tends to be higher. A: 50 ± 3 gives 47 to 53; B: 58 ± 3 gives 55 to 61.

Your turn

Sample question: Achieved

Random samples from two populations give informal confidence intervals for the median of 52 to 60 and 63 to 71. What can you conclude?

Hint

Check whether the two intervals overlap.

Answer

The intervals do not overlap, so the second population tends to have higher values than the first

Step by step
  1. Each interval is a likely range for one population median.
  2. Compare the ends: the first interval stops at 60, and the second starts at 63.
  3. 60 is less than 63, so there is a gap. The intervals do not overlap.
  4. No overlap means the second population median is very likely higher, so we can make a claim.
  5. Say it carefully: "The second population tends to have higher values than the first."
  6. The classic mistake is to say every value in the second population is higher. Individuals vary, so say "tends to be".
  7. Check: the medians are 56 and 67, and the second is the higher one, which agrees.
Full working
  1. first: 52 to 60, second: 63 to 71
  2. 60 < 63no overlap
  3. The second tends to be higher
Your turn

Sample questions: Merit

1

Random samples of 36 Year 12 girls and 36 Year 12 boys at a school recorded hours of sleep on a school night. Girls: median 7.6, IQR 1.2. Boys: median 7.0, IQR 1.6. Construct both informal confidence intervals and decide whether you can claim that girls at the school tend to sleep longer than boys.

Hint

Find both intervals with median ± 1.5 × IQR ÷ √n, then check for overlap.

Answer

Girls 7.3 to 7.9 hours, boys 6.6 to 7.4 hours; they overlap, so we cannot make the claim

Step by step
  1. Recall the informal interval: median ± 1.5 × IQR ÷ √n. Both samples have n = 36, so √n = 6.
  2. Girls: margin = 1.5 × 1.2 ÷ 6 = 0.3. Interval 7.6 − 0.3 = 7.3 to 7.6 + 0.3 = 7.9 hours.
  3. Boys: margin = 1.5 × 1.6 ÷ 6 = 0.4. Interval 7.0 − 0.4 = 6.6 to 7.0 + 0.4 = 7.4 hours.
  4. Compare: the boys' interval reaches 7.4, and the girls' starts at 7.3. They overlap from 7.3 to 7.4.
  5. Overlap means the population medians could be the same, so the data does not give enough evidence.
  6. Conclusion: we cannot claim that Year 12 girls at this school tend to sleep longer than boys.
  7. The classic mistake is to claim "no difference". Overlap does not prove the medians are equal; it means we cannot tell.
  8. A larger sample would give narrower intervals and might settle it.
  9. Check: the sample medians do differ by 0.6 hours, which is why it is a close call.
Full working
  1. √36 = 6
  2. girls: 7.6 ± 1.5 × 1.2 ÷ 6 = 7.6 ± 0.3, so 7.3 to 7.9
  3. boys: 7.0 ± 1.5 × 1.6 ÷ 6 = 7.0 ± 0.4, so 6.6 to 7.4
  4. 7.4 > 7.3the intervals overlap
  5. Overlap: not enough evidence to claim girls sleep longer
2

Two random samples recorded the time, in seconds, to solve a puzzle. Group A: n = 25, median 48, IQR 10. Group B: n = 100, median 53, IQR 12. Construct both informal confidence intervals and make a conclusion. Explain why group B's interval is narrower even though its IQR is bigger.

Hint

Each interval uses its own n. Compare the end of A's interval with the start of B's.

Answer

A: 45 to 51 s, B: 51.2 to 54.8 s; no overlap, so group B tends to take longer; B is narrower because its sample is four times as big

Step by step
  1. Recall median ± 1.5 × IQR ÷ √n. Use each group's own numbers.
  2. Group A: √25 = 5, margin 1.5 × 10 ÷ 5 = 3. Interval 45 to 51 seconds.
  3. Group B: √100 = 10, margin 1.5 × 12 ÷ 10 = 1.8. Interval 51.2 to 54.8 seconds.
  4. A ends at 51 and B starts at 51.2. There is a small gap, so the intervals do not overlap.
  5. Conclusion: group B tends to take longer to solve the puzzle than group A.
  6. Why B is narrower: its IQR is 1.2 times bigger, but √100 is twice √25. The bigger sample wins, so B's margin is smaller.
  7. The gap is very small, 0.2 seconds, so the claim is only just supported. A careful report would say so.
  8. The classic mistake is to use the same n for both groups. Each interval comes from its own sample size.
Full working
  1. A: 48 ± 1.5 × 10 ÷ 5 = 48 ± 3, so 45 to 51
  2. B: 53 ± 1.5 × 12 ÷ 10 = 53 ± 1.8, so 51.2 to 54.8
  3. 51 < 51.2no overlap, only just
  4. √100 ÷ √25 = 2 > 12 ÷ 10the bigger sample narrows B
  5. B tends to take longer
Your turn

Sample questions: Excellence

1

Year 12 girls had median sleep 7.6 hours with IQR 1.2 hours, and boys had median 7.0 hours with IQR 1.6 hours. With samples of 36 each, the intervals overlapped. Suppose a new study takes equal random samples of n girls and n boys and gets the same medians and IQRs. Find the smallest n for which the intervals would not overlap. Explain why this does not guarantee the new study will support the claim.

Hint

Write the top of the boys' interval and the bottom of the girls' interval in terms of √n, and solve top < bottom.

Answer

n = 50 each; but a new sample would give different medians and IQRs, so the result is not guaranteed

Step by step
  1. No overlap means the boys' upper end is below the girls' lower end.
  2. Boys' upper end: 7.0 + 1.5 × 1.6 ÷ √n = 7.0 + 2.4 ÷ √n.
  3. Girls' lower end: 7.6 − 1.5 × 1.2 ÷ √n = 7.6 − 1.8 ÷ √n.
  4. Set up the inequality: 7.0 + 2.4 ÷ √n < 7.6 − 1.8 ÷ √n.
  5. Collect the √n terms on one side: 4.2 ÷ √n < 0.6.
  6. Rearrange: √n > 4.2 ÷ 0.6 = 7, so n > 49.
  7. At n = 49 the two ends are both exactly 7.343, so they touch. The smallest whole number is n = 50 each.
  8. Check n = 50: boys' upper end 7.0 + 2.4 ÷ 7.071 = 7.339, girls' lower end 7.6 − 1.8 ÷ 7.071 = 7.345. A tiny gap.
  9. Why not guaranteed: a new sample would have its own medians and IQRs. The 0.6-hour difference could shrink or grow just from sampling variation.
  10. Also, at n = 50 the gap is tiny, so a slightly different sample could overlap again. A safer plan is a larger sample.
  11. The classic mistake is to solve with the margins of the 36-person samples. The margins must change with n.
Full working
  1. boys' top: 7.0 + 2.4 ÷ √n; girls' bottom: 7.6 − 1.8 ÷ √n
  2. 7.0 + 2.4 ÷ √n < 7.6 − 1.8 ÷ √nno overlap
  3. 4.2 ÷ √n < 0.6, √n > 7
  4. n > 49at n = 49 the ends touch
  5. n = 50: 7.339 < 7.345
  6. n = 50 each
2

Random samples of 36 students from each of two schools recorded their travel time to school in minutes. School X: minimum 5, lower quartile 12, median 20, upper quartile 30, maximum 62. School Y: minimum 8, lower quartile 22, median 30, upper quartile 40, maximum 75. Write a conclusion to "Do students at School Y tend to take longer to get to school than students at School X?", using shift, overlap, spread and the intervals, and discuss the sampling.

Hint

Compare the boxes first, then build both intervals. Finish with what the sampling allows you to claim.

Answer

Yes: the intervals, 15.5 to 24.5 minutes for X and 25.5 to 34.5 minutes for Y, do not overlap, so Y students tend to take longer, by a median of about 10 minutes in the samples

Step by step
  1. Shift: Y's median, 30, is 10 minutes more than X's median, 20.
  2. Overlap: X's box is 12 to 30 and Y's is 22 to 40. The boxes overlap from 22 to 30, so many individual students take similar times.
  3. Spread: both IQRs are 18 minutes (30 − 12 and 40 − 22), so the middle halves are equally spread. Both have a long upper tail, to 62 and 75.
  4. Intervals: n = 36, √n = 6, margin 1.5 × 18 ÷ 6 = 4.5 for both.
  5. X: 20 ± 4.5, which is 15.5 to 24.5 minutes. Y: 30 ± 4.5, which is 25.5 to 34.5 minutes.
  6. 24.5 is less than 25.5, so the intervals do not overlap. That is strong enough to make the claim even though the boxes overlap.
  7. Conclusion: students at School Y tend to take longer to get to school than students at School X. I estimate the median for Y is 25.5 to 34.5 minutes and for X 15.5 to 24.5 minutes.
  8. Sampling: the samples were random, so they should represent each school. The claim applies to these two schools only, not to all NZ students.
  9. Limitations: travel time may be self-reported and rounded, and it may change with the season or the weather.
  10. The classic mistake is to say "Y students always take longer". Some X students take longer than most Y students, so say "tend to".
Full working
  1. median Y 30, median X 20shift of 10 min
  2. boxes overlap 22 to 30individuals vary
  3. IQR 18 for bothsame spread
  4. X: 20 ± 4.5 = 15.5 to 24.5; Y: 30 ± 4.5 = 25.5 to 34.5
  5. 24.5 < 25.5intervals do not overlap
  6. random samples, these two schools only
  7. Y students tend to take longer
Summary

What to take away

  • No overlap supports a claim.
  • Overlap means we cannot tell.

Challenge

1

A random sample of 25 Year 12 students at School A had a median of 40 minutes of exercise a day, with IQR 15 minutes. A random sample from School B is planned, and a pilot suggests a median of 47 minutes and an IQR of 20 minutes. Assuming those values, find the smallest sample size for School B that would give a gap between the two intervals. What happens at one fewer?

Hint

School A's interval is fixed, so find its top end first. School B's bottom end, 47 − 1.5 × 20 ÷ √n, must be bigger than that. Solve for √n, then n, and remember n is a whole number.

Answer

n = 145; with n = 144 the intervals touch at 44.5 minutes, so there is no gap and no claim

Step by step
  1. School A: margin = 1.5 × 15 ÷ √25 = 4.5, so its interval is 35.5 to 44.5 minutes.
  2. School B's interval starts at 47 − 30 ÷ √n. For a gap, this must be more than 44.5.
  3. So 30 ÷ √n < 2.5, which means √n > 12 and n > 144.
  4. The smallest whole number of students is 145.
  5. At n = 144 the margin is exactly 30 ÷ 12 = 2.5, so B starts at 44.5, the very end of A. The intervals touch, which counts as overlapping, so the claim is not supported.
Full working
  1. A: 40 ± 1.5 × 15 ÷ 5 = 40 ± 4.5, so 35.5 to 44.5n = 25
  2. 47 − 1.5 × 20 ÷ √n > 44.5B's lower end above A's upper end
  3. 30 ÷ √n < 2.5, √n > 12, n > 144solve
  4. n = 144: 47 − 2.5 = 44.5the intervals touch
  5. n = 145 students from School B
2

Two random samples of 36 Year 12 students recorded minutes of travel to school. Group A: median 52, IQR 18. Group B: median 60, IQR 24. The intervals overlap. The researcher can afford 64 more students. She could add all 64 to A, all 64 to B, or 32 to each. Assuming the medians and IQRs stay the same, which plan, if any, separates the intervals?

Hint

Find A's top end and B's bottom end under each plan. Only the margin changes, and it uses each group's own n.

Answer

Only splitting 32 and 32 works: A's interval ends at about 55.27 and B's starts at about 55.63. All to A leaves overlap (54.7 vs 54.0), and all to B leaves overlap (56.5 vs 56.4)

Step by step
  1. At the start: A ends at 52 + 1.5 × 18 ÷ 6 = 56.5, and B starts at 60 − 1.5 × 24 ÷ 6 = 54. They overlap.
  2. All 64 to A (n = 100): A ends at 52 + 27 ÷ 10 = 54.7, but B still starts at 54. Still overlapping.
  3. All 64 to B (n = 100): B starts at 60 − 36 ÷ 10 = 56.4, but A still ends at 56.5. Overlapping by just 0.1.
  4. 32 to each (n = 68, √68 ≈ 8.246): A ends at 52 + 27 ÷ 8.246 ≈ 55.27, and B starts at 60 − 36 ÷ 8.246 ≈ 55.63. There is a gap.
  5. Why splitting wins: both margins shrink, and the overlap needs both ends to move. Each plan that helps one group leaves the other group's wide margin untouched.
  6. Even then the gap would only be about 0.4 minutes, and new samples would give new medians and IQRs, so the plan gives a good chance, not a guarantee.
Full working
  1. A upper = 52 + 27 ÷ √nA, B lower = 60 − 36 ÷ √nB1.5 × 18 = 27, 1.5 × 24 = 36
  2. now: 56.5 and 54.0overlap
  3. all to A: 54.7 and 54.0still overlap
  4. all to B: 56.5 and 56.4still overlap
  5. 32 each: 52 + 27 ÷ √68 ≈ 55.27 and 60 − 36 ÷ √68 ≈ 55.63gap
  6. Split 32 and 32: the only plan that separates them
3

Random samples of 49 adults in each of Auckland, Wellington and Christchurch recorded their daily commute in minutes. Auckland: median 34, IQR 14. Wellington: median 30, IQR 21. Christchurch: median 27, IQR 7. Which pairs of cities can you make a claim about? A student says the results contradict each other. Explain why they do not. Then find the smallest equal sample size per city, with the same medians and IQRs, for which Wellington's interval would be separate from both others.

Hint

Build all three intervals and check each pair. For the last part, write Wellington's margin as 31.5 ÷ √n and the others' with their own IQRs, then solve two inequalities.

Answer

Auckland 31 to 37, Wellington 25.5 to 34.5, Christchurch 25.5 to 28.5: only Auckland vs Christchurch has a gap, so Auckland commutes tend to be longer than Christchurch's; no claim for the other pairs; n = 197 per city

Step by step
  1. √49 = 7. Margins: Auckland 1.5 × 14 ÷ 7 = 3, Wellington 1.5 × 21 ÷ 7 = 4.5, Christchurch 1.5 × 7 ÷ 7 = 1.5.
  2. Intervals: Auckland 31 to 37, Wellington 25.5 to 34.5, Christchurch 25.5 to 28.5.
  3. Auckland and Christchurch have a gap (28.5 < 31), so Auckland adults tend to have longer commutes. Wellington overlaps both, so no claim either way for Wellington.
  4. No contradiction: overlap means not enough evidence, not equal medians. Wellington's wide interval (large IQR) means its median is poorly pinned down, so it could sit near Auckland's or near Christchurch's.
  5. With n per city: Auckland vs Wellington needs 34 − 21 ÷ √n > 30 + 31.5 ÷ √n, so √n > 13.125 and n ≥ 173. Wellington vs Christchurch needs 30 − 31.5 ÷ √n > 27 + 10.5 ÷ √n, so √n > 14 and n ≥ 197.
  6. Both must hold, so the smallest is n = 197 per city.
Full working
  1. margins 3, 4.5, 1.51.5 × IQR ÷ 7
  2. A 31 to 37, W 25.5 to 34.5, C 25.5 to 28.5
  3. C ends 28.5 < A starts 31only this pair has a gap
  4. 52.5 ÷ √n < 4, √n > 13.125, n > 172.3Auckland vs Wellington
  5. 42 ÷ √n < 3, √n > 14, n > 196Wellington vs Christchurch
  6. Claim only Auckland over Christchurch; n = 197 per city

More challenge problems

Practice

Practise this

Worksheet with answersWithout answersDownload PDF
Report a mistake

More in AS 91264