Confidence Interval for a Mean

easy
Unit 3 · Statistics III0/3 to milestone

For a large sample, a (1−α)(1-\alpha) confidence interval for the mean is xˉ±z sn\bar x \pm z\,\frac{s}{\sqrt n} with sample std ss (ddof=1).

Implement:

  • normal_quantile(p): the standard normal quantile, found by bisection on the CDF Φ(x)=12(1+erf(x/2))\Phi(x) = \tfrac12(1 + \text{erf}(x/\sqrt2)) over [−10,10][-10, 10] to within 1e-12
  • mean_ci(x, conf=0.95): returns (low, high) using z=z = normal_quantile(1 - (1 - conf) / 2)
#statistics#inference2 visible + 1 hidden tests
solution.py · Python 3.13
Loading editor…
Run your code to see results. ⌘↵ to run · ⌘⇧↵ to submit
Confidence Interval for a Mean · TechGradify