-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Density scaling and bandwidth in type_ridge() #271
Comments
Oh that's interesting. I chose this purely for visual reason, and had no principled reason. Sorry! I'll defer to you on best defaults. |
OK, good, thanks for the quick feedback. Removing the scaling to the same maximum is straightforward. Regarding the bandwidth: Both As the code is so similar: Is the Should we then always enforce that the same bandwith is used throughout? Or should we allow different bandwidth per ridgeline? If the latter, how should we specify this, with an additional argument or does anyone have a better idea? |
I wrote (what eventually became) the
I don't have a good reason. I think I just did what was expedient. Should we switch to |
OK, thanks for the explanation. In any case, I think that |
Note: with #284 we ultimately opted with individual bandwidths in (regular) grouped density plots... albeit with the possibility for users to override via the Should we update the |
Yes, I'll try to have a closer look at the details in |
In
get_density()
withintype_ridge()
the density estimates are scaled to the same maximum which I believe is incorrect. Also the bandwidths are by default computed separately whereasggridges
employs a joint bandwidth estimate which typically seems to be better. But maybe I'm overlooking something here, Vincent @vincentarelbundock ?For illustration let's consider a sample with two groups with very different variances:
Using
ggridges
a joint bandwith of 0.218 is selected and the resulting densities have very different maxima - as you would expect if both should have the area 1.In contrast, because
get_density()
scales the density to have the same maximum, the second group has a much smaller area than the first intinyplot(..., type = "ridge")
.However, if I drop the scaling in line https://github.com/grantmcdermott/tinyplot/blob/main/R/type_ridge.R#L99 and select the same bandwidth of 0.218, then I get virtually the same result as in
ggridges
.Note that
type = "density"
agrees here and chooses the same joint bandwidth without applying any scaling of the maximum:The text was updated successfully, but these errors were encountered: