I was curious as to what the highlighted lines represent in seaborn.regplot. I haven't been able to find the answer in the documentation.
Thanks
The solid line is evidently the linear regression model fit.
The translucent band lines, however, describe a bootstrap confidence interval generated for the estimate. From the docs we can see this in the parameter info for ci
:
(emphasis mine)
ci
:int
in[0, 100]
orNone
, optionalSize of the confidence interval for the regression estimate. This will be drawn using translucent bands around the regression line. The confidence interval is estimated using a bootstrap; for large datasets, it may be advisable to avoid that computation by setting this parameter to None.
So if you don't want the overhead of performing a bootstrap to get these CI bands, just pass ci=None
.
Example
import seaborn as sns
import matplotlib.pyplot as plt
sns.set_palette(sns.cubehelix_palette(8, light=.6))
tips = sns.load_dataset('tips')
x = 'total_bill'
y = 'tip'
cis = [None, 67, 99]
titles = ['No CI', '67% CI', '99% CI']
fig, axes = plt.subplots(nrows=3, sharey=True, sharex=True, figsize=(7, 10))
for ci, title, ax in zip(cis, titles, axes):
sns.regplot(x = x,
y = y,
data = tips,
ax = ax,
ci = ci).set_title(title)
plt.tight_layout()
plt.show()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With