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