JuliaStats / Distributions.jl

A Julia package for probability distributions and associated functions.
Other
1.12k stars 418 forks source link

Support querying multivariate distribution supports #985

Open jkbest2 opened 5 years ago

jkbest2 commented 5 years ago

Is there any interest in adding support, minimum, and maximum methods for the multivariate distributions? insupport allows checking, but there are currently no methods for querying the support. I'm not sure the best approach to this within the Distributions.jl framework/type hierarchy. I see that continuous univariate distributions return a RealInterval object, and discrete distributions generally return a UnitInverval (though I see the latter may change with #951 and related).

Considering just the multivariate (not matrix-variate for now) I would (very tentatively) propose the following type hierarchy, with the distributions they would apply to:

Each of the three concrete types would have fields:

where the elsupport would be something like RealInterval, an appropriate discrete support, or in the case of HeterogeneousVectorSupport a vector with the support for each element.

Then support, minimum, and maximum would return the elementwise support for each element. The methods for insupport could also use these.

I'm open to any and all comments, including that this is unnecessary or unwanted.

richardreeve commented 5 years ago

I think this is a cool idea. There's an enormous amount missing from #951 et al, but it seems to have got bogged down for ages in other issues, and I definitely don't think I will be adding anything more to it. In this context, I'd really like to have been able to fix support() so that things like expectation() in src/functionals.jl can use a distribution's support directly to work out what to integrate or sum over, and that would definitely extend to multivariate / matrixvariate distributions. I don't have a strong opinion about the type hierarchy at the moment, and I'm not confident that minimum and maximum really make sense in this context, but I think the general idea is great.