Compute the Unpooled Standard Error of a Difference in Conversion Rates
Quick Overview
Implement a Python function that returns the unpooled Wald standard error of the difference between control and treatment conversion rates. It tests whether you combine per-arm binomial variances correctly, know when the pooled version applies, and can turn the result into a confidence interval.
Compute the Unpooled Standard Error of a Difference in Conversion Rates
Role: Data Scientist
Category: Analytics & Experimentation
Difficulty: easy
Interview Round: Other
Implement `unpooled_se_diff(conv_control, n_control, conv_treatment, n_treatment)` in `solution.py`. Given conversions and sample size for control and treatment, return the unpooled (separate-variance / Wald) standard error of the difference in conversion rates, not the pooled-under-`H0` SE.
The formula:
```python
p_c = conv_control / n_control
p_t = conv_treatment / n_treatment
SE = sqrt(p_c*(1 - p_c)/n_control + p_t*(1 - p_t)/n_treatment)
```
Requirements:
- Each arm contributes its own `p*(1-p)/n` term: do not pool the rates.
- Variance denominators are `n`, not `n-1`.
- Return an unrounded `float`.
Example:
```python
unpooled_se_diff(200, 2000, 240, 2000) # -> 0.009889388252060894
```
```hint Variances add, standard errors do not
For two independent arms, the variance of the difference is the sum of the two variances. Add the per-arm terms first and take one square root at the end.
```
### What a Strong Answer Covers
- Computes each arm's rate separately and builds one `p*(1-p)/n` term per arm.
- Sums the two variance terms before taking the square root, with `n` as the denominator.
- Explains why the unpooled SE goes with a confidence interval and when the pooled SE is the right choice.
- Handles the edge cases: an arm with zero users, and rates of exactly 0 or 1.
### Follow-up Questions
- When would you use the pooled SE instead?
- How would you turn this SE into a 95% confidence interval?
- If both arms grow to four times their sample size at the same rates, what happens to the SE?
Overview: Implement a Python function that returns the unpooled Wald standard error of the difference between control and treatment conversion rates. It tests whether you combine per-arm binomial variances correctly, know when the pooled version applies, and can turn the result into a confidence interval.
Implement unpooled_se_diff(conv_control, n_control, conv_treatment, n_treatment) in solution.py. Given conversions and sample size for control and treatment, return the unpooled (separate-variance / Wald) standard error of the difference in conversion rates, not the pooled-under-H0 SE.