I'm plotting kde plots for a set of data with seaborn and scipy.stats.gaussian_kde:
My understanding is that under the hood, seaborn uses scipy (see here).
It also seems as though the bandwidth variable is in both cases 'scott' by default, so that doesn't seem to be the cause.
Does anyone have any insight into why the plot are different?
So it appears that the different shape of the seaborn plot is due to the fact that instead of using scipy, seaborn uses the kde of simplestats if that library is available locally.
So the question I have now is why is the curve produced by simplestats so different than the one produced, say, by scipy (and perhaps othe libraries).
Below in the comments it was suggested that the reason has to do with the bandwidth setting, but I played around a bit with that and the differences I saw the curves was no where near as extreme. Here are two seaborn/simpletats kde curves with two different bandwidth settings (scott versus silverman):
Then here, by contrast, are two scipy-produced kde curves with, again scott versus silverman:
One possible explanation may be this note in the seaborn documentation for
kdeplot (see here):
Note that the underlying computational libraries have different interperetations for this parameter:
statsmodelsuses it directly, but
scipytreats it as a scaling factor for the standard deviation of the data.
However, I'll need to do a bit more research/learning to understand if that's relevant here. Does anyone else know if this might be the explanation?