# Dealing with violated linearity assumption in Logistic Regression

As I understand from "Discovering Statistics using R" by Andy Field (et. al), in logistic regression we assume that there is a linear relationship between any continuous predictors and the log of the outcome variable. This can be tested by seeing if the interaction term between the predictor and its log transformation is significant (if the interaction term is significant then the linearity assumption is violated).

When conducting a logistic regression analysis myself I use four continuous predictors. Upon testing the linearity assumption of logistic regression, I have now experienced that all of the continuous predictor interaction terms are significant (i.e., violate the linearity assumption for logistic regression).

How can we deal with the violation of the linearity assumption in logistic regression when using these four continuous predictors? Would it for instance be possible to transform the variables from continuous to categorical (ordinal) to not have to worry about violating the linearity assumption? Are there other options that people use?

Here is an example of creating an interaction term in R:

neventsInt <- log(ds$$nevents) * ds$$nevents


Running the logistic regression, now including the four interaction terms to test the linearity assumption:

fit <- glm(certified ~ nevents + ndaysact + nchapters + YoB + gender
+ neventsInt + ndaysactInt + nchaptersInt + YoBInt, data=ds,
family=binomial(), na.action=na.omit)


Here is the output regarding the significance of all the predictor interaction terms, after including them in the logistic regression:

Coefficients:
Estimate     Std. Error   z value     Pr(>|z|)
neventsInt     -7.409e-05   8.098e-06    -9.148      < 2e-16 ***
ndaysactInt    -4.176e-02   1.815e-03    -23.016     < 2e-16 ***
nchaptersInt   -3.031e-01   7.011e-03    -43.233     < 2e-16 ***
YoBInt         -2.489e+00   4.618e-01    -5.390      7.03e-08 ***


As an aside, I have wanted to combine three of the continuous predictors into one factor (through factor analysis) for use in subsequent logistic regression. Am I correct in assuming that if the predictors violate the independence assumption separately then they will also violate it when combined into a factor?

• Did you include the original variables in the model when you estimated the coefficients of these interaction terms?
– whuber
Aug 21, 2017 at 22:27
• @whuber: Yes, I have now edited the text.
– Jea
Aug 21, 2017 at 22:37
• Aug 22, 2017 at 16:10
• @Jea Can you offer a quote from Field for your opening sentence? I doubt Field can have quite said what you said there -- or at least I really hope not. Sep 14, 2017 at 23:38
• @Glen_b I'm leaving for vacation today, so I don't have access to the book which is at my office. I'll try to remember to provide a quote when I return.
– Jea
Sep 15, 2017 at 7:59

## 1 Answer

The linearity assumption is still met in the case of interactions. The model always estimates the effect on the log odds of a one unit increase in the independent variable(s). If the independent variables happen to be interactions or are transformed, the model's estimation procedures are the same and the interpretation is the same as the case where variables are not transformed.