More Related Content
Similar to データの不備を統計的に見抜く (Gelman’s secret weapon)
Similar to データの不備を統計的に見抜く (Gelman’s secret weapon) (15)
データの不備を統計的に見抜く (Gelman’s secret weapon)
- 2. 自己紹介
• hoxo_m
• 某 EC サイトでデータ分析をやっています
• 作成パッケージ:
– pforeach (R の並列処理を超簡単に書く)
– dplyrr (dplyr の DB用ユーティリティー)
– lambdaR (R にラムダ式を導入する)
– easyRFM (RFM 分析を簡単に実行する)
- 4. みんなのR 内容
• R プログラミング環境の整備 (1~3章)
• R の基本的な使い方 (4~13章)
• 統計解析の基礎 (14~18章)
• ちょっと高度な話題 (19~24章)
- 5. みんなのR 特徴
• RStudio (2.2節)
• グラフィクスは ggplot2 (7章)
• plyr, data.table (11章), stringr (13章)
• データは Web からダウンロード可能
• R の関数の細かい TIPS が多数
- 7. • ちょっと高度な話題より紹介
• 19章 Elastic Net
– 19.2 ベイズ縮小 (Bayesian Shrinkage)
• データの不備を統計的に見抜く
– coefplot
– Gelman’s Secret Weapon
今日の話
- 8. アメリカ大統領選挙のデータ
ID 年 投票 人種 収入 性別 教育
1 1948 民主党 白人 34~67% 男 中学以下
2 1948 共和党 白人 96~100% 女 高校
3 1948 民主党 白人 68~95% 女 高校
4 1948 共和党 白人 96~100% 女 大学
5 1948 民主党 白人 68~95% 男 大学
6 1948 共和党 白人 96~100% 女 高校
- 10. 係数
Estimate Std. Error z value Pr(>|z|)
(Intercept) 0.159298 0.069608 2.288517 2.21E-02
Raceasian -0.28333 0.204463 -1.38572 1.66E-01
Raceblack -2.4806 0.098419 -25.2045 3.57E-140
Racehispanic -0.8534 0.117868 -7.24031 4.48E-13
Racenative american -0.39196 0.145766 -2.68894 7.17E-03
Raceother -0.58169 0.488296 -1.19126 2.34E-01
RaceUnknown -0.37909 0.242336 -1.5643 1.18E-01
Income17 to 33 percentile -0.06018 0.06885 -0.87408 3.82E-01
Income34 to 67 percentile 0.023073 0.062385 0.369856 7.11E-01
Income68 to 95 percentile 0.155147 0.063278 2.451847 1.42E-02
Income96 to 100 percentile 0.737303 0.091151 8.088797 6.03E-16
IncomeUnknown 0.175348 0.088946 1.971399 4.87E-02
Gendermale 0.095426 0.034729 2.747739 6.00E-03
GenderUnknown 0.349124 0.418274 0.834678 4.04E-01
Educationgrade school of less
(0-8 grades)
-0.32778 0.062037 -5.2836 1.27E-07
Educationhigh school (12
grades or fewer, incl
-0.10646 0.047024 -2.26396 2.36E-02
Educationsome college(13
grades or more,but no
0.180237 0.054305 3.318968 9.04E-04
EducationUnknown -0.12276 0.224667 -0.5464 5.85E-01