Defining a mixture of 2 Beta distributions works as one would expect:
using Distributions, GLMakie
LocationScale(0.5, 1, Beta(1, 1))
d = MixtureModel(
Beta[
Beta(1, 1),
Beta(2, 10)], [0.5, 0.5])
xaxis = range(-0.1, 1.1, length=1000)
lines(xaxis, pdf.(d, xaxis))
Scaling one distribution works too:
d = 0.5 * Beta(2, 10)
lines(xaxis, pdf.(d, xaxis))
Unfortunately, setting a mixture of 2 scaled Beta distributions fails:
d = MixtureModel(
Beta[
0.5 * Beta(1, 1),
0.5 * Beta(2, 10)], [0.5, 0.5])
ERROR: MethodError: Cannot `convert` an object of type
LocationScale{Float64, Continuous, Beta{Float64}} to an object of type
Beta
Closest candidates are:
convert(::Type{T}, ::T) where T
@ Base Base.jl:84
I also tried setting the LocationScale
for the first Beta but to no avail:
d = MixtureModel(
LocationScale(0, 1, Beta(1, 1))[
0.5 * Beta(1, 1),
0.5 * Beta(2, 10)], [0.5, 0.5])
ERROR: MethodError: no method matching getindex(::LocationScale{…}, ::LocationScale{…}, ::LocationScale{…})
Any help to create a mixture of 2 scaled Betas would be much appreciated