This is my first post so I apologize for any formatting issues.
I'm trying to calculate the expected value of a collection of numbers in Julia, given a probability distribution that is the mixture of two Beta distributions. Using the following code gives the error seen below
using Distribution, Expectations, Statistics
d = MixtureModel([Beta(1,1),Beta(3,1.6)],[0.5,0.5])
E = expectation(d)
E*rand(32,1)
MethodError: no method matching *(::MixtureExpectation{Vector{IterableExpectation{Vector{Float64}, Vector{Float64}}}, Vector{Float64}}, ::Matrix{Float64})
If I use just a single Beta distribution, the above syntax works fine:
d = Beta(1,1)
E = expectation(d)
E*rand(32,1)
Out = 0.503
And if I use function notation in the expectation, I can calculate expectations of functions using the Mixture model as well.
d = MixtureModel([Beta(1,1),Beta(3,1.6)],[0.5,0.5])
E = expectation(d)
E(x -> x^2)
It just seems to not work when using the dot-notation shown above.