선형 회귀와 쌍 부트스트랩

통계적 사고 사례 연구

Justin Bois

Lecturer, Caltech

세균 성장

1 이미지 제공: Jin Park 및 Michael Elowitz, Caltech
통계적 사고 사례 연구

세균 성장

통계적 사고 사례 연구
_ = plt.semilogy(t, bac_area, marker='.', linestyle='none')
_ = plt.xlabel('time (hr)')
_ = plt.ylabel('area (sq. µm)')
plt.show()

통계적 사고 사례 연구

np.polyfit()을 이용한 선형 회귀

slope, intercept = np.polyfit(t, bac_area, 1)

t_theor = np.array([0, 14])
bac_area_theor = slope * t_theor + intercept

_ = plt.plot(t, bac_area, marker='.', linestyle='none')
_ = plt.plot(t_theor, bac_area_theor)
_ = plt.xlabel('time (hr)')
_ = plt.ylabel('area (sq. µm)')
plt.show()
통계적 사고 사례 연구

세균 성장 회귀

통계적 사고 사례 연구

np.polyfit()을 이용한 반로그 선형 회귀

slope, intercept = np.polyfit(t, np.log(bac_area), 1)

t_theor = np.array([0, 14])
bac_area_theor = np.exp(slope * t_theor + intercept)

_ = plt.semilogy(t, bac_area, marker='.', linestyle='none')
_ = plt.semilogy(t_theor, bac_area_theor)
_ = plt.xlabel('time (hr)')
_ = plt.ylabel('area (sq. µm)')
plt.show()
통계적 사고 사례 연구

세균 성장 회귀

통계적 사고 사례 연구

쌍 부트스트랩

  • 데이터를 쌍으로 재샘플링
  • 재샘플링된 데이터에서 기울기와 절편 계산
  • 각 기울기와 절편은 부트스트랩 복제본
  • 부트스트랩 복제본의 백분위수로 신뢰 구간 계산
통계적 사고 사례 연구

쌍 부트스트랩

# Draw 10000 pairs bootstrap reps
slope_reps, int_reps = dcst.draw_bs_pairs_linreg(
  x_data, y_data, size=10000
)

# Compute 95% confidence interval of slope slope_conf_int = np.percentile(slope_reps, [2.5, 97.5])
통계적 사고 사례 연구

연습해 봅시다!

통계적 사고 사례 연구

Preparing Video For Download...