Chapter 10 ยท Statistics: samples and populations
Comparing Two Data Sets: Center and Variability
Compare two data sets by calculating a measure of center and a measure of variability for each, then use the results to compare two populations.
You already know that a random sample lets you make an inference about a whole population. Now you will compare two populations by comparing a random sample from each one. A sample is only part of a population, so your conclusion is an informal inference: a reasonable judgment, not a certainty.
Each sample is a data set, a collection of numbers that all measure the same thing. Comparing two data sets value by value is slow and confusing, so you ask two questions about each one:
- Where is its center? A measure of center is one number that describes a typical value in the data set.
- How spread out is it? A measure of variability is one number that describes how far apart the values are.
You answer each question by calculating, and then you compare the answers.
Two measures of center are the mean and the median.
- The mean is the sum of the values divided by the number of values. It is the amount each value would be if the total were shared out equally.
- The median is the middle value when the values are in order from least to greatest. The number of values is called the count. If the count is odd, there is one middle value. If the count is even, there are two middle values, and the median is their mean.
To compare two data sets by center, find the same measure for both. Then say which is greater and by how much. Compare mean with mean, or median with median. Do not compare one data set's mean with the other's median. The mean and the median of a single data set can be different numbers, so mixing them can show a difference that comes from the measures and not from the data.
Worked example
Comparing centers
A librarian asks a random sample of 6 students from Grade 6 and a random sample of 6 students from Grade 7 how many pages they read last week. Grade 6: . Grade 7: . Compare the two samples using the mean and the median.
Find the Grade 6 mean. Add the 6 values, then divide the sum by 6, because the mean shares the total equally among the 6 values.
Find the Grade 7 mean the same way: add its 6 values and divide the sum by 6.
Find the Grade 6 median. Write the values in order first, because the median depends on position. Ordering changes how the list is written, not the values in it. The count, 6, is even, so there are two middle values, the 3rd and the 4th. The median is their mean.
Find the Grade 7 median the same way. Order the values, then take the mean of the 3rd and 4th values.
Compare like with like. The Grade 7 mean, 32, and median, 30, are different numbers for one sample, so mixing the two measures would mislead you. Subtract the lesser mean from the greater mean, and the lesser median from the greater median. Each difference tells you how many pages greater the Grade 7 center is.
Answer
The Grade 7 sample has the greater center: its mean is pages greater ( against ) and its median is pages greater ( against ). The samples suggest that Grade 7 students at this school typically read more pages last week than Grade 6 students did.
Two data sets can have the same center and still be very different. Take the sets and . Each one adds up to , so each mean is , and the middle value of each is . But in the first set the values sit close together, and in the second they are far apart. A measure of variability turns that difference into a number.
The simplest one is the range: the greatest value minus the least value. It is the distance from one end of the data set to the other. For the two sets above, the ranges are and , so the second set is much more spread out.
The range uses only two values, the least and the greatest. The next measure looks at the middle of the data instead.
The interquartile range, or IQR, describes the spread of roughly the middle half of the data. The idea is to cut the ordered data into two halves at the median, find the middle of each half, and measure the distance between those two middles.
Here is the full rule. It needs at least two values, so that each half has a value in it.
- Order the data from least to greatest.
- Split the data at the median into a lower half and an upper half. When the count is odd, the median is in neither half. When the count is even, every value is in one of the halves.
- Find the median of each half. The median of the lower half is the first quartile, written . The median of the upper half is the third quartile, written .
- Subtract: .
In ordered data, no value in the upper half is less than any value in the lower half. So is never less than , and the IQR is never negative. The greater the IQR, the farther apart the two quartiles are.
Worked example
Comparing variability
Use the two reading samples again, now written in order. Grade 6: . Grade 7: . Compare their variability using the range and the IQR.
Find each range. Subtract the least value from the greatest value, because the range is the distance from one end of the data set to the other.
Split each ordered sample at its median. The count, 6, is even, so the split falls between the 3rd and 4th values, and every value is in one of the halves. The bar marks the split: 3 values in the lower half and 3 in the upper half.
Find the Grade 6 quartiles. The first quartile is the median of the lower half, and the third quartile is the median of the upper half. Each half has 3 values, an odd count, so its median is its 2nd value. Subtract the first quartile from the third quartile to get the IQR.
Find the Grade 7 quartiles and IQR the same way, using the 2nd value of each half.
Compare range with range and IQR with IQR. Subtract the lesser from the greater to see how much more spread out the Grade 7 sample is by each measure.
Answer
The Grade 7 sample has the greater variability by both measures: its range is pages greater ( against ) and its IQR is pages greater ( against ). The samples suggest that pages read last week differ more from student to student in Grade 7 than in Grade 6.
| Measure | Grade 6 sample | Grade 7 sample | Difference (Grade 7 minus Grade 6) |
|---|---|---|---|
Mean (center) | pages | pages | pages |
Median (center) | pages | pages | pages |
Range (variability) | pages | pages | pages |
IQR (variability) | pages | pages | pages |
Key concept
Compare center with center, spread with spread
To compare two data sets, answer two separate questions, each with a number you calculate.
- Center: Which set has the greater mean or median, and by how much?
- Variability: Which set has the greater range or IQR, and by how much?
Use the same measure for both sets. The answer to one question does not tell you the answer to the other, so answer both.
To find an IQR, order the data and split it at the median into a lower half and an upper half (the median is in neither half when the count is odd). and are the medians of those halves, and the IQR is .
Worked example
A full comparison with an odd count
A tester takes a random sample of 9 batteries from each of two brands and records how many hours each battery lasts. Brand A: . Brand B: . Compare the two samples using the median and the IQR.
Order each sample from least to greatest. The count, 9, is odd, so each median is the single middle value, the 5th, with 4 values below it and 4 above it. It is shown in bold.
Split Brand A at its median. The count is odd, so the median, 21, is in neither half. The lower half is 18, 19, 20, 20 and the upper half is 22, 22, 23, 24. Each half has 4 values, an even count, so each quartile is the mean of the two middle values of its half.
Split Brand B the same way. Its median, 17, is in neither half. The lower half is 10, 12, 14, 16 and the upper half is 20, 22, 24, 27. Take the mean of the two middle values of each half.
The IQR is the distance between the quartiles, so subtract the first quartile from the third quartile for each brand.
Compare the centers. Subtract the lesser median from the greater one to see how many hours greater Brand A's median is.
Compare the variability. Subtract the lesser IQR from the greater one to see how many hours greater Brand B's IQR is.
Answer
Brand A has the greater median, hours against , a difference of hours. Brand B has the greater IQR, hours against , a difference of hours. The samples suggest that Brand A batteries typically last longer and that their lifetimes vary less.
Takeaway: To compare two data sets, calculate and compare two kinds of numbers. A measure of center (the mean or the median) tells you which set has the greater typical value. A measure of variability (the range or the IQR) tells you which set is more spread out. Use the same measure for both sets, and say which is greater and by how much. When the data sets are random samples, the comparison supports an informal inference about the two populations.
Next, you will look at how much two data sets overlap, and you will express the difference between two centers as a multiple of a measure of variability.