Grade by Grade
D. Statistical Analysis · One-Variable Data Analysis

One-Variable Data and Frequency Distributions

D1.1 D1.3About 70 minutes
Learning goals
  • I can explain what makes a data set one-variable data and describe its variable as categorical or numerical, discrete or continuous.
  • I can build a frequency table with relative frequency, cumulative frequency and cumulative relative frequency.
  • I can group continuous data into equal, non-overlapping intervals and choose a sensible interval width.
  • I can use a spreadsheet's COUNTIF or FREQUENCY function to count frequencies for a large data set.

Words to know

one-variable data
Data that records one attribute (variable) for each individual, such as the height of each student. The analysis looks at how often each value or range of values occurs.
frequency
The number of times a value, category or interval occurs in a data set.
relative frequency
A frequency divided by the total number of data values. It can be written as a decimal, fraction or percent, and all the relative frequencies add to 1 (100%).
cumulative frequency
The running total of frequencies: the number of values in a class plus all the classes before it.
frequency distribution
A table or graph that shows every possible value or interval of a variable together with its frequency.
class (interval)
One of the equal-width ranges used to group continuous data, such as 7 kg ≤ mass < 9 kg.
midpoint
The value halfway between the lower and upper boundaries of a class: (lower + upper) ÷ 2.

One attribute, many individuals

Imagine you ask everyone in your Grade 12 class one question: How many people live in your home? Every answer is a number, and every answer is about the same attribute. That is one-variable data.

With 30 answers in a messy list, nobody can see a pattern. The first job of a statistician is to organize the data: count how often each value occurs. That count is called a frequency, and the organized table is a frequency distribution. Almost every graph and statistic in this unit starts from a frequency distribution.

Remember from Grade 9: in Principles of Mathematics (MTH1W), in the unit Data, Statistics and Mathematical Modelling, you found the mean, median, mode, range, quartiles and IQR, drew box plots, histograms and stem-and-leaf plots, and described the shape of data. This unit uses all of that, adds the standard deviation, percentiles, z-scores, the normal model and margins of error, and asks you to write careful conclusions like a university student would.

Which kind of variable is it?

The curriculum says one-variable analysis is about the frequencies associated with one attribute. Before you count, decide what kind of attribute you have, because it decides which tables and graphs make sense. (The unit Organization of Data for Analysis studies types of data in detail; here is the short version.)

  • Categorical (qualitative) data puts individuals into groups: favourite season, mode of transport, province of birth. If the categories have a natural order (small, medium, large; strongly disagree to strongly agree) the data is ordinal; if not, it is nominal.
  • Numerical (quantitative) data is a count or a measurement.
  • Discrete data can only take separate values, usually counts: number of people in a home, goals in a game.
  • Continuous data can take any value in a range, usually measurements: mass, time, height, temperature.

Discrete data with only a few different values can be counted value by value. Continuous data (or discrete data with many different values) is grouped into intervals, also called classes or bins.

Not every number is numerical data

A postal code, a jersey number or a student number is made of digits, but it is a label, so it is categorical. A good test: does it make sense to find an average? The average jersey number on the Toronto Maple Leafs means nothing.

The four columns of a frequency table

For each value (or class) you can record:

  1. Frequency f: how many times it occurs.
  2. Relative frequency = f ÷ n, where n is the total number of values. It shows the proportion of the data in that class, so data sets of different sizes can be compared.
  3. Cumulative frequency: add the frequencies from the top down. The last entry equals n.
  4. Cumulative relative frequency = cumulative frequency ÷ n. The last entry is 1, or 100%.

Cumulative columns answer questions like "How many students live with at most four people?" in one step.

Worked example

Example 1: A frequency table for discrete data

Thirty students reported how many people live in their home:

4, 3, 5, 2, 4, 4, 3, 6, 4, 1, 3, 5, 4, 2, 3, 4, 7, 5, 4, 3, 2, 4, 5, 3, 4, 6, 3, 4, 2, 5

Make a frequency table with relative and cumulative frequencies. What percent of students live with at most 4 people?

  1. The variable is discrete numerical (a count) with only 7 different values, so list each value from 1 to 7.
  2. Tally carefully. A good check: cross out each value as you count it. The frequencies are 1, 4, 7, 10, 5, 2, 1, which add to 30 ✓.
  3. Relative frequency for 4 people: 10 ÷ 30 ≈ 0.333, or 33.3%.
  4. Cumulative frequency: 1, then 1 + 4 = 5, then 5 + 7 = 12, then 12 + 10 = 22, then 27, 29 and 30 ✓.
  5. "At most 4 people" means 1, 2, 3 or 4 people. Read the cumulative frequency in the row for 4: 22 students, and 22 ÷ 30 ≈ 73.3%.

