Tutorials › Introduction to Statistics › Relative-Frequency Bar Charts for Unequal Samples

Graphs for Categorical Data · Tutorial 104 of 996

Relative-Frequency Bar Charts for Unequal Samples

Use relative frequencies to construct bar charts that compare categorical data sets with different sample sizes on a fair, common scale.

Beginner 9 min read

What You'll Learn

  • Calculate a category’s relative frequency using the total sample size as the denominator.
  • Convert proportions to percentages and check that category values sum to one, subject to rounding.
  • Construct relative-frequency bars with a consistent scale.
  • Explain why raw counts can mislead when sample sizes differ.
  • Compare category distributions without confusing sample size with category prevalence.

Why Compare Proportions Instead of Counts?

Suppose two clinics record how patients arrived for an appointment. One clinic sees many more patients than the other. It may have more patients arriving by bus simply because it saw more people overall, not because bus travel was more common among its patients. A chart of raw counts alone cannot separate these explanations.

A relative-frequency bar chart replaces each category count with the fraction of the sample in that category. Because each fraction uses its own sample size as the denominator, the chart describes how the sample is divided among categories rather than how many observations were collected. This makes relative frequencies useful when comparing samples of unequal sizes, provided the categories and the way the samples were collected are meaningfully comparable.

Definition: For a category with count \(f\) in a sample of size \(n\), its relative frequency is \(f/n\). It is the proportion of the sample in that category. Multiplying the relative frequency by 100 expresses it as a percentage.

A relative-frequency bar chart is a bar chart in which the height of each category’s bar represents its relative frequency or percentage, rather than its count. The bars remain separated because the categories are distinct groups. The vertical axis must state whether the heights are proportions or percentages.

Calculating Relative Frequencies

To calculate a relative frequency, divide each category count by the total number of observations in the sample. Use the same denominator—the sample total—for every category in that sample. If the categories account for every observation exactly once, their counts add to \(n\), and their relative frequencies add to 1, or 100%.

$$ \text{Relative frequency of a category}=\frac{\text{count in that category}}{\text{total sample size}}=\frac{f}{n} $$

For example, if 18 of 60 responses fall in a category, its relative frequency is \(18/60=0.30\), or 30%. The proportion is often convenient for calculations, while a percentage may be easier to read in a chart. Either is valid; the axis label should make the choice clear.

The sum-to-one check follows directly from the counts. If the categories are mutually exclusive and collectively account for the sample, their counts sum to \(n\). Dividing each count by \(n\) therefore gives:

$$ \frac{f_1}{n}+\frac{f_2}{n}+\cdots+\frac{f_k}{n} =\frac{f_1+f_2+\cdots+f_k}{n} =\frac{n}{n}=1 $$

This is a useful check on arithmetic and on whether the listed categories cover the observations. When displayed values are rounded, their printed sum may be slightly different from 1 or 100%; that small discrepancy can result from rounding rather than an error in the underlying calculation.

Worked Example: Converting Counts to Proportions

In a hypothetical survey of 40 students, 10 say they usually walk to campus, 18 usually take a bus, and 12 usually travel by car. Calculate the relative frequency and percentage for each category.

The sample size is \(n=40\). Divide every count by 40, then multiply each proportion by 100 to obtain a percentage.

Travel methodCountRelative frequencyPercentage
Walk10\(10/40=0.25\)25%
Bus18\(18/40=0.45\)45%
Car12\(12/40=0.30\)30%
Total401.00100%

For a relative-frequency bar chart, draw one bar for each travel method with heights 0.25, 0.45, and 0.30, respectively, if the vertical axis is proportions. With a percentage axis, the same bars have heights 25%, 45%, and 30%. The bus bar is tallest because the largest share of these students reported taking the bus.

Comparing Samples of Different Sizes

When two samples have unequal sizes, their category counts are on different scales. A larger sample can have larger counts in many categories even when the category shares are similar. Relative frequencies put each sample on a common scale from 0 to 1, or from 0% to 100%.

For a fair visual comparison, use the same category definitions and the same vertical scale for both charts. If the categories match, bars for corresponding categories can be compared by height across the two displays. Separate relative-frequency charts are one way to show the comparison; the important point here is that each bar’s height is calculated using the total for its own sample, while both charts use the same scale. The denominator is not the combined total unless the question specifically concerns the combined sample.

Worked Example: Two Samples With Unequal Sizes

Two hypothetical community centers ask visitors how they arrived. Center A records 20 walkers, 30 bus riders, and 10 drivers, for 60 visitors total. Center B records 12 walkers, 18 bus riders, and 30 drivers, for 60 visitors total. First calculate relative frequencies for the displayed data, then consider how the comparison would work if Center B had instead surveyed 120 visitors and recorded exactly twice each count.

For the original samples, Center A’s proportions are \(20/60=0.3333\) walking, \(30/60=0.5000\) by bus, and \(10/60=0.1667\) by car. Center B’s proportions are \(12/60=0.2000\), \(18/60=0.3000\), and \(30/60=0.5000\), respectively.

Travel methodCenter A countCenter A relative frequencyCenter B countCenter B relative frequency
Walk200.3333120.2000
Bus300.5000180.3000
Car100.1667300.5000
Total601.0000601.0000

