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)
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 enter image description here Plot for Point B enter image description here

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

1 Answer 1


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.

  • $\begingroup$ 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? $\endgroup$
    – R Beginner
    Commented Jan 10, 2022 at 2:24
  • 1
    $\begingroup$ @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. $\endgroup$ Commented Jan 10, 2022 at 2:30
  • $\begingroup$ 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/… $\endgroup$
    – R Beginner
    Commented Jan 10, 2022 at 3:31
  • $\begingroup$ Rather than checking the assumption, just assume the relationship is nonlinear and estimate it. Regression splines are extremely useful for that purpose. See here. $\endgroup$ Commented Jan 10, 2022 at 13:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.