Tutorials › Introduction to Statistics › Comparing Groups With Unequal Sample Sizes

Comparing Groups and Handling Outliers · Tutorial 183 of 996

Comparing Groups With Unequal Sample Sizes

Learn to choose count or relative-frequency displays for unequal-sized groups and compare their distributions without confusing group size with group composition.

Beginner 10 min read

What You'll Learn

  • Distinguish questions about total counts from questions about within-group proportions.
  • Calculate and compare relative frequencies using each group’s own sample size.
  • Explain why unequal sample sizes affect the visual impression of count displays.
  • Choose shared bins and scales for fair comparisons of group distributions.
  • Interpret histogram bar heights and areas correctly, including for unequal-width bins.
  • Recognize how smaller samples can make observed relative frequencies less stable.

Why Group Size Matters in a Comparison

Suppose two clinics record how many patients report a particular symptom. If one clinic records many more patients than the other, its symptom count might be larger simply because it saw more patients. A count display answers a question about how many observations occurred. A relative-frequency display answers a different question: what share of each group had a particular value or fell in a particular range? Deciding which question matters is essential when group sizes differ.

The right display depends on the comparison you want to make. For workload, total cases may be the relevant quantity, so counts are useful. To compare the pattern of responses within groups, relative frequencies are usually more informative. Sometimes both questions matter, and it is useful to show counts alongside relative frequencies.

Definition: For a group with sample size \(n\), the count in a category or interval is the number of that group’s observations in it. Its relative frequency is the count divided by the group’s sample size. If category \(j\) has count \(c_j\), its relative frequency is \(c_j/n\), and its observed proportion is often written \(\hat{p}_j=c_j/n\). Relative frequencies across mutually exclusive, exhaustive categories sum to 1; expressed as percentages, they sum to 100%.

Each group needs its own denominator. If Group A has \(n_A\) observations and Group B has \(n_B\), a category’s relative frequency is its count divided by \(n_A\) in Group A and by \(n_B\) in Group B. Dividing both counts by the combined sample size would answer a different question: what share of all observations came from that group and category.

Counts and Relative Frequencies Answer Different Questions

A count display preserves the absolute number of observations. It is appropriate when the number of cases is itself important, such as how many orders need processing or how many reported events occurred. But if group sizes differ, counts alone can make a group appear to have a more common outcome even when that outcome occurs in a smaller share of its members.

A relative-frequency display puts groups on a common scale from 0 to 1, or from 0% to 100%. It helps compare the composition of groups even when their sample sizes differ. It does not make the groups equally large, nor does it make their estimates equally precise. A relative frequency from a small group can change substantially when only a few observations change.

For a fair visual comparison, use the same category definitions or interval boundaries in each group. For quantitative data, put groups on the same horizontal scale and use the same bins. If each group has its own bin boundaries, a difference in the display may come from the choices of bins rather than a difference in the data.

Worked Example: Comparing Categorical Outcomes

In a hypothetical service survey, 40 customers in Group A and 100 customers in Group B each choose one of three response categories: low, medium, or high satisfaction. The counts are:

ResponseGroup A countGroup B count
Low2450
Medium1235
High415

The counts in Group A sum to \(24+12+4=40\), and those in Group B sum to \(50+35+15=100\), so each group’s recorded responses are accounted for. The counts show that Group B had more responses in every category. But Group B also had more than twice as many surveyed customers, so counts alone do not compare the groups’ response patterns.

Calculate each relative frequency using that group’s own sample size. For Group A, the low, medium, and high proportions are:

$$ \frac{24}{40}=0.600,\qquad \frac{12}{40}=0.300,\qquad \frac{4}{40}=0.100. $$

For Group B, they are:

$$ \frac{50}{100}=0.500,\qquad \frac{35}{100}=0.350,\qquad \frac{15}{100}=0.150. $$

