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