I am trying to create a regression plot for some data using lmplot of Seaborn. However, Seaborn does not plot the regression line, only the points are plotted and I get an error which I don't understand:
~/.local/lib/python3.9/site-packages/statsmodels/genmod/families/links.py:187: RuntimeWarning: overflow encountered in exp t = np.exp(-z) ~/.local/lib/python3.9/site-packages/numpy/lib/nanfunctions.py:1395: RuntimeWarning: All-NaN slice encountered result = np.apply_along_axis(_nanquantile_1d, axis, a, q,
While using the 'tips'-dataset I found out that this errors seems to appear if both sets of the data are perfectly separated (See image below). (I know separating the same value you are plotting the logistic regression against makes no sense, but it produces a dataset similar to the one I have)
Here is some code to reproduce, modified from https://seaborn.pydata.org/generated/seaborn.regplot.html
import seaborn as sns
import matplotlib.pyplot as plt
import numpy as np
tips = sns.load_dataset("tips")
tips["big_tip"] = tips.total_bill > 20
tips = tips.head(30)
sns.lmplot(x='total_bill',y='big_tip',data=tips, logistic=True)
plt.show()
and the resulting image, where I expected to see the regression line:
Python 3.9.7 Seaborn 0.11.2 Numpy 1.21.1