A group has 18 successes and 42 failures. Its success proportion is:
Two categorical variables
Read conditional distributions, relative risk, and confounding in tables.
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
Which procedure?
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.50Basic weekend proportion = 20/80 = 0.25; Plus = 30/60 = 0.50.
Plus minus Basic = 0.25, or 25 percentage points.
Relative risk, Plus versus Basic, = 0.50/0.25 = 2.
The overall weekend proportion is 50/140, which answers a different, marginal question.
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
Risks are 0.12 for A and 0.08 for B. A versus B relative risk is:
Why might an aggregate pattern reverse after stratification?