Inference for Proportions
OpenIntro Statistics · CC BY-SA 3.0 · Chapter 6
When data are counts or categories, proportions replace means. The Z-test for proportions uses the normal approximation to the binomial. The chi-square test extends this to tables with many categories.
Try comparing two sign-up rates and shuffling treatment labels. The formulas below extend the comparison to common proportion procedures. Read the guided introduction β
Two versions of a sign-up page
Each visitor receives exactly one randomly assigned version, A or B; the outcome is whether they sign up. This simulated world has sign-up probability 30% for A. You control Bβs true difference.
No study yet. Predict whether one studyβs observed difference will equal the true difference.
For the randomization test, keep every observed sign-up and non-sign-up fixed. Shuffle them between equally sized groups, as if assignment had no effect on anyoneβs outcome. Count shuffled differences at least as far from zero as the observed difference, in either direction.
Read the chart as a table
| Value range | Count |
|---|---|
| -100.0β-95.0 | 0 |
| -95.0β-90.0 | 0 |
| -90.0β-85.0 | 0 |
| -85.0β-80.0 | 0 |
| -80.0β-75.0 | 0 |
| -75.0β-70.0 | 0 |
| -70.0β-65.0 | 0 |
| -65.0β-60.0 | 0 |
| -60.0β-55.0 | 0 |
| -55.0β-50.0 | 0 |
| -50.0β-45.0 | 0 |
| -45.0β-40.0 | 0 |
| -40.0β-35.0 | 0 |
| -35.0β-30.0 | 0 |
| -30.0β-25.0 | 0 |
| -25.0β-20.0 | 0 |
| -20.0β-15.0 | 0 |
| -15.0β-10.0 | 0 |
| -10.0β-5.0 | 0 |
| -5.0β0.0 | 0 |
| 0.0β5.0 | 0 |
| 5.0β10.0 | 0 |
| 10.0β15.0 | 0 |
| 15.0β20.0 | 0 |
| 20.0β25.0 | 0 |
| 25.0β30.0 | 0 |
| 30.0β35.0 | 0 |
| 35.0β40.0 | 0 |
| 40.0β45.0 | 0 |
| 45.0β50.0 | 0 |
| 50.0β55.0 | 0 |
| 55.0β60.0 | 0 |
| 60.0β65.0 | 0 |
| 65.0β70.0 | 0 |
| 70.0β75.0 | 0 |
| 75.0β80.0 | 0 |
| 80.0β85.0 | 0 |
| 85.0β90.0 | 0 |
| 90.0β95.0 | 0 |
| 95.0β100.0 | 0 |
Each range includes its lower end and excludes its upper end, except the last range, which includes both.
0 shuffled assignments.
At most the latest 10,000 shuffles are retained. The Monte Carlo calculation is (extreme shuffles + 1) / (shuffles + 1), so finite simulation never claims a zero p-value. A new study or setting clears the old reference distribution.
One-proportion Z-test
Test whether a sample proportion p-hat differs from a hypothesized value p0. The test statistic is Z = (p-hat - p0) / sqrt(p0 * (1 - p0) / n). Under the null, Z follows a standard normal distribution when n is large enough (np0 and n(1 - p0) both at least 10).
Two-proportion Z-test
Compare proportions from two independent groups. Under the null hypothesis p1 = p2, pool the data to estimate the common proportion, then compute the standard error from the pooled value.
Chi-square goodness of fit
Test whether observed counts across k categories match expected proportions. The test statistic sums (observed - expected)^2 / expected across all cells. It follows a chi-square distribution with k - 1 degrees of freedom.
Chi-square test for independence
Test whether two categorical variables are associated. Arrange data in a contingency table, compute expected counts from row and column totals, then apply the chi-square formula. Degrees of freedom = (rows - 1)(cols - 1).
Notation reference
| Symbol | Formula | Meaning |
|---|---|---|
| Z | (p̂ - p0) / SE | Test statistic for proportions |
| SE | sqrt(p0(1-p0)/n) | Standard error under H0 |
| p̂ | x / n | Sample proportion |
| χ² | Σ(O-E)²/E | Chi-square test statistic |
| df | (r-1)(c-1) | Degrees of freedom (independence) |