Skip to content
Advertisement

Python and SPSS giving different output for Logistic Regression

Code:

JavaScript

Here’s the dataset

JavaScript

Result:

JavaScript

Now I added the same data in spss.Analyse->Regression->Binary Logistic Regression. I set the corresponding Y -> dependent and XT -> Covariates. The results weren’t even close. Am I missing something in python or SPSS? Result of binary logistic regression on SPSSPython-Sklearn

Advertisement

Answer

SPSS Logistic regression does not include parameter regularisation in it’s cost function, it just does ‘raw’ logistic regression. In regularisation, the cost function includes a regularisation expression to prevent overfitting. You specify the inverse of this with the C value. If you set C to a very high value, it will closely mimic SPSS, so there is no magic number – just set it as high as you can, and there will be no regularisation.

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement