Minimum detectable effect for a two-proportion test via the arcsine (Cohen's h) transform

Quick Overview

Write a Python function that returns the absolute minimum detectable effect of a two-sided two-proportion test for a fixed per-group sample size, using the statsmodels arcsine (Cohen's h) convention. It tests inverse power analysis, inverting the arcsine transform back to a rate, and reasoning about absolute versus relative lift.

Minimum detectable effect for a two-proportion test via the arcsine (Cohen's h) transform

Role: Data Scientist

Category: Analytics & Experimentation

Difficulty: medium

Interview Round: Other

Implement `def mde_absolute_arcsine(p_control: float, n_per_group: float, alpha: float = 0.05, power: float = 0.8) -> float` in `solution.py`. Given a fixed per-group sample size, return the absolute minimum detectable effect above `p_control` using the `statsmodels` arcsine (Cohen's h) convention. Requirements: - `h = NormalIndPower().solve_power(effect_size=None, nobs1=n_per_group, alpha=alpha, power=power, ratio=1.0, alternative='two-sided')`. - Take the upward direction (`h > 0`): `p_treatment = sin(h/2 + arcsin(sqrt(p_control)))**2`. - Return `p_treatment - p_control`. A relative lift or `p_treatment` itself is wrong. - Do not round or ceil the result. Example: ```python mde_absolute_arcsine(0.10, 5000) # -> 0.017427859652555278 ``` The trailing digits depend on the numerical solve inside `solve_power`, so compare results with a tolerance of about 1e-6. ```hint Which argument is unknown `solve_power` solves for whichever argument you pass as `None`. The sample size is fixed here, so think about which quantity is left to find and what scale it is on. ``` ```hint Back to rates The solver's answer is in arcsine units. Write out the definition of Cohen's h and solve it for the treatment rate before you subtract the control rate. ``` ### What a Strong Answer Covers - Solves for the effect size with the per-group n fixed, equal allocation and a two-sided alternative - Inverts the arcsine transform in the upward direction to recover the treatment rate - Returns the absolute difference unrounded and explains how it relates to a relative lift - Checks the example by hand, allowing for numerical tolerance - Handles edge cases such as a baseline so close to 1 that the upward inversion breaks down ### Follow-up Questions - Why use the arcsine (Cohen's h) transform instead of a raw proportion difference? - How would you report the downward MDE (a detectable decrease below control)? - If you quadruple `n_per_group`, what happens to the MDE, and why is it not exactly half?

Overview: Write a Python function that returns the absolute minimum detectable effect of a two-sided two-proportion test for a fixed per-group sample size, using the statsmodels arcsine (Cohen's h) convention. It tests inverse power analysis, inverting the arcsine transform back to a rate, and reasoning about absolute versus relative lift.

Nov 24, 2026
mediumData ScientistOtherAnalytics & Experimentation
0
0

Implement def mde_absolute_arcsine(p_control: float, n_per_group: float, alpha: float = 0.05, power: float = 0.8) -> float in solution.py. Given a fixed per-group sample size, return the absolute minimum detectable effect above p_control using the statsmodels arcsine (Cohen's h) convention.

Requirements:

  • h = NormalIndPower().solve_power(effect_size=None, nobs1=n_per_group, alpha=alpha, power=power, ratio=1.0, alternative='two-sided') .
  • Take the upward direction ( h > 0 ): p_treatment = sin(h/2 + arcsin(sqrt(p_control)))**2 .
  • Return p_treatment - p_control . A relative lift or p_treatment itself is wrong.
  • Do not round or ceil the result.

Example:

mde_absolute_arcsine(0.10, 5000)  # -> 0.017427859652555278

The trailing digits depend on the numerical solve inside solve_power, so compare results with a tolerance of about 1e-6.

What a Strong Answer Covers Guidance

  • Solves for the effect size with the per-group n fixed, equal allocation and a two-sided alternative
  • Inverts the arcsine transform in the upward direction to recover the treatment rate
  • Returns the absolute difference unrounded and explains how it relates to a relative lift
  • Checks the example by hand, allowing for numerical tolerance
  • Handles edge cases such as a baseline so close to 1 that the upward inversion breaks down

Follow-up Questions Guidance

  • Why use the arcsine (Cohen's h) transform instead of a raw proportion difference?
  • How would you report the downward MDE (a detectable decrease below control)?
  • If you quadruple n_per_group , what happens to the MDE, and why is it not exactly half?