Categorical Variables, Frequency Tables and Proportions – STA 270, Section 2.1 – Study Notes
offline

Difficulty: Introductory | Prerequisites: None, though familiarity with basic percentages and fractions will help.

Big Picture

This is one of the first topics in introductory statistics: how to summarise and visualise categorical (qualitative) data. Before you can do any inference or hypothesis testing later in the course, you need to know how raw observations become tables, charts and proportions. If you can read a frequency table and compute a proportion, you have the foundation for everything from confidence intervals to chi-square tests. You should already be comfortable with fractions and percentages, but no prior statistics knowledge is assumed.


TL;DR

Categorical variables place observations into groups (e.g. "Corporate", "Government") rather than measuring a quantity. You summarise a single categorical variable with a frequency table and proportion, and visualise it with a bar graph or pie chart. For two categorical variables you build a two-way (contingency) table and compare groups using conditional proportions or a difference in proportions.


Key Terms

Categorical variable (qualitative variable)

A variable whose values are group labels or categories, not numbers you can do arithmetic on.

In simple terms, this means: the data tells you which group something belongs to, not how much of something there is.

Frequency table

A table listing every category of a variable alongside the count of observations that fall in that category.

Think of it as a tally sheet that answers "how many of each?".

Relative frequency table

A frequency table where each count has been converted to a proportion (or percentage) of the total.

Think of it as the same tally sheet, but now each entry answers "what fraction of the whole?" instead of "how many?".

Proportion (p for population, p-hat for sample)

The fraction of observations in a given category: count in category divided by total count. Notated as p when it describes an entire population, and as p̂ ("p-hat") when it describes a sample.

In simple terms, this means: it is just the percentage expressed as a decimal.

Bar graph (bar chart, bar plot)

A chart where each category gets its own bar, and the bar's height equals the frequency or relative frequency. Gaps between bars signal that the categories are separate, not continuous.

Pie chart

A circular chart where each slice's area represents that category's proportion of the whole. Works best with a small number of categories arranged in ascending or descending order.

Two-way table (contingency table)

A table that cross-tabulates two categorical variables, showing the frequency (or relative frequency) for every combination of their categories. One variable defines the rows, the other the columns.

Marginal totals (marginals)

The row totals and column totals in a two-way table. They sit along the margins of the table.

Grand total

The sum of all observations in the two-way table, equal to the sum of any set of marginals.

Difference in proportions

The result of subtracting the proportion in one group from the proportion in another group for the same category. Used to compare how two groups differ on a single outcome.

Side-by-side bar chart

A bar graph where, for each category, a cluster of bars sits next to each other, one bar per group.

Segmented bar chart (stacked bar chart)

Like a side-by-side bar chart, but the bars for each group are stacked on top of one another rather than placed next to each other.


Core Content

