0
$\begingroup$

I am building a Logistic Regression model (in sklearn) and want to verify that the assumption regarding the linearity between X and the logit function is correct.

I am using Python so am looking for an alternative to Box Tidwell (because coding this up doesn't come as easy as in SPSS as far as I am aware). I have devised what I think is an appropriate alternative but I wanted to double check that I am correct in this way of thinking.

What I have done is:

Built my model and fitted it to some training data Sampled 100 evenly spaced points in between the min and max of my independent variable X and calculated the probability of these points predicted by my model (using the predict_proba function) Plotting the sampled X points against the logit of the probability and observed that there is a linear relationship (note that predict_proba does return the probability of the samples belonging to each class so I just picked one of the classes) Doing this makes me believe that I have not violated the assumption but am I unknowingly already assuming linearity in this method? Is this method valid?

Thanks!

EDIT: I know this type of question has been asked a lot. However, they all go with the Box Tidwell method (or in a few cases ANOVA) which is something I want to try and avoid. So I just wanted to check if the method I used was valid :)

$\endgroup$
2
  • 1
    $\begingroup$ If you disagree with your Q being a duplicate, you should not just ask it anew, but edit the original and indicate why you think it is not a duplicate. Please do so now! $\endgroup$ – kjetil b halvorsen Nov 30 '20 at 10:47
  • $\begingroup$ Hi, sure I will do that in the coming hours. I thought I did by saying that I wasn't doing it using the Box Tidwell method...would it be alright if I simply ask for a verification of my method? $\endgroup$ – pche3675 Nov 30 '20 at 10:53