About 73.3% of the students live with at most 4 people. The full table is below.

People in homeFrequency fRelative freq.PercentCumulative freq.Cumulative %
110.0333.3%13.3%
240.13313.3%516.7%
370.23323.3%1240.0%
4100.33333.3%2273.3%
550.16716.7%2790.0%
620.0676.7%2996.7%
710.0333.3%30100.0%
Frequency distribution of household size for 30 students. The relative frequencies add to 1 (allowing for rounding).
People living in the home, 30 students1234567number of people in the household
A dot plot is a quick picture of the same frequency table: each dot is one student. The tallest stack (10 dots at 4 people) is the mode.

Grouping continuous data into classes

Continuous data rarely repeats exactly. If 24 pumpkins are weighed to the nearest tenth of a kilogram, almost every mass is different, so a value-by-value table would just be the list again. Instead, group the data into classes.

Rules for good classes

  • Use about 5 to 12 classes (fewer for small data sets, more for large ones).
  • Make every class the same width.
  • Classes must not overlap and must cover every value. Write them as 5 ≤ m < 7 or [5, 7): the square bracket means 5 is included, the round bracket means 7 is not. Then a value of exactly 7 belongs in the next class.
  • Width ≈ range ÷ number of classes, rounded up to a convenient number.
  • Start the first class at a convenient number at or just below the minimum.
Worked example

Example 2: Grouping continuous data

The masses (kg) of 24 pumpkins entered at a fall fair are:

3.2, 4.8, 5.1, 5.6, 6.0, 6.3, 6.7, 7.0, 7.2, 7.4, 7.9, 8.1, 8.3, 8.5, 8.8, 9.0, 9.4, 9.9, 10.2, 10.8, 11.5, 12.1, 13.0, 14.6

Organize the data into about 6 classes and make a frequency table with midpoints.

  1. Range = 14.6 − 3.2 = 11.4 kg.
  2. Width ≈ 11.4 ÷ 6 = 1.9 kg. Round up to a convenient 2 kg.
  3. Start at 3 kg (just below the minimum): [3, 5), [5, 7), [7, 9), [9, 11), [11, 13), [13, 15). Six classes cover 3 to 15 ✓.
  4. Count: [3, 5) has 3.2 and 4.8, so f = 2. [5, 7) has 5.1, 5.6, 6.0, 6.3, 6.7, so f = 5. The value 7.0 goes in [7, 9), which has 8 values. Then [9, 11) has 5, [11, 13) has 2, [13, 15) has 2.
  5. Check: 2 + 5 + 8 + 5 + 2 + 2 = 24 ✓.
  6. Midpoints: (3 + 5) ÷ 2 = 4, then 6, 8, 10, 12, 14.

Classes [3, 5), [5, 7), [7, 9), [9, 11), [11, 13), [13, 15) with frequencies 2, 5, 8, 5, 2, 2 and midpoints 4, 6, 8, 10, 12, 14.

[3, 5)[5, 7)[7, 9)[9, 11)[11, 13)[13, 15)34567891011121314157.0 kggoes in [7, 9), not in [5, 7)Six classes of width 2 kg cover 3.2 kg to 14.6 kgmass of pumpkin (kg)A square bracket [ includes the endpoint; a round bracket ) leaves it out.
Equal classes that touch but do not overlap. A value on a boundary, like 7.0 kg, always goes into the class that starts at that number.
Mass (kg)MidpointFrequencyRelative freq.Cumulative freq.
[3, 5)420.0832
[5, 7)650.2087
[7, 9)880.33315
[9, 11)1050.20820
[11, 13)1220.08322
[13, 15)1420.08324
Grouped frequency distribution for the pumpkin masses. Grouping loses the exact values, but the pattern becomes clear: most pumpkins are between 5 kg and 11 kg.

Counting with technology

Real data sets have hundreds or thousands of values (Statistics Canada and the Census at School project publish data sets you can download). Nobody tallies those by hand. In a spreadsheet such as Google Sheets or Excel, with the data in cells A2 to A501:

  • =COUNTIF(A2:A501, 4) counts the cells equal to 4.
  • =COUNTIFS(A2:A501, ">=7", A2:A501, "<9") counts values in the class [7, 9).
  • =COUNT(A2:A501) gives n, so relative frequency = COUNTIF(...) ÷ COUNT(...).

A pivot table or the FREQUENCY function can build the whole table at once. Be careful: Excel's FREQUENCY function uses classes that include the upper boundary (it counts values ≤ each bin value), so state your boundaries clearly when you report a table made that way.

Just for fun

A statistician's favourite cereal? Frequency Flakes: you always know how many are in each bowl.

Hands-on activity