Frequency Tables

  • The starting point for any categorical variable is turning raw data into a summary.

    • Raw data is a list of individual observations (e.g. each employee's previous job sector).

    • A frequency table condenses that list into category labels plus counts.

  • Example (Recruitment study, n = 1,345 employees at public-interest organisations):

    • Corporate: 501

    • Public-interest: 683

    • Government: 94

    • Other: 67

    • Total: 1,345

  • A relative frequency table replaces counts with proportions. Each value equals the category count divided by the total.

    • Corporate: 0.372

    • Public-interest: 0.508

    • Government: 0.070

    • Other: 0.050

    • Total: 1.000

  • The relative frequencies must always sum to 1 (or 100%). If they do not, there is an error somewhere.

Proportions

  • The proportion in a category is calculated as:

    • proportion = (number in category) / (total number)

  • Notation matters:

    • p = the true population proportion (a parameter).

    • p̂ ("p-hat") = the sample proportion (a statistic).

  • Proportions and percentages are interchangeable: a proportion of 0.07 is the same as 7%.

  • Example: proportion of employees recruited from government positions = 94 / 1,345 ≈ 0.07, or about 7%.

  • Interpretation template: "Approximately [percentage] of [the group] were/are [category]." This phrasing is what the exam expects.

Visualisation: Bar Graphs and Pie Charts

  • Bar graph (bar chart / bar plot)

    • The height of each bar equals the frequency or relative frequency for that category.

    • Steps to build one: label the frequency axis, label the category axis, draw a rectangle for each category, and leave gaps between bars.

    • The gaps are important: they show the categories are distinct and separate (unlike a histogram, where bars touch because the data is continuous).

  • Pie chart

    • Each slice's area corresponds to the proportion in that category.

    • Tips for a good pie chart: keep the number of categories small (too many slices become unreadable), and arrange slices in ascending or descending order of percentage.

  • Both bar graphs and pie charts are valid for one categorical variable. Bar graphs are generally easier to read when comparing across categories; pie charts are better for showing parts of a whole.


Formulas

  • Proportion: p̂ = (number in category) / (total number)

  • Relative frequency: same formula as proportion, applied to every category. The sum of all relative frequencies = 1.

  • Difference in proportions: p̂₁ – p̂₂ (subtract one group's proportion from the other for the same category).

    • Example: difference in TV preference between males and females = 0.40 – 0.10 = 0.30, or 30 percentage points.


Real-World Applications

Frequency tables and proportions are used whenever someone needs to summarise survey responses, poll results, or any data that falls into named groups. Market researchers use them to report brand preferences; public health analysts use them to summarise disease prevalence across demographic groups. The recruitment study in this section is a direct example: an organisation wanted to know where its leaders came from, so it tallied previous-job sectors and reported proportions.


Common Misconceptions

  • Students sometimes try to compute a mean or median for a categorical variable. You cannot: categories have no numerical order, so arithmetic operations do not apply.

  • Confusing "proportion of A who are B" with "proportion of B who are A." These are different questions with different denominators. (40% of males prefer TV is not the same as 80% of TV-preferring students being male.)

  • Forgetting that relative frequencies must sum to 1.000 (or 100%). If your column does not add up, re-check your arithmetic.

  • Treating a bar graph like a histogram. Bar graphs have gaps between bars because the categories are discrete. Histograms (for quantitative data) have no gaps.


Why It Matters / Exam Flags

  • ⚠️ Know the proportion formula cold. You will almost certainly be asked to compute one from a frequency table.

  • ⚠️ Be able to interpret a proportion in a sentence. "Approximately 7% of the employees were recruited from government positions" is the expected form.

  • ⚠️ Understand the difference between a frequency table and a relative frequency table, and be able to convert one to the other.

  • ⚠️ Know the construction rules for a bar graph (labelling, bar height, gaps between bars).

  • ⚠️ Be ready for questions that ask you to choose the right chart type for categorical data (bar graph or pie chart, not histogram or scatterplot).


Quick Self-Test

  1. True or false: a proportion of 0.25 is the same as 25%.

  1. True or false: the bars in a bar graph for categorical data should touch, with no gaps.

  1. Fill in the blank: the sum of all relative frequencies in a table must equal ___.

  1. True or false: a pie chart is a good choice when you have 15 categories.

  1. Fill in the blank: the symbol for a sample proportion is ___.


Practice Q&A

Q: In the recruitment study (n = 1,345), what proportion of employees were recruited from corporate positions?

A: 501 / 1,345 = 0.372, or about 37.2%.

Q: If a frequency table for a variable with three categories shows counts of 120, 80, and 200, what is the relative frequency of the second category?

A: Total = 120 + 80 + 200 = 400. Relative frequency = 80 / 400 = 0.20, or 20%.

Q: A pie chart of student majors has five slices. The four visible percentages are 30%, 25%, 20%, and 15%. What percentage does the fifth slice represent?

A: 100% – 30% – 25% – 20% – 15% = 10%.

Q: Why must a bar graph for categorical data leave gaps between the bars?

A: The gaps indicate that the categories are distinct and separate, not points on a continuous scale.

Q: A relative frequency table shows values of 0.45, 0.30, and 0.20 for three categories. Is this table correct? Why or why not?

A: The values sum to 0.95, not 1.00, so the table contains an error. Either a category is missing or one of the proportions is wrong.


Connections to Other Topics

This material connects directly to two-way table analysis (covered in the companion notes), where you apply frequency tables and proportions to two categorical variables at once. Later in the course, these proportions feed into inference: confidence intervals for a single proportion, hypothesis tests comparing two proportions, and chi-square tests for independence in contingency tables. If you are comfortable computing and interpreting proportions here, those later topics will build naturally on top.


Related Terms / Search Tags

categorical variable, qualitative variable, frequency table, relative frequency table, proportion, p-hat, sample proportion, population proportion, bar graph, bar chart, bar plot, pie chart, percentage, relative frequency, count, tally, categorical data summary, STA 270, intro statistics, descriptive statistics, summarising data, data visualisation, frequency distribution