Drawing conclusions from samples
You've seen how random sampling can be used to choose a sample of data which is (hopefully!) representative of the population you are studying. You've also seen how bias in sampling procedure can result in conclusions that are suspect at best, and completely wrong at worst.
In this exercise you'll analyze the average closing price of the S&P 500. If you take two different samples of trading days and compute confidence intervals for each, should you expect to see the same result? It's time for you to dive in and see!
Cet exercice fait partie du cours
Foundations of Inference in Python
Exercice interactif pratique
Essayez cet exercice en complétant cet exemple de code.
# Sample 1: Select a random sample of 500 rows
sample_df = ____.sample(n=____)
# Compute a 95% confidence interval for the closing price of SP500
sample_ci = stats.____.____(alpha=____,
loc=____.mean(),
scale=____.std()/np.sqrt(____))
print(sample_ci)