A relative-frequency chart would show that the bus category has the greatest share at Center A, while driving has the greatest share at Center B. These are descriptions of the recorded samples, not claims that the centers caused visitors to choose different travel methods.

Now suppose Center B had 120 visitors, with counts of 24 walkers, 36 bus riders, and 60 drivers. Its relative frequencies would be \(24/120=0.2000\), \(36/120=0.3000\), and \(60/120=0.5000\). The counts have doubled, but the bar heights have not changed. A relative-frequency display preserves the comparison of shares; a raw-count display would show taller bars for Center B just because its sample was larger.

Why the Normalization Works

The reason proportions remove the direct effect of sample size can be shown with a simple calculation. Suppose a category makes up a fraction \(r\) of a sample of size \(n\). Its count is \(f=rn\). If the sample size changes to \(cn\), while the category share remains \(r\), then its count becomes \(crn\). Dividing by the new total gives the original share:

$$ \frac{crn}{cn}=r $$

Thus a change in sample size alone scales the counts but leaves the relative frequencies unchanged. This does not mean that observed proportions are guaranteed to be identical in different samples; actual samples may have different category shares. It means only that raw counts inherently depend on both sample size and category share, whereas relative frequencies express the share within each sample.

The calculation also explains the limits of the comparison. Relative frequencies make the displays use a common scale, but they do not by themselves make two samples representative, remove bias, or show that a difference is meaningful beyond the observed data. Interpret the bars as descriptions of the samples and consider how the observations were obtained before making broader claims.

Worked Example: Choosing the Right Denominator

Two hypothetical libraries record the formats of books borrowed during one week. Library North records 45 print books and 15 e-books, for 60 loans. Library South records 80 print books and 40 e-books, for 120 loans. Calculate and compare the percentage of e-book loans.

For Library North, the relevant denominator is its own total of 60 loans:

$$ \frac{15}{60}=0.25=25\% $$

For Library South, use its own total of 120 loans:

$$ \frac{40}{120}=0.3333\ldots\approx 33.3\% $$

The sample percentage of e-book loans is about 8.3 percentage points higher at Library South than at Library North. A relative-frequency bar chart would show heights of 25% and about 33.3% for the e-book category on the same percentage scale. Although South recorded more e-book loans in absolute count (40 versus 15), its total number of loans was also larger. The percentages provide the relevant comparison of shares within these two recorded samples.

Using the combined total of 180 loans as the denominator for both libraries would answer a different question: what fraction of all recorded loans came from each library’s e-book category? It would not describe the proportion of loans that were e-books within each library. For a within-sample comparison, each sample needs its own denominator.

Making and Reading the Chart

The basic construction follows the same bar-chart principles used for categorical counts, with one change: bar heights are relative frequencies rather than counts. A clear chart should make that change visible to the reader.

1
Find the sample total.
For each sample, add the category counts and confirm the total number of observations represented.
2
Calculate each category’s share.
Divide each category count by that sample’s total. Convert to percentages if that is the chosen vertical-axis scale.
3
Draw bars on a consistent scale.
Use a vertical axis beginning at zero and extending far enough to include the largest relative frequency. For comparisons, use the same scale for each sample.
4
State what the heights represent.
Label the vertical axis “Relative frequency” or “Percentage,” and identify the sample described by each chart.

A proportion axis from 0 to 1 and a percentage axis from 0% to 100% express the same information. Choose one format and use it consistently. If values are printed above bars, round them enough to be readable while retaining adequate precision; calculations and comparisons should use the underlying values rather than treating rounded labels as exact.

When reading the chart, describe a bar in context: for instance, “One-third of the recorded loans at Library South were e-books.” Avoid describing a proportion as a count, or implying that the chart gives the number of observations when it gives only their share. If the sample sizes matter to the reader, report them alongside the chart or in its caption; relative-frequency bars do not communicate how many observations were collected.

Common Mistake: Comparing Raw Counts as if They Were Shares

A common mistake is to conclude that the category with the larger count was more prevalent in a sample comparison, without checking the sample totals. In the unequal-size example, a reader might say that Center B had more visitors walking than Center A if Center B had 24 walkers compared with 20. That count comparison does not establish a larger walking share: \(24/120=20\%\), whereas \(20/60\approx33.3\%\). Center B’s count is larger, but the walking share is smaller.

The correction is to match the display to the question. Use counts when the number of observations in each category is the quantity of interest. Use relative frequencies when comparing how samples of different sizes are divided among categories. If sample sizes differ and the goal is to compare distributions, calculate each category’s proportion within its own sample and display all samples on a common vertical scale.

Key takeaway: A relative-frequency bar chart shows the share of each sample in each category. Divide every category count by its own sample total, label the vertical scale clearly, and use a common scale when comparing samples of unequal sizes.

Check Your Understanding

Answer each question using the definitions and methods in this tutorial.

  1. A hypothetical sample of 80 patients includes 28 who select option A. What is the relative frequency and percentage for option A?
  2. Why can two samples with the same category proportions have different raw-count bar heights?
  3. A group of 50 respondents has counts 20, 15, and 15 across three categories. What are the relative frequencies, and what check can you apply to them?
  4. Two samples have 12 and 24 observations in a category, with total sample sizes 40 and 120, respectively. Which sample has the larger category share? Show the calculations.
  5. What information is lost if a relative-frequency chart is shown without reporting either sample size?