13.1 Logistic regression with a single predictor

Logistic function maps (0,1) to (,):

logit(x)=log(x1x)

Also known as ‘log odds’, this can be used to map probabilities to the whole real line.

The inverse is logit1 or ‘sigmoid’ function:

logit1=ex1+ex This maps the real line to probabilities.

In R we can use the logistic distribution:

logit <- qlogis
invlogit <- plogis

This mapping allows us to expand our linear regression into models with two outcomes yi{0,1}

Pr(yi=1)=logit1(Xiβ)

  • Note that all the uncertainty comes for the probabilistic prediction of the binary outcome.