JuliaStats / Distributions.jl

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

piecewise uniform distribution? #518

Open tawheeler opened 8 years ago

tawheeler commented 8 years ago

Is there any chance for implementing a piecewise uniform distribution? (univariate or multivariate). This is what a histogram generates.

Most stats functions on it should be well-defined; just not sure whether a fit function would be.

I can take a stab at it and submit a PR if desired.

andreasnoack commented 8 years ago

Would it make sense for the applications you have in mind to overload the Histogram type in StatsBase and thereby making it a distribution?

tawheeler commented 8 years ago

Do you mean AbstractHistogram{T<:Real,N,E} <: Distribution? Thanks, I did not know about the Histogram type.

andreasnoack commented 8 years ago

Maybe. I haven't really thought enough about it but it be worth trying out.

tawheeler commented 8 years ago

Worst case you could do encapsulation:

type PiecewiseUniform <: ContinuousUnivariate
   hist::Histogram
end

or similar.

That would let you do something similar for the multivariate case.

andreasnoack commented 3 years ago

Reopening this since it doesn't appear to be resolved

BenCurran98 commented 9 months ago

Hi, just wanted to see if this was still being considered? It would be very handy to some work I'm doing :)