Proportion Test

A Proportion Test checks whether the proportion (percentage or rate) of some outcome differs significantly - either from a known value, or between two independent groups. It's commonly used when the outcome is categorical, such as "converted" vs "not converted."

One-Sample Proportion Test

Compares a single sample proportion against a known or claimed value - for example, checking if a website's click-through rate is really 10%, as claimed.

Two-Sample Proportion Test

Compares proportions between two independent groups - for example, checking whether the conversion rate of Version A of a landing page differs from Version B.

Running a Two-Sample Proportion Test in Python

from statsmodels.stats.proportion import proportions_ztest

# Group A: 50 conversions out of 500 visitors
# Group B: 70 conversions out of 500 visitors
successes = [50, 70]
totals = [500, 500]

z_stat, p_value = proportions_ztest(successes, totals)
print("Z-statistic:", z_stat)
print("P-value:", p_value)

alpha = 0.05
if p_value < alpha:
    print("Reject H0 - conversion rates differ significantly")
else:
    print("Fail to reject H0 - no significant difference found")

Setting Up the Hypotheses

# H0: The two proportions are equal
# H1: The two proportions are not equal
Proportion tests are especially common in marketing and product analytics, where outcomes are naturally binary - a user either clicks, converts, or churns, or they don't.

Coming Up Next

Next, you'll bring these ideas together into A/B Testing - one of the most widely used applications of hypothesis testing in industry.

Ready to Master Data Science?

Join Uncodemy's Data Science Course and build real, job-ready skills with expert mentors.

Explore Course