R における Generalized Linear Models
Richard Erickson
Instructor



二項分布族のデフォルトGLM
二値データのモデル
$Y = \text{Binomial}(p)$
線形式にリンク
$\text{logit}(p) = \beta_0 + \beta_1 x + \epsilon$
ロジットの定義
$\text{logit}(p) = \text{log}\left(\frac{p}{1-p}\right)$
逆ロジットの定義
$\text{logit}^{-1}(x) = \frac{1}{1 + \text{exp}(-x)}$
関数:
glm(y ~ x, data = dat, family = 'binomial')
入力:
y = c(0, 1, 0, 0, 1...)
y = c("yes", "no"...)
y = c("win", "lose"...)
# Or any 2-level factor
CommuteDays Bus
1 5 Yes
2 2 No
R における Generalized Linear Models