The test of randomness was a logistic regression predicting missingness from all other variables

 from sklearn.linear_model import LogisticRegression
classifier = LogisticRegression()
classifier.fit(X_train, y_train)

# the overall equation was not significant
(p < .47) and all 95% confidence intervals for the odds ratios for the three
variables included 1.00, indicating no significant relationship between
missingness and any of the other variables.


I checked the online resources. I wonder how do I use sklearn package to achieve it, especially the overall significance of the equation.

• What is the question? – user2974951 Sep 19 '18 at 8:42
• How do I check the overall significance of this logistic regression using python? – Tom Sep 19 '18 at 15:57
• Logistic regression model should return a null and model deviance, which you can use to calculate a p-value based on a chi-square test, to determine if your model is better then the null model, that is a model with only an intercept. – user2974951 Sep 19 '18 at 17:30
• Could you give me more details about it? I want to implement your idea. I have some difficulties coding it out. – Tom Sep 19 '18 at 21:49
• This should be returned automatically, at least it does so in R. If Python doesn't, then find a function to calculate the deviance of models, in R it's deviance(). Or even better, build a model with only the intercept and your desired model, and then compare them with an ANOVA, this should be available in Python, in R anova(model.null,model). – user2974951 Sep 20 '18 at 6:03