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

Improve handling of continuous distributions with infinite density at points #125

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

Comments

@mitchelloharawild
Copy link
Owner

The density at a discrete point in the mixture should be Inf, cdf is fine.

library(ggdist)
library(distributional)
library(ggplot2)
ggplot(NULL, aes(xdist = dist_mixture(dist_normal(), dist_poisson(3), weights = c(0.5, 0.5)))) +
  stat_slab(n = 1001, slab_type = "pdf")

ggplot(NULL, aes(xdist = dist_mixture(dist_normal(), dist_poisson(3), weights = c(0.5, 0.5)))) +
  stat_slab(n = 1001, slab_type = "cdf")

dist_poisson(3) |> 
  support()

dist_normal(3) |> 
  support()

dist_mixture(dist_normal(), dist_poisson(3), weights = c(0.5, 0.5)) |> 
  density(c(3, 3.3))
@mitchelloharawild
Copy link
Owner Author

Probably safest for now is to disallow mixing distributions with different classes (e.g. double, integer, character).
However this is still a problem for things like dist_inflated() with continuous distributions, so I've made the title more generic.

@mitchelloharawild mitchelloharawild changed the title Handle continuous and discrete mixtures with better principles Improve handling of continuous distributions with infinite density at points Sep 14, 2024
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

1 participant