Distributions.jl
Distributions.jl copied to clipboard
location and scale of Dirac missing, rescaling Dirac
julia> d = Dirac(3.5)
Dirac{Float64}(value=3.5)
julia> location(d)
ERROR: MethodError: no method matching location(::Dirac{Float64})
julia> scale(d)
ERROR: MethodError: no method matching scale(::Dirac{Float64})
julia> d = Dirac(3.5)
Dirac{Float64}(value=3.5)
julia> e = d + 2
LocationScale{Float64, Discrete, Dirac{Float64}}(
μ: 2.0
σ: 1.0
ρ: Dirac{Float64}(value=3.5)
)
julia> f = d * 4
LocationScale{Float64, Discrete, Dirac{Float64}}(
μ: 0.0
σ: 4.0
ρ: Dirac{Float64}(value=3.5)
)
Package version v0.25.95
.
I wonder why location, scale
are not implemented, as they are trivial.
For +, *
the implementation falls back to default, which is not so nice. mean
and std
work correctly, but in my understanding the Dirac
is a conjugate family:
-
+
should altervalue
. -
*
should error instead of silently pushing the probability > 1
If you agree I prepare a PR. If there are some hidden modeling choices, please let me know, found nothing specific in #861 #1231