01 / 22

Inference Procedures:
Categorical Data

Learn to identify and select the correct inference procedure: one-sample \( z \)-test for proportions, two-sample \( z \)-test, and \( \chi^2 \) tests for categorical variables.

AP Statistics

What Is Categorical Data?

Categorical data places each observation into one of a set of non-overlapping groups (categories). Unlike quantitative data, you count how many fall in each category rather than measuring a numerical value.

One Categorical Variable
Favorite color: Red, Blue, Green. You record counts per category.
Two Categorical Variables
Gender vs. Preferred major: a two-way table of counts.

Proportions vs. Counts

Every categorical inference procedure deals with either proportions (\( \hat{p} \)) or frequency counts. Knowing which one your question targets is the first step to selecting the right test.

Proportion-based
"Is the proportion of voters who support Policy X equal to 0.5?" Uses \( z \)-tests for proportions.
Count-based
"Do the observed counts match an expected distribution?" Uses \( \chi^2 \) tests on frequency tables.

The Three Core Procedures

Categorical Inference 1-Proportion z-Test 1 sample, 1 category 2-Proportion z-Test 2 samples, 1 category Chi-Square Tests Counts in table(s) GOF Test 1 variable, known dist. Homogeneity 2+ populations same? Independence 2 vars associated?

One-Proportion \( z \)-Test

Use when you have one sample and want to test whether the population proportion \( p \) equals a claimed value \( p_0 \).

1
Random: data come from a random sample or randomized experiment.
2
10% condition: \( n \leq 0.10N \) (sample is < 10% of population).
3
Large Counts: \( np_0 \geq 10 \) and \( n(1 - p_0) \geq 10 \).

Two-Proportion \( z \)-Test

Use when comparing proportions from two independent samples (or two groups in an experiment).

\( \chi^2 \) Goodness-of-Fit Test

Use when you have one categorical variable with \( k \) categories and want to test whether the observed distribution matches a hypothesized distribution.

✓
Random sample or randomized experiment.
✓
10% condition if sampling without replacement.
✓
Large Counts: all expected counts \( E_i \geq 5 \).

Homogeneity vs. Independence

Both use the same formula and the same two-way table format, but the research question and sampling method differ.

Homogeneity Independence
Question Same distribution across populations? Are two variables associated?
Sampling Independent samples from 2+ populations One sample, classify by 2 variables
Hypotheses \( H_0 \): distributions are the same \( H_0 \): variables are independent
df \( (r - 1)(c - 1) \) for both

A university population with four visibly different sampling routes

A university campus provides a setting for comparing sampling and study-design routes.The way people or groups enter a study determines its design. Sampling within groups, selecting whole groups and assigning treatments answer different questions.

The same table shape can reflect different designs

A four-by-four table of unknown cells contrasts one SRS of 600 with four separate samples of 150.In this four-by-four setup, one SRS of 600 people classified twice supports an independence test; four separate SRSs of 150 support homogeneity. Both have df = 9. The actual cell counts are needed to calculate and check expected counts.

\( z \)-Test vs. \( \chi^2 \): When to Use Which?

\( z \)-Test for Proportions
Variable has exactly 2 outcomes (success/failure). You focus on a single proportion or compare two proportions. Can do one- or two-sided tests.
\( \chi^2 \) Tests
Variable has 2 or more categories. You compare observed counts to expected counts across a distribution. Always right-tailed (one-sided).

The Decision Flowchart

How many samples? 1 sample 2+ samples or 2 vars How many categories? 2 1-Prop z-Test 3+ GOF Test What's the question? Compare 2 props 2-Prop z-Test Same dist? Homogeneity Associated? Independence All paths assume categorical (non-quantitative) data.

How to Select the Right Test

1
Identify the variable type. Is it categorical? If quantitative, stop: use a \( t \)-test instead.
2
Count the samples. One sample or two (or more) independent groups?
3
Count the categories. Exactly 2 outcomes (binary) or 3+ categories?
4
Frame the question. Are you testing a claimed proportion, comparing groups, or checking a distribution/association?
5
Check conditions. Random, 10%, and Large Counts (the threshold depends on the test).

Example 1: Coin Fairness

1
Variable: Outcome of flip: categorical, 2 categories (Heads/Tails).
2
Samples: One sample of 200 flips.
3
Question: Does \( p = 0.50 \)? This is a claimed single proportion.
4
Procedure: One-proportion \( z \)-test. \( H_0: p = 0.50 \), \( H_a: p \neq 0.50 \).

Example 2: Drug vs. Placebo

1
Variable: Recovery status: categorical, 2 categories (recovered/not).
2
Samples: Two independent groups (drug and placebo).
3
Question: Is \( p_1 > p_2 \)? Comparing two proportions.
4
Procedure: Two-proportion \( z \)-test. \( H_0: p_1 = p_2 \), \( H_a: p_1 > p_2 \).

Example 3: M&M Colors

1
Variable: Color: categorical, 6 categories.
2
Samples: One sample of 500 M&Ms.
3
Question: Does the observed distribution match the claimed distribution?
4
Procedure: \( \chi^2 \) Goodness-of-Fit test. \( \text{df} = 6 - 1 = 5 \).

Example 4: Smoking and Education

Key clue: one sample
A single random sample is drawn, then each person is classified on two variables.
Procedure
\( \chi^2 \) test of independence. \( H_0 \): Smoking and education are independent. \( \text{df} = (2-1)(3-1) = 2 \).

Common Mistakes

✕ Using a \( t \)-test on proportions
\( t \)-tests are for means of quantitative data. For categorical data, use \( z \) or \( \chi^2 \).
✕ Confusing homogeneity and independence
Check the sampling design: one sample classified two ways = independence; separate samples compared = homogeneity.
✕ Forgetting the Large Counts condition
For \( \chi^2 \): all \( E_i \geq 5 \). For \( z \)-tests: \( np_0 \geq 10 \) and \( n(1-p_0) \geq 10 \). Skipping this invalidates the test.

Summary Comparison

Procedure Samples Categories Conditions
1-Prop \( z \) 1 2 (binary) \( np_0 \geq 10 \), \( n(1-p_0) \geq 10 \)
2-Prop \( z \) 2 2 (binary) Pooled large counts \( \geq 10 \)
\( \chi^2 \) GOF 1 2+ All \( E_i \geq 5 \)
\( \chi^2 \) Homogeneity 2+ 2+ All \( E_i \geq 5 \)
\( \chi^2 \) Independence 1 2+ each var All \( E_i \geq 5 \)

Question 1 of 5

A school principal claims that 70% of students buy lunch. A random sample of 150 students finds that 96 buy lunch. Which test should you use?

Question 2 of 5

Researchers sample 300 voters from City A and 350 from City B and record whether each supports a ballot measure. They want to know if support differs. Which test?

Question 3 of 5

A die manufacturer claims each face has a \( \frac{1}{6} \) probability. You roll the die 600 times and record the counts for each face. Which test?

Question 4 of 5

A researcher surveys one random sample of 500 employees and classifies each by department (Sales, Engineering, HR) and job satisfaction (Satisfied, Neutral, Dissatisfied). She wants to determine if satisfaction depends on department. Which test?

Question 5 of 5

Separate random samples of teens from three countries are surveyed about preferred social media platform (A, B, or C). Researchers want to know if the distribution of preferences is the same across countries. Which test?