Exercise

Calculating confidence intervals

Now that you've demonstrated that the sampling distribution for the closing price of the S&P 500 is approximately normally distributed, you'll compute a confidence interval! You want to estimate the mean closing price of the S&P 500, and calculating a confidence interval will do just that for you.

The same data btc_sp_df has been loaded for you, as have the packages pandas as pd, NumPy as np and scipy.stats as stats.

Instructions

100 XP
  • Select a random sample of 500 days from the column Close_SP500.
  • Calculate the mean of this random sample.
  • Calculate the standard error of this random sample as the standard deviation divided by the square root of the sample size.
  • Calculate a 95% confidence interval using the values you just calculated.