-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Description
In the ?density help page, the description for the bw argument states:
The default,
"nrd0", has remained the default for historical and compatibility reasons, rather than as a general recommendation, where e.g.,"SJ"would rather fit, see also Venables and Ripley (2002).
stat_density() and stat_ydensity() use density()'s default of "nrd0". Since ggplot2's philosophy is to provide the "best" default wherever possible, it seems like a good idea to change the default for these functions to bw = "SJ".
I'm not an expert in KDE algorithms, so I can't verify if the claim in the ?density page is true or not, but I thought it worth opening up the discussion.
If you decide to change the default for those functions, it also needs changing in the compute_group() and compute_density() methods of the StatDensity and StatYdensity ggproto objects.