MaizePrepSTATS 250
Exam 3 · Lec 21

Two categorical variables

Read conditional distributions, relative risk, and confounding in tables.

25 minDraft

Key ideas

Marginal distribution

The overall distribution of one variable, ignoring the categories of the other variable.

Conditional distribution

The distribution of the response within a specified explanatory group. Its denominator is that group’s total.

Relative risk

The outcome proportion in the numerator group divided by the outcome proportion in the reference group. A ratio of 1 means equal risks; it is not a percentage-point difference.

Simpson’s paradox

An aggregate association can reverse after stratifying by a third variable. Different group compositions can produce an aggregate pattern that differs from within-stratum patterns.

Formulas

Conditional proportion
π^A=outcome count in AnA\hat\pi_{A}=\frac{\text{outcome count in A}}{n_A}
State the conditioning group and the outcome.
Difference and ratio
RD=π^A−π^B,RR=π^Aπ^BRD=\hat\pi_A-\hat\pi_B,\qquad RR=\frac{\hat\pi_A}{\hat\pi_B}
A difference of 0.15 is 15 percentage points; a ratio of 1.5 is 50% higher relative risk.

Which procedure?

Two categorical variables; question asks to describe the association
Compare conditional percentages and, for a binary outcome, differences or relative risk.
Question asks about population evidence of association
Move to the chi-square test, after checking design and expected counts.
Worked example

Membership type and weekend visits

A random sample records membership plan and whether a member visited on the weekend. Describe the sample association before testing it. This is an original example with composed R output.

with(members, table(plan, weekend))
         weekend
plan      No Yes
  Basic   60  20
  Plus    30  30
prop.table(with(members, table(plan, weekend)), 1)
         No  Yes
Basic  0.75 0.25
Plus   0.50 0.50
  1. Basic weekend proportion = 20/80 = 0.25; Plus = 30/60 = 0.50.

  2. Plus minus Basic = 0.25, or 25 percentage points.

  3. Relative risk, Plus versus Basic, = 0.50/0.25 = 2.

  4. The overall weekend proportion is 50/140, which answers a different, marginal question.

Answer

In this sample, Plus members are twice as likely to have visited on the weekend as Basic members. Membership is observational; schedules or other factors could confound the association.

Three-question check

1
Lec 21

A group has 18 successes and 42 failures. Its success proportion is:

2
Lec 21

Risks are 0.12 for A and 0.08 for B. A versus B relative risk is:

3
Lec 21

Why might an aggregate pattern reverse after stratification?

MaizePrep is an independent study resource. It is not affiliated with, sponsored by, or endorsed by the University of Michigan. Course names and numbers are used only to describe which class the material covers. Every practice question is original, written in the style of the course.