サンプルの反復
標本平均のような点推定量を計算するとき、その値はサンプルに含まれた行に依存します。つまり、答えにはある程度のランダム性が含まれます。このランダム性によって生じるばらつきを定量化するには、多くのサンプルを作成し、それぞれのサンプルについて標本平均(または別の統計量)を計算します。
attrition_pop が利用可能です。pandas と matplotlib.pyplot は通常どおりのエイリアスで読み込まれています。
この演習はコースの一部です
Pythonで学ぶサンプリング
実践的なインタラクティブ演習
このサンプルコードを完成させて、この演習に挑戦してみましょう。
# Create an empty list
____
# Loop 500 times to create 500 sample means
____:
mean_attritions.append(
attrition_pop.sample(n=60)['Attrition'].mean()
)
# Print out the first few entries of the list
print(mean_attritions[0:5])