-
Notifications
You must be signed in to change notification settings - Fork 421
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
What Distributions.pdf
returns, and when?
#1820
Comments
Distributions.pdf
returns exactly?Distributions.pdf
returns, and when?
It always returns "the" probability density, the main question is just with respect to which base measure. Typically for discrete discrete distributions the base measure is the counting measure, which implies that the density function coincides with the probability mass function (see eg https://en.wikipedia.org/wiki/Probability_mass_function#Measure_theoretic_formulation). |
That's what I thought originally: regular reals measure for |
For mixture distributions in general it might be more sensible to define the density as the probability-weighted sum of densities of the components wrt their respective measures instead of defining as absolutely continuous wrt some base measure. This definition would still support inference using censored data. |
That's a bit over my head... Let me just share my practical concern and motivation for opening this issue. It was nice to see that Do you think it is possible at all to use |
I think a digestible statement is: |
Yeah, that's what it seems to return. |
What do you mean with the last statement? Is this good or bad? |
I mean that generic functions that use
I don't think this is good, but such statements are always subjective. |
If you are interested, can you read #1468 which also refers to this discussion: JuliaMath/DensityInterface.jl#4 (comment) and see if that somehow relates to your problem? |
Seems like it is related, but doesn't really help much.
(if this is correct) |
It would help if you explain on a concrete example what cannot be done. |
Basically any function that uses Actually, I don't know if it is possible to write any function |
So this is wrong:
How can we prevent this? @devmotion @sethaxen |
The docstring simply states:
This surely isn't enough to know when it returns density, and when mass.
I thought I kinda knew the answer to this question, but recently turned out I was wrong.
I've always thought it returns density for
Continous
distributions, and mass forDiscrete
. But actually there are distributions for whichpdf(d, x)
sometimes returns mass and sometimes density – for the samed
. One example iscensored(...)
distribution.Would be nice to add some clarification to the
pdf
docstring to make writing generic code feasible. Currently,pdf
doesn't guarantee anything useful unless one only considers specific individual distributions. Code likef(d) = ... pdf(d, x) ...
without explicit constrains ond
is impossible to reason about.The text was updated successfully, but these errors were encountered: