Generalized Linear Models in R
Richard Erickson
Instructor



Standaard GLM voor binomiale familie
Model voor binaire data
$Y = \text{Binomial}(p)$
Gekoppeld aan lineaire vergelijking
$\text{logit}(p) = \beta_0 + \beta_1 x + \epsilon$
Logit gedefinieerd als
$\text{logit}(p) = \text{log}\left(\frac{p}{1-p}\right)$
Inverse logit gedefinieerd als
$\text{logit}^{-1}(x) = \frac{1}{1 + \text{exp}(-x)}$
Functie:
glm(y ~ x, data = dat, family = 'binomial')
Invoer:
y = c(0, 1, 0, 0, 1...)
y = c("yes", "no"...)
y = c("win", "lose"...)
# Of een factor met 2 niveaus
CommuteDays Bus
1 5 Yes
2 2 No
Generalized Linear Models in R