コースへようこそ!

R による数値データの推測

Mine Cetinkaya-Rundel

Associate Professor of the Practice, Duke University

マンハッタンの家賃

ある日、クレイグスリストのマンハッタン版から「オーナー直接」掲載の1BRアパートを20件ランダムに選択しました。

マンハッタンの典型的な家賃を表すには、平均と中央値のどちらが適切でしょうか?

マンハッタンの家賃

R による数値データの推測

ブートストラップ手法

  • データが母集団を代表すると仮定する
  • 自力で問題を解決するという発想(ブートストラップ)
R による数値データの推測

観測サンプル

標本中央値 = $2,350

観測サンプルとブートストラップ母集団

R による数値データの推測

ブートストラップ母集団

ブートストラップ母集団

R による数値データの推測

ブートストラップの手順

  1. ブートストラップサンプルを取得する — 元のサンプルと同じサイズで、復元抽出によりランダムに取得したサンプル。

  2. ブートストラップ統計量を計算する — ブートストラップサンプルから計算した平均・中央値・割合などの統計量。

  3. 手順(1)と(2)を多数繰り返してブートストラップ分布を作成する — ブートストラップ統計量の分布。

R による数値データの推測

ブートストラップの手順(R)

library(infer)

___ %>%                               # start with data frame
  specify(response = ___) %>%         # specify the variable of interest
R による数値データの推測

ブートストラップの手順(R)

library(infer)

___ %>%                               # start with data frame
  specify(response = ___) %>%         # specify the variable of interest
  generate(reps = ___, type = "bootstrap") %>%  # generate bootstrap samples
R による数値データの推測

ブートストラップの手順(R)

library(infer)

___ %>%                               # start with data frame
  specify(response = ___) %>%         # specify the variable of interest
  generate(reps = ___, type = "bootstrap") %>%  # generate bootstrap samples
  calculate(stat = "___")             # calculate bootstrap statistic
R による数値データの推測

ブートストラップ区間の構築

library(infer)

___ %>%                               # start with data frame
  specify(response = ___) %>%         # specify the variable of interest
  generate(reps = ___, type = "bootstrap") %>%  # generate bootstrap samples
  calculate(stat = "___")             # calculate bootstrap statistic

ブートストラップ分布(軸なし)

R による数値データの推測

ブートストラップ区間の構築

library(infer)

___ %>%                               # start with data frame
  specify(response = ___) %>%         # specify the variable of interest
  generate(reps = ___, type = "bootstrap") %>%  # generate bootstrap samples
  calculate(stat = "___")             # calculate bootstrap statistic

ブートストラップ分布(括弧付き)

R による数値データの推測

練習しましょう!

R による数値データの推測

Preparing Video For Download...