Letters in a word: your own frequency distribution

You need: any book or a long newspaper or magazine article, paper, a pencil, and (optional) a spreadsheet.

  1. Open the book to any page. Starting at the first full sentence, record the number of letters in each of the next 50 words (ignore numbers and punctuation; count a hyphenated word as one word).
  2. Make a frequency table with columns for word length, frequency, relative frequency, cumulative frequency and cumulative relative frequency.
  3. Check that your frequencies add to 50 and your relative frequencies add to about 1.
  4. Answer: what is the most common word length? What percent of words have at most 4 letters? What percent have more than 7?
  5. Repeat with 50 words from a children's picture book or a science textbook, and compare the cumulative percent at 4 letters.

What to look for: in ordinary English text, short words (2 to 4 letters) are usually most common, and the cumulative percent at 4 letters is often more than half. A science textbook usually has a smaller cumulative percent at 4 letters than a children's book, because it uses longer words. Your exact numbers will depend on the page.

Your turn

1

Classify each variable as categorical (nominal or ordinal) or numerical (discrete or continuous): (a) number of texts sent yesterday, (b) time to run 100 m, (c) T-shirt size (S, M, L, XL), (d) favourite NHL team.

2

Using the household-size table in Example 1, how many students live with more than 4 people?

3

In Example 1, what is the relative frequency of households of 3 people, as a fraction, a decimal and a percent?

4

A data set has a minimum of 41 and a maximum of 97. You want about 6 classes. Suggest a class width and the first class.

5

Why should the classes 10–20, 20–30, 30–40 be rewritten?

6

In the pumpkin table, what percent of pumpkins have a mass under 9 kg?

7

Find the midpoint of the class [2.5, 3.0).

More practice: warm-up

1

A class has 25 students and 6 of them walk to school. What is the relative frequency of walking, as a percent?

2

The frequencies in a table are 3, 8, 12, 5 and 2. What is n?

3

Find the cumulative frequencies for the frequencies 3, 8, 12, 5, 2.

4

Is "number of maple trees on a street" discrete or continuous?

5

In the class [15, 20), is 20 included?

More practice: on your own

1

Suppose the daily high temperatures (°C) in Thunder Bay for 14 days in January were: −21, −18, −15, −24, −9, −12, −17, −19, −8, −14, −22, −11, −16, −13. Group them into classes of width 4 starting at −24, and give the frequencies.

2

A cumulative relative frequency column reads 0.10, 0.35, 0.70, 0.90, 1.00. Find each class's relative frequency.

3

If the table in the previous question has n = 200, how many values are in the third class?

4

Two schools surveyed students about part-time jobs. School A: 84 of 210 have a job. School B: 60 of 125 have a job. Which school has the greater proportion with jobs? Why compare relative frequencies?

5

Write the spreadsheet formula that counts the values in A2:A301 that are at least 50 but less than 60.

Challenge

1

A grouped table of 80 exam marks uses classes [40, 50), [50, 60), ..., [90, 100]. The cumulative frequencies are 4, 13, 31, 55, 72, 80. (a) How many marks are in [70, 80)? (b) What percent of marks are at least 80? (c) Why is the last class written [90, 100] with a square bracket at 100?

2

A data set of 500 commute times has minimum 2 min and maximum 118 min. A student chooses 4 classes of width 30. Another chooses 60 classes of width 2. Explain why both are poor choices and suggest a better one.

3

Explain why the relative frequencies in a table might add to 0.999 or 1.001 instead of exactly 1, and how you should report this.

Check your understanding

Quiz

1.

Which of these is continuous numerical data?

2.

A table has n = 40 and a class with frequency 6. What is the relative frequency of that class?

3.

The cumulative frequencies of a table are 5, 12, 20, 26, 30. What is the frequency of the third class?

4.

Which set of classes is correctly written for continuous data from 0 to 30?

5.

Data has a range of 47 and you want about 5 classes. Which class width is the best choice?

6.

In a frequency table, what is the last entry of the cumulative relative frequency column?

For parents and teachers

Big idea (D1.1, D1.3): one-variable analysis starts with a frequency distribution. Your teen should be able to choose between a value-by-value table (discrete data with few values) and a grouped table (continuous data), and to add relative and cumulative columns.

How to help: Do the letter-counting activity together, one person reading word lengths and the other tallying. Ask questions that need the cumulative column: "What fraction of words have 5 letters or fewer?"

Common difficulties:

  • Overlapping classes (10–20, 20–30). Insist on the [10, 20) notation.
  • Forgetting to check that the frequencies add to n. This one check catches most tallying errors.
  • Rounding the width down (then the classes do not reach the maximum).
  • Treating labels (postal codes, jersey numbers) as numbers.