R에서 Generalized Linear Models
Richard Erickson
Instructor
선형 회귀는 간단합니다:
포아송 회귀:
로그-오즈("로짓"):
$\phi(x) = \text{ln}(\frac{p(x)}{1 - p(x)}) = \beta_0 + \beta_1 x$
오즈, 지수 취하기 ($e^{x}$):
$\frac{p(x)}{1 - p(x)} = e^{\beta_0 + \beta_1x}$
연속형 변수의 오즈비(OR):
$\text{OR} = \frac{e^{\beta_0 + \beta_1(x +1)}}{e^{\beta_0 + \beta_1x}} = e^{\beta_1}$
OR 값:
비흡연 vs 흡연 남성 (Pesch et al. 2012)
glm_out <- glm(y ~ x, family = 'binomial')
coef(glm_out)
exp(coef(glm_out))
confint(glm_out)
exp(confint(glm_out))
library(broom)
glm_out <- glm(y ~ x, family = 'binomial')
tidy(glm_out, exponentiate = TRUE, conf.int= TRUE)
R에서 Generalized Linear Models