How would one create an Observable to hold any univariate distribution?
If I do,
using Interact, Distributions
h = Observable(Normal())
The observable only accepts Normals, so the following fails:
h[] = Gamma()
How would one create an Observable to hold any univariate distribution?
If I do,
using Interact, Distributions
h = Observable(Normal())
The observable only accepts Normals, so the following fails:
h[] = Gamma()
You can create an Observable
with type Distribution
, but beware of performance problems since this is not a concrete type.
julia> typeof(Normal())
Normal{Float64}
julia> supertype(ans)
Distribution{Univariate, Continuous}
julia> h = Observable{Distribution}()
Observable{Distribution}(#undef)
julia> h[] = Normal()
Normal{Float64}(μ=0.0, σ=1.0)
julia> h[] = Gamma()
Gamma{Float64}(α=1.0, θ=1.0)