95% Normal Confidence Interval for a Mean

Basics
BasicsConfidence IntervalsInferenceGoogleMetaJane Street

Problem

Given sample_mean, sample_std, and sample size n, implement ci_95_mean(sample_mean, sample_std, n) returning (lower, upper) using the normal critical value z=1.96z = 1.96: xˉ±1.96⋅sn\bar{x} \pm 1.96 \cdot \frac{s}{\sqrt{n}}.

Why It Matters: 95% confidence intervals communicate statistical uncertainty on dashboards and A/B test scorecards instead of misleading single point estimates.

Function Signature

import math

def ci_95_mean(sample_mean: float, sample_std: float, n: int) -> tuple[float, float]:

Sample Input & Output

Example 1: Large Sample (n = 100)

Input:

sample_mean = 50.0, sample_std = 10.0, n = 100

Expected Output:

(48.04, 51.96)

Explanation: SEM = 10 / 10 = 1.0, margin = 1.96, giving (48.04, 51.96).

Example 2: 4× Larger Sample Halves Interval Width (n = 400)

Input:

sample_mean = 50.0, sample_std = 10.0, n = 400

Expected Output:

(49.02, 50.98)

Explanation: SEM = 10 / 20 = 0.5, margin = 0.98, giving (49.02, 50.98).

Constraints & Edge Cases

  • Use z = 1.96.
  • Return (lower, upper) as Python floats.
  • Use exact 1.96 as the z-multiplier.

Constraints & Evaluation Criteria

  • Use `z = 1.96`.
  • Return `(lower, upper)` as Python floats.

Hints

Python 3
Loading Code Editor...
+1 Hidden Submit Case
Input / Scenario
50, 10, 100
Expected Output / Criteria
(48.04, 51.96)