Get startedGet started for free

Understanding confidence intervals

In this exercise, you'll develop your intuition for how various parameter values impact confidence intervals. Specifically, you will explore through the get_ci() function how changes widen or tighten the confidence interval. This is the function signature, where cl is the confidence level and sd is the standard deviation.

def get_ci(value, cl, sd):
  loc = sci.norm.ppf(1 - cl/2)
  rng_val = sci.norm.cdf(loc - value/sd)

  lwr_bnd = value - rng_val
  upr_bnd = value + rng_val 

  return_val = (lwr_bnd, upr_bnd)
  return(return_val)

This exercise is part of the course

Customer Analytics and A/B Testing in Python

View Course

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

# Compute and print the confidence interval
confidence_interval  = get_ci(____, ____, ____)
print(confidence_interval)
Edit and Run Code