Logistic Regression
Study guide: Exam MAS-I
A Logistic Regression is a generalized linear model for a binary response, in which the response Y_i has a binomial (Bernoulli) distribution with probability of success \pi_i and the link function is the logit. It is a supervised learning method for classifying an observation into one of two classes from its predictors x_{i1}, \ldots, x_{ip}.
The odds of success are \pi_i/(1-\pi_i), and the logit is the natural logarithm of the odds. The logit of the probability of success is
\ln\!\left(\frac{\pi_i}{1-\pi_i}\right) = \beta_0 + \beta_1 x_{i1} + \cdots + \beta_p x_{ip}
\beta_0, \beta_1, \ldots, \beta_pare the coefficients, estimated by maximum likelihood.
The logit maps a probability in (0, 1) onto the whole real line, so the linear predictor \eta_i = \beta_0 + \beta_1 x_{i1} + \cdots + \beta_p x_{ip} can take any value. Solving for \pi_i, the probability of success is
\pi_i = \frac{e^{\eta_i}}{1 + e^{\eta_i}}
\pi_i = \frac{1}{1 + e^{-\eta_i}}
This inverse of the logit is the logistic function. It maps any value of \eta_i into (0, 1), so every fitted value is a probability. The probit link, the inverse of the standard normal cumulative distribution function, also maps (0, 1) onto the real line and gives similar fitted probabilities. The logit is the canonical link of the binomial distribution, and the dispersion parameter of the binomial is fixed at \phi = 1.
A logistic regression for the probability that a policy renews has
\hat\beta_0 = 1.20and\hat\beta_1 = -0.03, wherexis the rate increase in percent. What is the probability of renewal for a10\%rate increase?
- The linear predictor is
\hat\eta = 1.20 - 0.03 \times 10 = 0.90.- The probability of renewal is
\hat\pi = \frac{1}{1 + e^{-0.90}} = \frac{1}{1.4066} = 0.711.
The odds ratio
Exponentiating the logit, the odds of success are
\frac{\pi_i}{1 - \pi_i} = e^{\beta_0}\, e^{\beta_1 x_{i1}} \cdots e^{\beta_p x_{ip}}
A one-unit increase in x_j, with the other predictors held fixed, multiplies the odds by e^{\beta_j}. This factor is the odds ratio of x_j.
In the renewal model above, what are the odds of renewal for a
10\%rate increase, and by what factor does each additional percentage point of rate increase change them?
- The odds of renewal are
e^{\hat\eta} = e^{0.90} = 2.460.- Each additional percentage point multiplies the odds by
e^{-0.03} = 0.970, a reduction of3.0\%.
Because the model is linear on the log-odds scale, two fitted probabilities at two values of one predictor fix both coefficients. The slope is the change in log-odds divided by the change in x.
A logistic regression with one predictor gives fitted probabilities of
0.5atx = 2and0.8atx = 4. What are\hat\beta_0and\hat\beta_1?
- At
x = 2the log-odds are\ln(0.5/0.5) = 0.- At
x = 4the log-odds are\ln(0.8/0.2) = \ln 4 = 1.3863.- The slope is
\hat\beta_1 = \frac{1.3863 - 0}{4 - 2} = 0.6931.- The intercept is
\hat\beta_0 = 0 - 2 \times 0.6931 = -1.3863.- The odds ratio is
e^{0.6931} = 2, so each unit ofxdoubles the odds of success.
The linear probability model
The linear probability model fits linear regression to a 0/1 response, so that the probability of success is
\pi_i = \beta_0 + \beta_1 x_{i1} + \cdots + \beta_p x_{ip}
It has three drawbacks that the logit link and the binomial distribution remove:
- Fitted values can fall below 0 or above 1, so they are not always probabilities.
- The variance of a
0/1response is\pi_i(1 - \pi_i), which changes with the mean, so the errors are heteroscedastic. - The errors take only two values for each
x_i, so they are not normal and residual analysis is not meaningful.
Responses with more than two categories
A response with more than two unordered categories is modelled by multinomial logistic regression. A response with ordered categories is modelled by ordinal logistic regression.
Multiplying the probability by the odds ratio The odds ratio
e^{\beta_j}multiplies the odds, not the probability. In the renewal model, an11\%rate increase gives odds of2.460 \times 0.970 = 2.387and a probability of2.387/3.387 = 0.705. Multiplying the probability instead,0.711 \times 0.970 = 0.690, is wrong.
Practice questions
- CAS Exam 8 Fall 2012, Question 4
- CAS Exam 8 Fall 2017, Question 5
- CAS Exam 8 Fall 2017, Question 6
- CAS Exam 8 Fall 2018, Question 7
- CAS Exam 8 Fall 2019, Question 5
- Exam DISC-DA Practice Question 222
- CAS Exam MAS-I Fall 2018, Question 28
- CAS Exam MAS-I Spring 2018, Question 27
- CAS Exam MAS-I Fall 2019, Question 25
- CAS Exam MAS-I Spring 2019, Question 27
- Exam MAS-I Practice Question 93
- Exam MAS-I Practice Question 157
- CAS Exam MAS-II Fall 2019, Question 25
- CAS Exam MAS-II Spring 2019, Question 32
- SOA Exam SRM Sample Question 7
- SOA Exam SRM Sample Question 20
- SOA Exam SRM Sample Question 42
- SOA Exam SRM Sample Question 67
- SOA Exam SRM Sample Question 72