Thus, the observed share reporting low satisfaction is 60% in Group A and 50% in Group B. The observed shares reporting high satisfaction are 10% and 15%, respectively. These are descriptions of the surveyed customers, not evidence by themselves that one group caused a response pattern. A relative-frequency bar chart on a shared 0-to-100% vertical scale would make these composition comparisons visible; a count chart would instead emphasize the numbers of surveyed customers in each category.

Comparing Quantitative Distributions

The same distinction applies to quantitative displays. In a histogram with counts on the vertical axis, a bar’s height records how many observations fall within its interval. A larger group will often have taller bars because it contains more observations, even if its distribution has nearly the same shape as a smaller group’s. This is not a flaw when the goal is to compare totals, but it can distract from a comparison of within-group patterns.

For groups with unequal sample sizes, relative-frequency histograms can make the within-group patterns easier to compare. With equal-width bins, use the proportion in each bin as the bar height; then the heights have a common interpretation as shares of each group. Make sure the bins cover the observed values, do not overlap, and have the same boundaries in every group.

When bins have unequal widths, however, histogram heights cannot simply be set to the relative frequencies. In a conventional histogram, bar area, not height alone, represents the frequency in an interval. A wide bin should therefore have a lower height than a narrow bin with the same share, so that their areas correctly represent equal shares. The appropriate height is relative-frequency density: the bin’s relative frequency divided by its width.

Key rule: With equal-width bins, relative-frequency bar heights can represent the bin shares directly. With unequal-width bins, use relative-frequency density as the height. With equal-width bins, bar areas are proportional to the bin shares; with relative-frequency density heights, each bar’s area equals its share exactly.

Worked Example: Relative-Frequency Histograms With Equal-Width Bins

In a hypothetical assessment, Group A has 20 scores and Group B has 50 scores. Scores are divided into the same five-point-wide intervals. The counts in the intervals 60–65, 65–70, and 70–75 are 4, 10, and 6 for Group A, and 5, 25, and 20 for Group B. These counts add to 20 and 50, respectively.

The count histogram gives Group B taller bars in every interval. To compare the shares in each interval, divide by the relevant group size. For Group A, the relative frequencies are:

$$ \frac{4}{20}=0.20,\qquad \frac{10}{20}=0.50,\qquad \frac{6}{20}=0.30. $$

For Group B, they are:

$$ \frac{5}{50}=0.10,\qquad \frac{25}{50}=0.50,\qquad \frac{20}{50}=0.40. $$

Each group’s relative frequencies sum to 1. Since the intervals all have the same width, a relative-frequency histogram can use these values as bar heights: 0.20, 0.50, and 0.30 for Group A; 0.10, 0.50, and 0.40 for Group B. Both groups have half their scores in the middle interval, although Group B has more scores there in absolute number: 25 rather than 10. The count and relative-frequency displays agree with the data but emphasize different comparisons.

Why Unequal-Width Histogram Bars Need Density

For a histogram interval of width \(w_j\) containing \(c_j\) observations out of \(n\), its relative frequency is \(c_j/n\). If bar area is to equal that share, then height multiplied by width must equal \(c_j/n\). Dividing both sides by the width gives the required bar height:

$$ \text{height}_j \times w_j=\frac{c_j}{n} \quad\Longrightarrow\quad \text{height}_j=\frac{c_j/n}{w_j}. $$

This height is the relative-frequency density for the interval. Its units are “proportion per unit of the measured variable.” Multiplying the height by the interval width recovers the proportion in the interval. Summing the bar areas therefore gives 1 when the intervals cover all observations.

Worked Example: Unequal-Width Bins and Relative-Frequency Density

A hypothetical group of 20 measurements, in points, is summarized using bins of unequal widths: 0–50, 50–70, 70–90, and 90–100. The respective counts are 4, 6, 6, and 4. They sum to 20. The bin widths are 50, 20, 20, and 10 points.

