# Linear assumption for logistic regression

I wanted to ask regarding the linearity assumption of the logistic regression, is the assumption between

A) independent variable (e.g. pre-score) vs logit of the outcome?
or B) predictive probability of the independent variable vs logit of the outcome?

Below is my R code regarding this problem. Any feedback on whether I wrote the code correctly or not and whether I should go with plot A or plot B is much appreciated.

fit <- glm(disease ~ Pre.score, data = final, family = binomial)
summary(fit)
pred.val.1 <- predict(fit, type ="response")
logit <- log(pred.val.1/(1-pred.val.1))

plot(logit,final\$Pre.score) ## Plot for Point A
plot(logit,pred.val.1) ## Plot for Point B


Plot for Point A Plot for Point B

• You ask for feedback. But what is the exact question? Commented Jan 10, 2022 at 12:16
• The title of this question is 'linear assumption of logistic regression'. But what is the point? Commented Jan 10, 2022 at 12:17

One way to write the data generating mechanism for logistic regression is as follows

$$\mbox{logit}(p) = X\beta$$

$$y \sim \mbox{Binomial}(n , p)$$

From this formulation, we find that the linearity assumption is made on the log odds scale. So were we to plot the log odds of the outcome versus the predictor, we would see a straight line$$^{1.}$$

$$^{1.}$$ This isn't strictly true. The assumption of linearity is not about the conditional mean, its about how we combine predictors. I could easily make a non-linear curve using linear combinations of non-linear functions. That being said, this all happens on the log odds scale.

• Pls, correct me if I am wrong but are you suggesting that we will always see the straight line between log odds of the outcome versus predictor? If so, how can we know if the assumption is met? Commented Jan 10, 2022 at 2:24
• @RBeginner Yes, if you simply fit a model like y~x then you should see a straight line in the log odds. You can try and validate this assumption by checking deviance residuals. Commented Jan 10, 2022 at 2:30
• I found this online and they checked the linear assumption using other methods than deviance residuals. Does the method described in this link make sense to you (e.g., check the scatterplot between logit of the outcome versus the predictive value)? sthda.com/english/articles/36-classification-methods-essentials/… Commented Jan 10, 2022 at 3:31
• Rather than checking the assumption, just assume the relationship is nonlinear and estimate it. Regression splines are extremely useful for that purpose. See here. Commented Jan 10, 2022 at 13:07