ペア・ブートストラップ

Pythonで学ぶ統計思考(パート2)

Justin Bois

Lecturer at the California Institute of Technology

ノンパラメトリック推論

  • データの背後にあるモデルや確率分布を仮定しない
Pythonで学ぶ統計思考(パート2)

2008年 米国スイングステート選挙結果

ch2-3.004.png

1 データ出典: Data.gov (https://www.data.gov/)
Pythonで学ぶ統計思考(パート2)

線形回帰のペア・ブートストラップ

  • データをペアで再標本化する
  • 再標本化データから傾きと切片を計算
  • 各傾き・切片がブートストラップ複製
  • 複製のパーセンタイルから信頼区間を算出
Pythonで学ぶ統計思考(パート2)

ペア・ブートストラップサンプルの生成

np.arange(7)
array([0, 1, 2, 3, 4, 5, 6])
inds = np.arange(len(total_votes))

bs_inds = np.random.choice(inds, len(inds))
bs_total_votes = total_votes[bs_inds] bs_dem_share = dem_share[bs_inds]
Pythonで学ぶ統計思考(パート2)

ペア・ブートストラップ複製の計算

bs_slope, bs_intercept = np.polyfit(bs_total_votes, 
                                    bs_dem_share, 1)

bs_slope, bs_intercept
(3.9053605692223672e-05, 40.387910131803025)
np.polyfit(total_votes, dem_share, 1)  # 元データでの当てはめ
array([  4.03707170e-05,   4.01139120e+01])
Pythonで学ぶ統計思考(パート2)

2008年 米国スイングステート選挙結果

ch2-3.022.png

1 データ出典: Data.gov (https://www.data.gov/)
Pythonで学ぶ統計思考(パート2)

練習しましょう!

Pythonで学ぶ統計思考(パート2)

Preparing Video For Download...