www.crosshyou.info

政府統計の総合窓口のデータや、OECDやUCIやのデータを使って、Rの練習をしています。ときどき、読書記録も載せています。

日銀短観2019年12月調査のデータ分析2 - The Central Limit Theorem(中心極限定理)を実感する。

 

www.crosshyou.info

 の続きです。

今回は、central limit theoremを実感してみたいと思います。日本語だと中心極限定理ですね。

Michael J. Crawley の Statistics: An Introduction Using R

 

Statistics: An Introduction Using R

Statistics: An Introduction Using R

  • 作者:Michael J. Crawley
  • 出版社/メーカー: Wiley
  • 発売日: 2014/11/24
  • メディア: ペーパーバック
 

には、If you take repeated samples from a population and calculate their averages, then these averages will be normally distributed. とあります。

Now(現状)の分布を見てみます。hist関数でヒストグラムを見てみます。

f:id:cross_hyou:20191214142452p:plain

f:id:cross_hyou:20191214142504p:plain

こんな形状ですね。

こういう分布のデータからデータを1つ抜き出します。これを10000回繰り返します。

f:id:cross_hyou:20191214144125p:plain

f:id:cross_hyou:20191214144136p:plain

こんな感じですね。

それでは、Nowの中から3つサンプルを取り出して、その平均値を計算するのを同じく1万回繰り返してみます。

f:id:cross_hyou:20191214144743p:plain

f:id:cross_hyou:20191214144757p:plain

このように、正規分布のような分布になります。

outcomeは1つの値を取り出したもの、heikinは3つの値を取り出して平均値を計算したものです。

qqnorm関数、qqline関数を実行してみます。

f:id:cross_hyou:20191214152231p:plain

f:id:cross_hyou:20191214152241p:plain

heikinのほうは正規分布とみていい感じですね。

今回は以上です。