vega / vega

A visualization grammar.

Home Page:https://vega.github.io/vega

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support additional bandwidth estimation methods for KDEs

joelostblom opened this issue · comments

Currently, Scott's rule of thumb is used to estimate the bandwidth for the kernel density estimates in vega. However, from my understanding, this is rarely the optimal choice. For data that can be assumed to be normally distributed, the Silverman rule of thumb appears to be preferred, and the safest choice without any assumption seems to be the Improved Seather & Jones algorithm (isj) which doesn't rely on the normality assumption and doesn't oversmooth multimodal data like Scott's and Silverman's rule does.

There is some more discussion in this blog post, comparisons in this report, and further examples in this notebook. There are Python implementations of isj in arviz, zfit, and KDEpy in case it is helpful.