Distributions.jl
Distributions.jl copied to clipboard
KSDist is broken
julia> using Distributions
julia> logpdf(KSDist(1), 0.5)
ERROR: MethodError: no method matching pdf(::KSDist, ::Float64)
Closest candidates are:
pdf(::Chernoff, ::Real) at C:\Users\user\.julia\packages\Distributions\wRw5p\src\univariate\continuous\chernoff.jl:168
pdf(::Kolmogorov, ::Real) at C:\Users\user\.julia\packages\Distributions\wRw5p\src\univariate\continuous\kolmogorov.jl:81
pdf(::DiscreteNonParametric{T,P,Ts,Ps} where Ps<:AbstractArray{P,1} where Ts<:AbstractArray{T,1} where P<:Real, ::Real) where T at C:\Users\user\.julia\packages\Distributions\wRw5p\src\univariate\discrete\discretenonparametric.jl:108
...
Stacktrace:
[1] logpdf(::KSDist, ::Float64) at C:\Users\user\.julia\packages\Distributions\wRw5p\src\univariates.jl:342
[2] top-level scope at none:0
I don't think the pdf for this distribution is even known. But if it is, I don't see it in here. So it's not that it's broken. It just hasn't been implemented (because I don't think we know the pdf).
Thanks for your comment. If that's the case, then perhaps a better error message will be nice.
The error message you got is telling you the right thing -- that the method is not implemented. But it doesn't tell you why. So you want something like this?
pdf(d::KSDist, x::Real) = error("The pdf of the Kolmogorov distribution is not known.")
Yes I think this would be better.
We could have a custom UnknownFunction error that we throw for these things.
I'm sorry to bring back to life this discussion after 4 years, but even if the analytical form of the pdf of the KSDist distribution is not known, it can be derived from the cdf.
Shouldn't we implement it?