I am confused by the behavior of MixtureDistribution
, even though that sounds like what I would need.
Let's say I want to get a parametric solution for the variance of the compound lottery of either playing the 50-50 lottery of \$0 or \$4 with probability a
, or playing a separate 50-50 lottery of \$0 or \$2 (with the complementary probability).
I can get this done with EmpiricalDistribution
but that's becoming unwieldy in more complicated cases.
emp = EmpiricalDistribution[{a/2,a/2,(1-a)/2,(1-a)/2}->{0,4,0,2}]
Variance[emp]
Make no mistake, this is not about a linear combination of random variables. It is trivial to work with (say) convex combinations of random variables or probability distributions, but that's not the same thing. (Easy to see with discrete random variables: the mixture yields outcomes from the union of the original outcomes, e.g. a few integers, while the linear combination can have a (discrete set) of real numbers, depending on the weights, a
in my example.)
To see, TransformedDistribution
does not do mixtures, compare this to the solution above:
Variance[TransformedDistribution[a*4*y+(1-a)*2*z,{y\[Distributed]BernoulliDistribution[0.5],z\[Distributed]BernoulliDistribution[0.5]}]]
MixtureDistribution
s sound like just what we need here, they just looked a bit obscure in the documentation and functions recommended automatically.
EmpiricalDistribution
isEmpiricalDistribution[{1/4, 1/4, 1/4, 1/4} -> {0, 2 - 2 a, 4 a, 2 (1 + a)}]
which gives the same exact variance. (There are 4 outcomes each with a probability of $1/4$.) Note that Mathematica also has aMixtureDistribution
function. $\endgroup$TransformedDistribution
returns discrete values, which you say is only the case for mixtures. $\endgroup$emp
is the "correct" distribution function that would be nice to construct fromy' and
z'.MixtureDistribution
might be it, somehow I overlooked it. $\endgroup$MixtureDistribution
here (I'm still surprising the documentation and googling did not led me there sooner), but on your point: Indeed, I was imprecise (will edit soon). The outcomes remain discrete after a transformation, but not the original outcomes with mixed probabilities. E.g. my outcomes were three integers, which the mixture preserves whatevera
is, while the transformation maps into fractions. $\endgroup$TransformedDistribution
) and a function of the associated probability density functions (MixtureDistribution
). (That's a bit of an oversimplification but it might work here.) $\endgroup$