開始使用免費開始

200 公尺自由式的信賴區間

現在,請練習參數估計與信賴區間的計算:為男子 200 公尺自由式預賽計算游泳時間的平均數與中位數。中位數很實用,因為當分佈有厚尾(例如預賽中的慢速選手)時,它不受影響。mens_200_free_heats 仍在你的命名空間中。

本練習屬於課程

統計思維個案研究

檢視課程

練習說明

  • 計算游泳時間的平均數與中位數,分別存入變數 mean_timemedian_time。游泳時間存放在 mens_200_free_heats
  • 使用 dcst.draw_bs_reps() 分別對平均數與中位數各抽取 10,000 次自助法重複樣本。將結果分別存入 bs_reps_meanbs_reps_median
  • 使用這些自助法重複樣本與 np.percentile() 計算平均數與中位數的 95% 信賴區間。
  • 按下「送出答案」即可在螢幕上印出結果!

動手互動練習

試著完成這個範例程式碼,體驗一下這個練習。

# 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))
編輯並執行程式碼