The relative frequencies are \(4/20=0.20\), \(6/20=0.30\), \(6/20=0.30\), and \(4/20=0.20\). These are the proportions of observations in the four intervals. If they were used directly as the bar heights, the areas would be \(0.20(50)=10\), \(0.30(20)=6\), \(0.30(20)=6\), and \(0.20(10)=2\). Those areas are not the bin proportions, so the resulting histogram would misrepresent the data.

Instead, divide each relative frequency by its bin width. The heights, in proportion per point, are:

$$ \frac{0.20}{50}=0.004,\qquad \frac{0.30}{20}=0.015,\qquad \frac{0.30}{20}=0.015,\qquad \frac{0.20}{10}=0.020. $$

Now multiply each height by its width to check the area: \(0.004(50)=0.20\), \(0.015(20)=0.30\), \(0.015(20)=0.30\), and \(0.020(10)=0.20\). The four areas match the four bin shares, and they sum to 1. The last, narrow bar is tallest, but it does not contain the largest share; its height is high because its width is only 10 points. Reading height alone as the bin share would be incorrect.

How Sample Size Affects the Visual Impression

Unequal sample sizes can affect both what a display emphasizes and how much detail it appears to show. A count histogram or stacked count chart gives more visual weight to a larger group because it includes more observations. A relative-frequency display removes that direct scaling by group size, but it does not eliminate the effect of sample size on the reliability of the observed pattern.

For example, a change of one observation changes a relative frequency by \(1/n\). In a group of 10, one observation changes a share by 0.10, or 10 percentage points. In a group of 100, one observation changes a share by 0.01, or 1 percentage point. Thus, relative-frequency bars from a small group can look uneven or change noticeably with only a few observations. A shared percentage scale makes the observed shares comparable; it does not guarantee equal precision or establish that a difference is meaningful beyond the observed data.

When the audience needs both the absolute number and the within-group pattern, give the group sizes and use complementary displays or labels. For instance, a count table paired with percentages makes clear that 15 cases out of 100 and 15 cases out of 20 have the same count but very different shares. For plots, clearly label whether the vertical axis shows counts, proportions, percentages, or density, and state the sample size for each group.

Common Mistakes

  • Comparing counts as if they were rates. “Group B has more observations in this category, so the outcome is more common in Group B” ignores differences in group size. Divide each count by its own group’s sample size before comparing shares.
  • Using one denominator for both groups. Dividing both groups’ category counts by the combined sample size does not give within-group relative frequencies. Use \(n_A\) for Group A and \(n_B\) for Group B.
  • Using relative frequencies as histogram heights with unequal-width bins. This makes wide-bin areas too large. Divide each bin’s relative frequency by its width, so the bar area—not merely its height—equals the bin share.
  • Assuming a relative-frequency display removes all sample-size effects. It puts observed shares on a common scale, but small groups have coarser, more changeable proportions. Report sample sizes as context.
  • Comparing groups with different bin boundaries. If the intervals differ, the bars do not summarize the same ranges. Use common boundaries to make a direct visual comparison.
Key takeaway: Use counts to compare totals and within-group relative frequencies to compare composition. For quantitative displays, keep scales and bins comparable. In histograms with unequal-width bins, use relative-frequency density so that each bar’s area represents its share of the group.

Check Your Understanding

Try these questions using the distinction between counts, shares, and histogram areas.

  1. Group A has 12 observations in a category out of 30, while Group B has 20 out of 80. Which group has the larger count, and which has the larger relative frequency? Show both calculations.
  2. Why can a count histogram make the distribution of a larger group appear more prominent even when the within-group patterns are similar?
  3. A group has 8 observations in a bin out of 40, and the bin is 4 units wide. What relative-frequency density should be used as the histogram height, and what area should the bar have?
  4. One observation is added to a group of 10 and, separately, to a group of 100. How much does the corresponding relative frequency change in each case?
  5. When might counts be more useful than relative frequencies, and when might relative frequencies be more useful than counts?