I've built a logistic regression model for binary classification with a high F1 score, but when I run Box-Tidwell tests on continuous independent features/predictive variables, I find non-linearities in the relationship between those features and the logit of the outcome variable. Should I be concerned? I know that linearity between continuous independent variables and the logit of the dependent variable is a fundamental assumption of logistic regression, so I'm inclined to think I should invest time in performing transformations on my features to remove nonlinearities. I'm just confused by the high performance of my model. Would love any guidance on if I should move forward with my model, or spend time revising my features!

  • $\begingroup$ We don't know anything about your dataset: how many rows? How many parameters in the current model? Are the rows really independent? $\endgroup$
    – Michael M
    Commented Sep 14, 2023 at 17:26

1 Answer 1


First, good for checking the assumptions!

Second, I wouldn't rely exclusively on the results of the Box-Tidwell test (or any test) for this sort of problem. Like any test, the p value is partly an effect of sample size, but the deleterious effects of non-linearity are not. So, make some graphs. How nonlinear is it? And how is it nonlinear (that is, in what way does it deviate from a straight line)?

Third, try running the regression with a spline of the independent variables that you think might not be linear. Then compare the results of the two models. Does the one with the splines do a much better job? Is that worth the complexities of interpreting the splines? (There are a variety of splines, I don't have a strong opinion on which is best, but restricted cubic splines seem to be widely used).

Finally, also consider your goals. If they are entirely (or mainly) prediction, then the complexity of splines may not be an issue. On the other hand, if you are also interested in explanation, then splines are added work, both for you (as analyst) and for anyone you need to present them to. The work may be worth it, but it is a factor.

  • 2
    $\begingroup$ Also almost everything is nonlinear, so flexible modeling (using regression splines etc.) is key. Pre-specify a model that is as flexible as the sample size allows, then there's nothing you can do better even if the fit isn't wonderful. Don't use statistical tests to decide how to model. $\endgroup$ Commented Sep 14, 2023 at 13:47

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.