Logistic regression using Python statsmodels.formula.api getting a PerfectSeparationError

Viewed 12

I am using the statsmodels.formula.api package in python to perform a multiple logistic regression on a dataset and I am required to use 6 variables as predictors.

however, i keep getting this error - PerfectSeparationError and I am unable to figure out why (screenshot attached below).

The code that i used is as shown:

weekly['Direction'] = np.where(weekly['Direction'] == 'Up', 1, 0)
results = smf.logit('Direction ~ Lag1 + Lag2 + Lag3 + Lag4 + Lag5 + Volume', data=weekly).fit()
results.summary()

please share any advice on this, thank you very much

image of perfectseparationerror

0 Answers
Related