You're writing a book or going through an existing book?
Everything you wrote looks good except for one thing. For discrete distributions there is a dx
value that is needed. However, that doesn't seem fix things.
The following seems to get a bit farther:
f[{x1_, x2_}] := Piecewise[{{1/3, {x1, x2} == {1, 1}}, {2/3, {x1, x2} == {2, 0}}}];
\[ScriptCapitalD] = ProbabilityDistribution[f[{x1, x2}], {x1, -10, 10, 1}, {x2, -10, 10, 1}];
Mean[\[ScriptCapitalD]]
$$\left\{\frac{5}{3},\frac{1}{3}\right\}$$
Variance[\[ScriptCapitalD]]
$$\left\{2/9, 2/9\right\}$$
Covariance[\[ScriptCapitalD]]
$$\left\{\left\{2/9, -(2/9)\right\}, \left\{-(2/9), 2/9\right\}\right\}$$
\[ScriptCapitalD]2 = TransformedDistribution[2 {x1, x2}, {x1, x2} \[Distributed] \[ScriptCapitalD]] //
FullSimplify;
Mean[\[ScriptCapitalD]2]
$$\left\{\frac{10}{3},\frac{2}{3}\right\}$$
Variance[\[ScriptCapitalD]2]
$$\left\{\frac{8}{9},\frac{8}{9}\right\}$$
Covariance[\[ScriptCapitalD]2]
$$\left\{\left\{8/9, -(8/9)\right\}, \left\{-(8/9), 8/9\right\}\right\}$$
But RandomVariate
doesn't work with the above. For your particular example things can be rewritten so that RandomVariate
works
d = TransformedDistribution[2 {x + 1, 1 - x}, x \[Distributed] BernoulliDistribution[2/3]];
RandomVariate[d, 10]
(* {{4, 0}, {2, 2}, {4, 0}, {4, 0}, {4, 0}, {4, 0}, {4, 0}, {2, 2}, {4, 0}, {4, 0}} *)
I suspect that ProbabilityDistribution
and/or TransformedDistribution
just can't handle the structure you have. (I'd like to be wrong about that.)