Fitting a distribution not supported by Distributions.jl

henry2004y
Thu, 17 Jul 2025 16:57:15 +0000
Statistics

Hi,

I want to fit an analytical distribution in Julia from discrete points. For instance, this specific Levy distribution is listed in Distributions.jl, but the fit method is not supported for this type: Distribution Fitting · Distributions.jl

using Distributions

D = Levy()
x = rand(D, 1000)
d = fit(Levy, x)

ERROR: suffstats is not implemented for (Levy, Vector{Float64}).
Stacktrace:
 [1] error(s::String)
   @ Base .\error.jl:35
 [2] suffstats(dt::Type{Levy}, xs::Vector{Float64})
   @ Distributions C:\Users\hyzho\.julia\packages\Distributions\YQSrn\src\genericfit.jl:5
 [3] fit_mle(dt::Type{Levy}, x::Vector{Float64})
   @ Distributions C:\Users\hyzho\.julia\packages\Distributions\YQSrn\src\genericfit.jl:27
 [4] fit(dt::Type{Levy}, x::Vector{Float64})
   @ Distributions C:\Users\hyzho\.julia\packages\Distributions\YQSrn\src\genericfit.jl:46
 [5] top-level scope
   @ REPL[20]:1

In general, how should I fit these kinds of analytic distributions?

7 posts - 3 participants