Logistic regression model

Practicing Statistics Interview Questions in R

Zuzanna Chmielewska

Actuary

Logistic regression's application

spam

financial fraud

Practicing Statistics Interview Questions in R

binary data points

Practicing Statistics Interview Questions in R

binary data points

Practicing Statistics Interview Questions in R

Logistic function

$$f(x) = \frac{1}{1+e^{-x}} $$

Practicing Statistics Interview Questions in R

Logistic function

$$f(x) = \frac{1}{1+e^{-x}} \in (0,1)$$

Practicing Statistics Interview Questions in R

Logistic regression model

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}$$

Practicing Statistics Interview Questions in R

a prediction of binary data points

Practicing Statistics Interview Questions in R

a prediction of binary data points

Practicing Statistics Interview Questions in R

Logistic regression in R

model <- glm(y ~ x, data = df, family = "binomial")
Practicing Statistics Interview Questions in R

Logistic regression in R

model <- glm(y ~ x, data = df, family = "binomial")
predict(model, newdata = new_df, type = "response")
Practicing Statistics Interview Questions in R

Summary

  • logistic regression model
  • prediction of a binary response variable
  • logistic regression in R with glm()
Practicing Statistics Interview Questions in R

Let's practice!

Practicing Statistics Interview Questions in R

Preparing Video For Download...