Ztest Proportions Calculator
Free Ztest proportions Calculator for hypothesis tests. Enter values to get step-by-step solutions with formulas and graphs.
Reviewed for accuracy by Daniel Agrici, Founder & Lead Developer
Ztest Proportions Calculator
Calculator
Adjust values & calculateEnter your values below. Every result is computed in your browser โ no data is sent to any server.
Formula: z = (pฬโ - pฬโ) / โ(pฬ(1-pฬ)(1/nโ + 1/nโ))
Worked example โ z = -2.209 | p-value = 0.027 | Significant โ Version B has higher conversion rate
Formula
z = (pฬโ - pฬโ) / โ(pฬ(1-pฬ)(1/nโ + 1/nโ))
The z-statistic is calculated by dividing the difference in sample proportions by the pooled standard error. The pooled proportion p-hat combines both samples under the null hypothesis assumption that the true proportions are equal.
Worked Examples
Example 1: A/B Test for Website Conversion
Problem:Version A: 120 conversions out of 1,500 visitors. Version B: 155 conversions out of 1,500 visitors. Test at ฮฑ = 0.05 (two-tailed).
Solution:p1 = 120/1500 = 0.0800, p2 = 155/1500 = 0.1033 Pooled p = (120+155)/(1500+1500) = 0.0917 SE = โ(0.0917 ร 0.9083 ร (1/1500 + 1/1500)) = 0.01055 z = (0.0800 - 0.1033) / 0.01055 = -2.209 p-value = 0.0272 (two-tailed) 0.0272 < 0.05 โ Reject Hโ
Result:z = -2.209 | p-value = 0.027 | Significant โ Version B has higher conversion rate
Example 2: Clinical Trial Drug Effectiveness
Problem:Treatment group: 85 recoveries out of 200 patients. Control group: 60 recoveries out of 200 patients. Test at ฮฑ = 0.01 (right-tailed).
Solution:p1 = 85/200 = 0.425, p2 = 60/200 = 0.300 Pooled p = (85+60)/(200+200) = 0.3625 SE = โ(0.3625 ร 0.6375 ร (1/200 + 1/200)) = 0.04808 z = (0.425 - 0.300) / 0.04808 = 2.600 p-value = 0.0047 (right-tailed) 0.0047 < 0.01 โ Reject Hโ
Result:z = 2.600 | p-value = 0.005 | Significant โ Treatment group has higher recovery rate
Frequently Asked Questions
What is a two-proportion z-test?
A two-proportion z-test is a statistical hypothesis test used to determine whether there is a significant difference between the proportions of two independent groups. It is commonly used in A/B testing, clinical trials, and survey comparisons. The null hypothesis (H0) states that the two population proportions are equal (p1 = p2), while the alternative hypothesis (H1) states they are different. The test calculates a z-statistic by dividing the observed difference in sample proportions by the standard error of the difference. The resulting z-value is compared to the standard normal distribution to obtain a p-value. If the p-value is less than the chosen significance level (typically 0.05), we reject the null hypothesis and conclude there is a statistically significant difference. This test assumes independent random samples, sufficiently large sample sizes (np and n(1-p) both greater than 5), and that the sampling distribution of the difference in proportions is approximately normal.
When should I use a one-tailed vs two-tailed z-test?
The choice between one-tailed and two-tailed tests depends on your research question and hypothesis. Use a two-tailed test when you want to detect any difference between two proportions, regardless of direction, meaning you are asking whether p1 is different from p2 (could be higher or lower). This is the default and most conservative choice. Use a right-tailed (upper) test when you specifically hypothesize that one proportion is greater than another, such as testing whether a new treatment has a higher success rate. Use a left-tailed (lower) test when you hypothesize that one proportion is less than another. One-tailed tests have more statistical power to detect differences in the specified direction because the entire significance level is concentrated on one side. However, they cannot detect significant differences in the opposite direction. Most researchers recommend two-tailed tests unless there is a strong theoretical reason to expect the difference in a specific direction.
How do I interpret the p-value in a proportions z-test?
The p-value represents the probability of observing a difference in sample proportions as extreme as (or more extreme than) the one calculated, assuming the null hypothesis is true (that the population proportions are actually equal). A small p-value, typically below 0.05, indicates that such an extreme result would be very unlikely if there were truly no difference, leading us to reject the null hypothesis. For example, a p-value of 0.03 means there is only a 3% chance of seeing the observed difference (or a larger one) if the proportions were actually equal. Importantly, the p-value does not tell you the probability that the null hypothesis is true, the magnitude of the practical effect, or whether the result is meaningful in a real-world context. Always consider the confidence interval and effect size alongside the p-value, as statistically significant results with very large samples may represent trivially small practical differences.
What are the assumptions and requirements for this test?
The two-proportion z-test requires several assumptions to produce valid results. First, both samples must be independent random samples from their respective populations, meaning the observations in one sample do not influence the other. Second, the sample sizes must be large enough for the normal approximation to be valid: specifically, n1 times p1, n1 times (1-p1), n2 times p2, and n2 times (1-p2) should all be at least 5, though some references suggest at least 10. Third, the sampling should be without replacement from populations at least 10 times larger than the sample sizes, or equivalently, each sample should represent less than 10% of its population. Fourth, each observation should be a binary outcome (success or failure). When these assumptions are not met, alternative tests should be considered: Fisher's exact test for small samples, chi-squared test with continuity correction, or bootstrapping methods for non-standard situations.
How is the pooled proportion calculated and why is it used?
The pooled proportion is calculated as p_hat = (x1 + x2) / (n1 + n2), where x1 and x2 are the number of successes in each sample and n1 and n2 are the sample sizes. It represents the overall proportion of successes assuming both samples come from the same population, which is exactly what the null hypothesis states. The pooled proportion is used in the denominator of the z-test statistic to calculate the standard error because, under the null hypothesis, the best estimate of the common population proportion comes from combining both samples. This is analogous to using the pooled variance in a two-sample t-test. The pooled standard error formula is SE = sqrt(p_hat * (1 - p_hat) * (1/n1 + 1/n2)). Note that the pooled proportion is only used for the hypothesis test, not for constructing confidence intervals. For confidence intervals around the difference in proportions, each sample's individual proportion is used in the standard error calculation because we are estimating the actual difference rather than testing whether it equals zero.
References
Reviewed for accuracy by Daniel Agrici, Founder & Lead Developer ยท Editorial policy
Related Calculators
๐งฎDescriptive Statistics Calculator
Calculate descriptive statistics with inputs, formulas, and instant results.
๐งฎBayesian Posterior Calculator
Calculate bayesian posterior with inputs, formulas, and instant results.
๐งฎFalse Discovery Rate Calculator
Calculate false discovery rate with inputs, formulas, and instant results.
๐งฎCorrelation Coefficient Calculator
Calculate correlation coefficient with inputs, formulas, and instant results.
๐งฎBinomial Distribution Calculator
Calculate binomial distribution with inputs, formulas, and instant results.
๐งฎChi Square Test Calculator
Calculate chi square test with inputs, formulas, and instant results.
๐งฎEffect Size Calculator
Calculate effect size with inputs, formulas, and instant results.