Skip to content

Supported distributions

ScoringRules.jl dispatches on Distributions.jl types. This page lists which families have a closed-form CRPS and which distribution types are provided by this package itself.

Logarithmic and Dawid–Sebastiani scores

logs and dss work for any UnivariateDistribution in Distributions.jl. logs evaluates -logpdf(d, y) directly; dss needs only mean(d) and var(d). No closed-form CRPS is required for these two scores.

Families with a closed-form CRPS

The table below lists every distribution family for which crps uses a closed-form expression rather than numerical quadrature or summation. The column "Restrictions" notes parameter constraints under which the formula is valid; outside these constraints the function returns NaN.

Continuous families from Distributions.jl

FamilyDistributions.jl constructorRestrictions
NormalNormal(μ, σ)
Truncated Normaltruncated(Normal(μ, σ); lower=l, upper=u)
Censored Normalcensored(Normal(μ, σ); lower=l, upper=u)
LogisticLogistic(μ, θ)
Truncated Logistictruncated(Logistic(μ, θ); lower=l, upper=u)
Censored Logisticcensored(Logistic(μ, θ); lower=l, upper=u)
Student-tLocationScale(μ, σ, TDist(ν))
Truncated Student-ttruncated(LocationScale(μ, σ, TDist(ν)); ...)
Censored Student-tcensored(LocationScale(μ, σ, TDist(ν)); ...)
LaplaceLaplace(μ, θ)
ExponentialExponential(θ)
GammaGamma(α, θ)α > 0, θ > 0
BetaBeta(α, β)
UniformUniform(a, b)
Log-NormalLogNormal(μ, σ)
Log-Logistic (Fisk)LogLogistic(α, β)β > 1 (i.e. scale < 1)
Generalised Extreme ValueGeneralizedExtremeValue(μ, σ, ξ)ξ < 1
Generalised ParetoGeneralizedPareto(μ, σ, ξ)ξ < 1
Normal mixtureMixtureModel(Normal, [(μ₁,σ₁), ...], w)

Discrete families from Distributions.jl

Discrete distributions use closed-form expressions or exact finite sums over the support (Poisson and Negative Binomial use a closed-form special-function representation; Binomial and Hypergeometric use a finite sum).

FamilyConstructor
PoissonPoisson(λ)
Negative BinomialNegativeBinomial(r, p)
BinomialBinomial(n, p)
HypergeometricHypergeometric(s, f, n)

Distribution types provided by ScoringRules.jl

These types are not in Distributions.jl and are exported by ScoringRules.jl directly. They behave as standard ContinuousUnivariateDistribution subtypes and support pdf, logpdf, cdf, quantile, mean, var, and rand.

TypeParametersCRPS formula
LogLaplace(μ, σ)μ: log-scale location, σ: log-scale scale (σ ∈ (0,1))closed form, requires σ < 1
TwoPieceNormal(loc, σ₁, σ₂)location, left-arm scale, right-arm scalevia generalised truncated/censored Normal
TwoPieceExponential(loc, σ₁, σ₂)location, left-arm scale, right-arm scalevia exponential CRPS

LogLogistic is provided by Distributions.jl (as LogLogistic(α, β), the Fisk distribution); crps for it uses the closed form from R's scores_llogis.R.

Quadrature fallback

For any continuous distribution not in the table above, crps falls back to adaptive Gauss–Kronrod quadrature (via QuadGK.jl). The fallback is correct but slower and less numerically precise for some distributions. If you encounter a distribution family that should have a closed form but does not, please open an issue.

Example: using package-provided types

julia
using ScoringRules, Distributions

d_ll  = LogLaplace(0.0, 0.5)
crps(d_ll, 1.5)
0.29999999999999993
julia
d_tp = TwoPieceNormal(0.0, 1.0, 2.0)
crps(d_tp, 0.5)
0.36686951622833847
julia
d_tpe = TwoPieceExponential(0.0, 1.0, 2.0)
crps(d_tpe, 1.0)
0.4507484259003558
julia
# Log-logistic from Distributions.jl
d_llog = LogLogistic(1.0, 2.0)
crps(d_llog, 1.5)
0.31981071690279184