Jump to content

Two-proportion Z-test

From Wikipedia, the free encyclopedia

The Two-proportion Z-test is a statistical method used to determine whether the difference between the proportions of two groups, coming from a binomial distribution is statistically significant.[1] This approach relies on the assumption that the sample proportions follow a normal distribution under the Central Limit Theorem, allowing the use of Z-statistics for hypothesis testing and confidence interval estimation. It is used in various fields to compare success rates, response rates, or other proportions across different groups.

Hypothesis test

[edit]

The z-test for comparing two proportions is a statistical method used to evaluate whether the proportion of a certain characteristic differs significantly between two independent samples. This test leverages the property that the sample proportions (which is the average of observations coming from a Bernoulli distribution) are asymptotically normal under the Central Limit Theorem, enabling the construction of a z-test.

The test involves two competing hypotheses:

  • Null hypothesis (H0): The proportions in the two populations are equal, i.e., .
  • Alternative hypothesis (H1): The proportions in the two populations are not equal, i.e., (two-tailed) or / (one-tailed).

The z-statistic for comparing two proportions is computed using:[2]

Where:

  • = sample proportion in the first sample
  • = sample proportion in the second sample
  • = size of the first sample
  • = size of the second sample
  • = pooled proportion, calculated as , where and are the counts of successes in the two samples.

The pooled proportion is used to estimate the shared probability of success under the null hypothesis, and the standard error accounts for variability across the two samples.

The z-test determines statistical significance by comparing the calculated z-statistic to a critical value. E.g., for a significance level of we reject the null hypothesis if (for a two-tailed test). Or, alternatively, by computing the p-value and rejecting the null hypothesis if .

Confidence Interval

[edit]

The confidence interval for the difference between two proportions, based on the definitions above, is:

Where:

  • is the critical value of the standard normal distribution (e.g., 1.96 for a 95% confidence level).

This interval provides a range of plausible values for the true difference between population proportions.

Using the z-test confidence intervals for hypothesis testing would give the same results as the chi-squared test for a two-by-two contingency table.[3]: 216–7 [4]: 875  Fisher’s exact test is more suitable for when the sample sizes are small.

Notice how the variance estimation is different between the hypothesis testing and the confidence intervals. The first uses a pooled variance (based on the null hypothesis), while the second has to estimate the variance using each sample separately (so as to allow for the confidence interval to accommodate a range of differences in proportions). This difference may lead to slightly different results if using the confidence interval as an alternative to the hypothesis testing method.

Minimum Detectable Effect (MDE)

[edit]

The Minimum Detectable Effect (MDE) is the smallest difference between two proportions ( and ) that a statistical test can detect for a chosen Type I error level (), statistical power (), and sample sizes ( and ). It is commonly used in study design to determine whether the sample sizes allows for a test with sufficient sensitivity to detect meaningful differences.

The MDE for when using the (two-sided) z-test formula for comparing two proportions, incorporating critical values for and , and the standard errors of the proportions:[5][6]

Where:

  • : Critical value for the significance level.
  • : Quantile for the desired power.
  • : When assuming the null is correct.

The MDE depends on the sample sizes, baseline proportions (), and test parameters. When the baseline proportions are not known, they need to be assumed or roughly estimated from a small study. Larger samples or smaller power requirements leads to a smaller MDE, making the test more sensitive to smaller differences. Researchers may use the MDE to assess the feasibility of detecting meaningful differences before conducting a study.


[Proof]

The Minimal Detectable Effect (MDE) is the smallest difference, denoted as , that satisfies two essential criteria in hypothesis testing:

  1. The null hypothesis () is rejected at the specified significance level ().
  2. Statistical power () is achieved under the alternative hypothesis ().

Given that the distribution is normal under the null and the alternative hypothesis, for the two criteria to happen, it is required that the distance of will be such that the critical value for rejecting the null () is exactly in the location in which the probability of exceeding this value, under the null, is (), and also that the probability of exceeding this value, under the alternative, is .

The first criterion establishes the critical value required to reject the null hypothesis. The second criterion specifies how far the alternative distribution must be from to ensure that the probability of exceeding it under the alternative hypothesis is at least .[7][8]

Condition 1: Rejecting

Under the null hypothesis, the test statistic is based on the pooled standard error ():

might be estimated (as described above).

To reject , the observed difference must exceed the critical threshold () after properly inflating it to the SE:

If the MDE is defined solely as , the statistical power would be only 50% because the alternative distribution is symmetric about the threshold. To achieve a higher power level, an additional component is required in the MDE calculation.

Condition 2: Achieving Power

Under the alternative hypothesis, the standard error is (). It means that if the alternative distribution was centered around some value (e.g., ), then the minimal must be at least larger than to ensure that the probability of detecting the difference under the alternative hypothesis is at least .

Combining Conditions

To meet both conditions, the total detectable difference incorporates components from both the null and alternative distributions. The MDE is defined as:

By summing the critical thresholds from the null and adding to it the relevant quantile from the alternative distributions, the MDE ensures the test satisfies the dual requirements of rejecting at significance level and achieving statistical power of at least .


Assumptions and Conditions

[edit]

To ensure valid results, the following assumptions must be met:

  1. Independent random samples: The samples must be drawn independently from the populations of interest.
  2. Large sample sizes: Typically, and should exceed 30. [citation needed]
  3. Success/failure condition: [citation needed]
    1. and
    2. and

The z-test is most reliable when sample sizes are large, and all assumptions are satisfied.

See also

[edit]

References

[edit]
  1. ^ Hypothesis Test: Difference Between Proportions
  2. ^ How can we determine whether two processes produce the same proportion of defectives?
  3. ^ Confidence Intervals for the Difference Between Two Proportions
  4. ^ Newcombe, R. G. 1998. 'Interval Estimation for the Difference Between Independent Proportions: Comparison of Eleven Methods.' Statistics in Medicine, 17, pp. 873-890.
  5. ^ COOLSerdash (https://stats.stackexchange.com/users/21054/coolserdash), Two proportion sample size calculation, URL (version: 2023-04-14): https://stats.stackexchange.com/q/612894
  6. ^ Chow S-C, Shao J, Wang H, Lokhnygina Y (2018): Sample size calculations in clinical research. 3rd ed. CRC Press.
  7. ^ Calculating Sample Sizes for A/B Tests
  8. ^ Power, minimal detectable effect, and bucket size estimation in A/B tests (has some nice figures to illustrate the tradeoffs)