Skip to content

[Bug]: quantile not working for ExponentialFamily.jl distributions #268

@abpolym

Description

@abpolym

I wanted to call quantile on some of the distributions defined by ExponentialFamily.jl.
However, I realized with horror and an immense shock that quantile does not work for any of the ExponentialFamily.jl distributions as iterate has not been defined:

julia> quantile(GammaShapeRate(1.0, 2.0), 0.001)

MethodError: no method matching iterate(::ExponentialFamily.GammaShapeRate{Float64})
Closest candidates are:
  iterate(::Automa.Precondition)
   @ Automa ~/.julia/packages/Automa/EyNRt/src/precond.jl:87
  iterate(::Automa.Precondition, ::Any)
   @ Automa ~/.julia/packages/Automa/EyNRt/src/precond.jl:87
  iterate(::Base.MethodSpecializations)
   @ Base reflection.jl:1148
  ...

The reason why I wanted to use quantile is to determine a range over which to plot a given distribution to capture all of the data, e.g.:

lo = quantile(d, 0.001)
hi = quantile(d, 0.999)
# Clip to distribution support (might not be necessary but just a safety measure)
lo_supp, hi_supp = extrema(support(d))
lo = max(lo, lo_supp)
hi = min(hi, hi_supp)
xs = range(lo, hi, length=npoints)
ys = pdf.(d, xs)

Metadata

Metadata

Labels

bugSomething isn't working

Type

Projects

Status

Backlog

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions