Distributions.jl icon indicating copy to clipboard operation
Distributions.jl copied to clipboard

Censored needs a special multiplication overload

Open sethaxen opened this issue 3 years ago • 4 comments

Because the density at the bounds of Censored are discrete probabilities, they don't transform in the same way as the density between the bounds when the uncensored distribution is continuous. We can fix this with an overload like this:

*(d::Censored, σ::Real) = censored(d.uncensored * σ, d.lower * σ, d.upper * σ)
*(d::LeftCensored, σ::Real) = censored(d.uncensored * σ, d.lower * σ, nothing)
*(d::RightCensored, σ::Real) = censored(d.uncensored * σ, nothing, d.upper * σ)

More generally, this is something to keep in mind when considering other distributions with atomics.

sethaxen avatar Feb 01 '22 14:02 sethaxen

Connected to #1483, there is a latent need for being able to dispatch on distributions which have merely uncountable support and those which are absolute continuous.

mschauer avatar Feb 01 '22 14:02 mschauer

Indeed. I guess, however, here we would want the definitions suggested by @sethaxen in any case, even if we could dispatch on such traits.

devmotion avatar Feb 01 '22 14:02 devmotion

Exactly, but we would like to exclude the general case from the standard definitions.

mschauer avatar Feb 01 '22 14:02 mschauer

Connected to #1483, there is a latent need for being able to dispatch on distributions which have merely uncountable support and those which are absolute continuous.

I'm not certain how that would help in this case. Because we need the log(σ) for the continuous mixture component but need to not have it for the discrete components. If we have generic mixtures of discrete and continuous components, where a point can be any or all of the components, then even evaluation at a single pojnt might need the adjustment for some components and not others.

sethaxen avatar Feb 01 '22 14:02 sethaxen