200 m free time with confidence interval
Now, you will practice parameter estimation and computation of confidence intervals by computing the mean and median swim time for the men's 200 freestyle heats. The median is useful because it is immune to heavy tails in the distribution of swim times, such as the slow swimmers in the heats. mens_200_free_heats
is still in your namespace.
Cet exercice fait partie du cours
Case Studies in Statistical Thinking
Instructions
- Compute the mean and median swim times, storing them in variables
mean_time
andmedian_time
. The swim times are contained inmens_200_free_heats
. - Draw 10,000 bootstrap replicates each of the mean and median swim time using
dcst.draw_bs_reps()
. Store the results inbs_reps_mean
andbs_reps_median
. - Compute the 95% confidence intervals for the mean and median using the bootstrap replicates and
np.percentile()
. - Hit 'Submit Answer' to print the results to the screen!
Exercice interactif pratique
Essayez cet exercice en complétant cet exemple de code.
# Compute mean and median swim times
mean_time = ____
median_time = ____
# Draw 10,000 bootstrap replicates of the mean and median
bs_reps_mean = ____
bs_reps_median = ____
# Compute the 95% confidence intervals
conf_int_mean = ____
conf_int_median = ____
# Print the result to the screen
print("""
mean time: {0:.2f} sec.
95% conf int of mean: [{1:.2f}, {2:.2f}] sec.
median time: {3:.2f} sec.
95% conf int of median: [{4:.2f}, {5:.2f}] sec.
""".format(mean_time, *conf_int_mean, median_time, *conf_int_median))