Statistical Comparison of Two Independent Bernoulli Rates
Statistics & ExperimentsModel answerLast updated
Evaluate whether two independent coin-tossing experiments with different sample sizes show a statistically significant difference in head probabilities.
You are given dataset results from two separate, independent coin flipping trials:
- Coin A: Tossing the coin 100 times yields 40 heads.
- Coin B: Tossing the coin 1,000 times yields 600 heads.
Analyze these trial results to evaluate if there is a statistically significant difference between the true underlying probability of getting a head for Coin A versus Coin B.
Address the following points in your analysis:
- Define the null ($H_0$) and alternative ($H_1$) statistical hypotheses.
- Identify the appropriate parametric test and discuss alternative valid testing methods.
- Calculate the test statistic, standard error, and corresponding p-value.
- Calculate a 95% confidence interval for the difference between the two proportions ($p_A - p_B$).
- Outline key statistical assumptions and explain the effect of the unequal sample sizes ($n_A = 100$ vs $n_B = 1000$) on standard error and estimation precision.
Hints
Hint 1
Recall why the pooled standard error is used for hypothesis testing under the null, whereas the unpooled standard error is used for constructing confidence intervals.
Hint 2
Check whether the sample sizes and observed counts satisfy the conditions for the normal approximation.
Hint 3
Consider how variance scales with sample size—which coin contributes most to the variance of the difference?
Model answer
Medium Try it yourself first — then compare your approach, complexity and edge cases.
Structured Solution Walkthrough
1. Data Summary and Observed Proportions
Let $x$ denote the count of heads and $n$ denote total tosses:
| Parameter | Coin A | Coin B | Total (Pooled) |
|---|---|---|---|
| Tosses ($n$) | 100 | 1,000 | 1,100 |
| Heads ($x$) | 40 | 600 | 640 |
| Sample Proportion ($\hat{p}$) | 0.40 | 0.60 | 0.5818 ($\frac{640}{1100}$) |
The observed sample difference is: $$\Delta \hat{p} = \hat{p}_A - \hat{p}_B = 0.40 - 0.60 = -0.20$$
2. Hypotheses Formulation
Because the objective is to determine if the probabilities differ (without specifying a prior direction), we formulate a two-tailed test:
- Null Hypothesis ($H_0$): $p_A = p_B$ (The true probability of heads is identical for both coins).
- Alternative Hypothesis ($H_1$): $p_A \neq p_B$ (The true probabilities of heads are not equal).
Note: Selecting a one-sided hypothesis after observing $\hat{p}_A < \hat{p}_B$ is invalid as it artificially doubles the false-positive rate ($\alpha$).
3. Choice of Statistical Test
The standard test for comparing two independent rates is the two-sample $z$-test for proportions.
- Equivalence to $\chi^2$ Test: This test is mathematically equivalent to a Pearson Chi-Square ($\chi^2$) test of independence on a $2 \times 2$ contingency table with 1 degree of freedom, where $z^2 = \chi^2$.
- Validity Conditions: The normal approximation requires that the expected counts under $H_0$ exceed 5 to 10 for every cell.
- Under $H_0$, expected heads for Coin A = $100 \times 0.5818 = 58.18$
- Expected tails for Coin A = $100 \times (1 - 0.5818) = 41.82$
- Expected counts for Coin B are $581.82$ (heads) and $418.18$ (tails). All expected counts comfortably exceed standard thresholds, validating the normal approximation. (For extremely small sample sizes, Fisher's Exact Test would be used instead).
4. Test Statistic and P-value Computation
When testing $H_0: p_A = p_B$, we assume a shared underlying probability $p$. We estimate this via the pooled proportion: $$\hat{p}_{\text{pool}} = \frac{x_A + x_B}{n_A + n_B} = \frac{40 + 600}{100 + 1000} = \frac{640}{1100} \approx 0.5818$$
The pooled standard error ($SE_0$) is: $$SE_0 = \sqrt{\hat{p}{\text{pool}} (1 - \hat{p}{\text{pool}}) \left( \frac{1}{n_A} + \frac{1}{n_B} \right)}$$ $$SE_0 = \sqrt{0.5818 \times 0.4182 \times \left( \frac{1}{100} + \frac{1}{1000} \right)} = \sqrt{0.2433 \times 0.011} = \sqrt{0.002676} \approx 0.05173$$
Calculating the $z$-statistic: $$z = \frac{\hat{p}_A - \hat{p}_B}{SE_0} = \frac{-0.20}{0.05173} \approx -3.866$$
Computing the two-tailed p-value using the standard normal distribution ($\Phi$): $$p\text{-value} = 2 \times \Phi(-3.866) \approx 0.00011 \quad (1.1 \times 10^{-4})$$
Conclusion: At standard significance levels ($\alpha = 0.05, 0.01,$ or $0.001$), we reject $H_0$. There is strong evidence that the two coins have different success probabilities.
5. 95% Confidence Interval for $(p_A - p_B)$
To build a confidence interval, we do not pool standard errors. Pooling assumes $p_A = p_B$, whereas standard confidence intervals estimate the parameter difference without assuming the null hypothesis is true.
The unpooled standard error ($SE_{\text{unpooled}}$) is: $$SE_{\text{unpooled}} = \sqrt{\frac{\hat{p}_A (1 - \hat{p}_A)}{n_A} + \frac{\hat{p}_B (1 - \hat{p}B)}{n_B}}$$ $$SE{\text{unpooled}} = \sqrt{\frac{0.40 \times 0.60}{100} + \frac{0.60 \times 0.40}{1000}} = \sqrt{0.0024 + 0.00024} = \sqrt{0.00264} \approx 0.05138$$
Using $z_{0.025} = 1.96$ for a 95% confidence level: $$\text{Margin of Error (ME)} = 1.96 \times 0.05138 \approx 0.1007$$ $$\text{95% CI} = -0.20 \pm 0.1007 = (-0.3007, -0.0993) \approx [-0.30, -0.10]$$
The interval does not contain $0$, which aligns with rejecting $H_0$. We are 95% confident that Coin A's head rate is between 10 and 30 percentage points lower than Coin B's.
6. Key Statistical Assumptions and Sample Size Dynamics
Core Assumptions
- Independent Bernoulli Trials: Each flip within a coin series is independent and identically distributed with constant success probability $p$.
- Sample Independence: Flipping Coin A is independent of flipping Coin B (unpaired data).
- Large Sample Validity: Central Limit Theorem applies to proportions since $n\hat{p} \ge 10$ and $n(1-\hat{p}) \ge 10$ for both datasets.
Understanding the Unequal Sample Sizes ($n_A = 100, n_B = 1000$)
- Validity: Asymmetric sample sizes do not invalidate the two-proportion $z$-test.
- Variance Bottleneck: Looking at the variance contribution: $$\text{Var}(\hat{p}_A) = \frac{0.24}{100} = 0.0024 \quad (90.9% \text{ of total variance})$$ $$\text{Var}(\hat{p}_B) = \frac{0.24}{1000} = 0.00024 \quad (9.1% \text{ of total variance})$$ Because Coin A has $\frac{1}{10}\text{th}$ the sample size of Coin B, ~91% of the total uncertainty stems from Coin A.
- Data Collection Strategy: Gathering another 10,000 tosses for Coin B would diminish overall standard error by negligible amounts. To tighten the confidence interval efficiently, additional data collection must focus on Coin A.
Common Candidate Pitfalls
- Mistakenly Pooling for CI: Using pooled $SE$ for confidence intervals ( pooled $SE$ assumes $H_0$ holds, which contradicts the purpose of estimating parameter ranges under uncertainty).
- Flawed Hypothesis Comparison: Separately testing $H_0: p_A = 0.5$ ($p \approx 0.046$) and $H_0: p_B = 0.5$ ($p < 0.0001$), then concluding the coins differ because both differ from 0.5. (Difference between two estimates must be tested directly).
- Proposing Downsampling: Suggesting dropping 900 samples from Coin B to equalize group sizes, which discards valuable statistical power.