1. Learn
  2. /
  3. Courses
  4. /
  5. Practicing Statistics Interview Questions in Python

Connected

Exercise

Applying confidence intervals

In practice, you aren't going to hand-code confidence intervals. Let's utilize the statsmodels package to streamline this process and examine some more tendencies of interval estimates.

In this exercise, we've generated a binomial sample of the number of heads in 50 fair coin flips saved as the heads variable. You'll compute a few different confidence intervals for this sample, and then scale your work for 10 similar samples.

The proportion_confint() function has already been imported to help you compute confidence intervals.

Instructions 1/3

undefined XP
  • 1

    Compute and print a 99% confidence interval for 50 trials; does it contain the true proportion of a fair coin flip?

  • 2

    Adapt your code to generate a 90% confidence interval this time; does it contain the true proportion this time?

  • 3

    Repeat this process of sampling, computing the confidence interval, and printing the result 10 times using a loop.