Decide whether to reject the null hypothesis from a confidence interval

Quick Overview

Write a Python function that decides a two-sided A/B test from the confidence interval of the treatment minus control difference. It tests the duality between confidence intervals and hypothesis tests, the handling of an endpoint that lands exactly on zero, and returning a clean boolean.

Decide whether to reject the null hypothesis from a confidence interval

Role: Data Scientist

Category: Analytics & Experimentation

Difficulty: easy

Interview Round: Other

Implement `def reject_from_ci(ci_lower: float, ci_upper: float) -> bool` in `solution.py`. Given a two-sided CI for the treatment minus control difference, return whether to reject H0 of no difference. Requirements: - Reject if and only if `ci_lower > 0` or `ci_upper < 0`. - Zero exactly at either endpoint returns `False`. - Return a Python `bool`. Example: ```python reject_from_ci(0.0006, 0.0394) # True (0 is below the interval) reject_from_ci(-0.01, 0.03) # False (0 is inside the interval) ``` ```hint Picture a number line Place the interval and zero on a number line. There are two separate ways for zero to end up outside the interval, and one boundary case to settle. ``` ### What a Strong Answer Covers - The link between a two-sided confidence interval and the two-sided test at the matching level - Both ways the interval can exclude zero - How an endpoint of exactly zero is treated, and why - A return value that is a real Python `bool` ### Follow-up Questions - If one endpoint of a 95% interval is exactly zero, what is the p-value of the matching test? - Why can a confidence interval for a difference in proportions disagree with a pooled two-proportion z-test near the boundary? - How would the rule change for a one-sided test that only looks for an improvement? - The separate 95% intervals for treatment and control overlap. Does that mean the difference is not significant?

Overview: Write a Python function that decides a two-sided A/B test from the confidence interval of the treatment minus control difference. It tests the duality between confidence intervals and hypothesis tests, the handling of an endpoint that lands exactly on zero, and returning a clean boolean.

Nov 24, 2026
easyData ScientistOtherAnalytics & Experimentation
0
0

Implement def reject_from_ci(ci_lower: float, ci_upper: float) -> bool in solution.py. Given a two-sided CI for the treatment minus control difference, return whether to reject H0 of no difference.

Requirements:

  • Reject if and only if ci_lower > 0 or ci_upper < 0 .
  • Zero exactly at either endpoint returns False .
  • Return a Python bool .

Example:

reject_from_ci(0.0006, 0.0394)  # True  (0 is below the interval)
reject_from_ci(-0.01, 0.03)     # False (0 is inside the interval)

What a Strong Answer Covers Guidance

  • The link between a two-sided confidence interval and the two-sided test at the matching level
  • Both ways the interval can exclude zero
  • How an endpoint of exactly zero is treated, and why
  • A return value that is a real Python bool

Follow-up Questions Guidance

  • If one endpoint of a 95% interval is exactly zero, what is the p-value of the matching test?
  • Why can a confidence interval for a difference in proportions disagree with a pooled two-proportion z-test near the boundary?
  • How would the rule change for a one-sided test that only looks for an improvement?
  • The separate 95% intervals for treatment and control overlap. Does that mean the difference is not significant?