Skip to content
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

Consistency of dist_sample methods #126

Open
robjhyndman opened this issue Sep 13, 2024 · 1 comment
Open

Consistency of dist_sample methods #126

robjhyndman opened this issue Sep 13, 2024 · 1 comment

Comments

@robjhyndman
Copy link
Contributor

Currently the density, cdf, quantiles, etc. produced from a dist_sample() are not consistent with each other. That is ok as a design choice, and results in better estimates of each, even if they are not consistent with one another. But if you want consistency, you need to choose one of these, and base the others off it.

If we choose density as the base, and use a kde, this would work reasonably well, and better than starting with the empirical cdf or sample quantiles. In fact, I have already implemented exactly this via weird::dist_kde(). See https://github.com/robjhyndman/weird-package/blob/main/R/dist_kde.R

But if this is how it is done, I think dist_kde() is a better name than dist_sample(), to emphasise how the distribution is being computed.

This also affects #117

@mitchelloharawild
Copy link
Owner

I'm inclined to adjust the density method of dist_sample() to not use KDE when a suitable alternative(s) like dist_density() and dist_kernel_density() are added (#117).

This is in part because the samples in dist_sample() can be practically anything. The samples aren't necessarily univariate, continuous, or even numerical. This would complicate (and confuse) doing anything extra like basing dist_sample() around a kde.

In cases where a smooth/continuous density estimate is wanted/required, a KDE constructed with dist_kernel_density() should be used instead of dist_sample().

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants