쌍 부트스트랩

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...