Skip to content

Comparing two proportions

Test whether two web page versions have different conversion rates with a pooled two-proportion z test, and give an interval for the difference.

It opens on

Larkspur's version B converts 91 of 1,300 visitors and version A 54 of 1,200. Which converts better in the samples, and by how many percentage points?

Why it matters

A/B tests decide which page, price or message to roll out, and a manager must tell a real difference in rates from sampling noise.

Good to know first

  • sample proportion and z test

Step by step

  1. The A/B test and its data

    Set up the hypotheses for two proportions, compute the sample proportions, and check the conditions.

    A common mix-up

    The gap of 2.5 points proves B is better.

    In fact: Samples vary, so we must ask whether a gap this big is likely when the true rates are equal.

  2. The pooled two-proportion z test

    Compute the pooled proportion, the standard error, z and the p-value, and state the decision.

    (54 + 91) ÷ 2,500 = 145 ÷ 2,500 = 0.058.

    pooled proportion = 0.058

    A common mix-up

    The standard error uses each sample proportion separately in the test.

    In fact: The test assumes H₀, so it pools the two samples into one common proportion.

  3. The interval and the business decision

    Build the 95% interval for the difference, interpret it, and turn it into extra orders.

    0.045 × 0.955 / 1,200 = 0.0000358 and 0.070 × 0.930 / 1,300 = 0.0000501, so SE = √0.0000859 = 0.00927.

    SE = 0.00927

    A common mix-up

    The interval says B is 2.5 points better.

    In fact: 2.5 points is only the estimate, and the true gap could plausibly be anywhere from 0.7 to 4.3 points.

Try it

A mailing to 400 customers gets 30 orders and another to 500 customers gets 55 orders. Find both sample proportions and their difference, second minus first.Answer

0.075, 0.11 and 0.035

Hint: Successes ÷ n for each

Using the mailing data in S1's try, 30 of 400 and 55 of 500, find the pooled proportion, SE and z.Answer

Pooled = 85 ÷ 900 = 0.0944, SE = 0.01964, z = 1.78

Hint: Pool first

The difference is 0.04 and the unpooled SE is 0.015. Give the 95% interval and say whether 0 is inside.Answer

0.04 ± 0.0294, so 0.0106 to 0.0694, 0 is not inside

Hint: Margin = 1.96 × SE

What is the sample difference, B minus A?Answer

0.025, which is 2.5 percentage points

What is z for a difference of 0.025 with SE 0.00936?Answer

2.67

Comparing two proportions

30 minutes every month. No card.