Can we also use truncation here?
MixtureModel(Normal[
Normal(-2.0, 1.2),
Normal(0.0, 1.0),
Normal(3.0, 2.5)])
I was trying with some truncated distributions and it gives error. These distributions are obtained from fitting Normal distribution to a vector and then truncate them.
Error:
ERROR: MethodError: Cannot `convert` an object of type
Truncated{Normal{Float64}, Continuous, Float64, Float64, Float64} to an object of type
Normal
Closest candidates are:
convert(::Type{Normal}, ::NormalCanon)
@ Distributions ~/.julia/packages/Distributions/Ufrz2/src/univariate/continuous/normalcanon.jl:34
convert(::Type{T}, ::T) where T
@ Base Base.jl:64
Stacktrace:
[1] setindex!(A::Vector{Normal}, x::Truncated{Normal{Float64}, Continuous, Float64, Float64, Float64}, i1::Int64)
@ Base ./array.jl:969
[2] getindex(::Type{Normal}, ::Truncated{Normal{Float64}, Continuous, Float64, Float64, Float64}, ::Truncated{Normal{Float64}, Continuous, Float64, Float64, Float64}, ::Truncated{Normal{Float64}, Continuous, Float64, Float64, Float64}, ::Truncated{Normal{Float64}, Continuous, Float64, Float64, Float64}, ::Vararg{Truncated{Normal{Float64}, Continuous, Float64, Float64, Float64}})
@ Base ./array.jl:403
[3] top-level scope
@ ~/PhD/Program_Julia/code/fitting_dist.jl:25