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

`cquantile` on iterables

Open yuvalwas opened this issue 2 years ago • 3 comments

Hello, It is a minor thing, but since it already exists, I thought it makes sense that cquantile would be defined for this case as well. To be specific, at the moment cquantile(rand(1000), 0.9) has no method, but it could return quantile(rand(1000), 0.1). Thanks

yuvalwas avatar Nov 13 '23 12:11 yuvalwas

@devmotion Why did you transfer this to Statistics? cquantile lives in Distributions.jl, and quantile already accepts any iterator.

nalimilan avatar Dec 10 '23 17:12 nalimilan

Distributions only wants and implements quantile(::UnivariateDistribution, ::Real), and similarly only cquantile(::UnivariateDistribution, ::Real) is of interest there. But methods such as quantile(::AbstractArray, p) (with all its keyword arguments) do not belong in Distributions, and hence similarly IMO something like cquantile(::AbstractArray, ::Real) does not belong there but (if it is desired) next to where quantile(::AbstractArray, ::Real) is defined.

devmotion avatar Dec 10 '23 19:12 devmotion

Got it. That makes sense, though I'm not totally convinced it's worth adding a function just to avoid typing 1-p. Do we know why that function judged useful enough to be added to Distributions in the first place?

nalimilan avatar Dec 12 '23 20:12 nalimilan