Practicing Statistics Interview Questions in R
Zuzanna Chmielewska
Actuary
$$f(x) = \frac{1}{1+e^{-x}} $$
$$f(x) = \frac{1}{1+e^{-x}} \in (0,1)$$
Probability prediction: $$ p_i = P(y_i=1) = \frac{1}{1+e^{-(\beta_0+\beta_1 \cdot x_{i1}+...+\beta_p \cdot x_{ip})}} $$
Logit prediction: $$ l_i = ln(\frac{p_i}{1-p_i}) = \beta_0+\beta_1 \cdot x_{i1}+...+\beta_p \cdot x_{ip}$$
model <- glm(y ~ x, data = df, family = "binomial")
model <- glm(y ~ x, data = df, family = "binomial")
predict(model, newdata = new_df, type = "response")
glm()
Practicing Statistics Interview Questions in R