TransformedDistribution
contains a collection of identities known to it, like that of sum of normals being equal in distribution to another normal random variable, and a general machinery to work out properties of the functions of random variables.
Most of the time the computation will be done by the general machinery, which relies on solvers, like Expectation
and Probability
. Hence TransformedDistribution
will be as strong as those are.
The major strength of TransformedDistribution
, in my opinion, is that it allows for easy and efficient sampling. It is generally expensive to work out other properties of the random variable from this representation.
In this particular example of $(2 Z-1) X \stackrel{d}{=} -(-1)^Z X$ the underlying solvers did not know how to handle the mixed case of discrete and continuous distribution:
In[11]:= di =
TransformedDistribution[(2 z - 1) x, {z \[Distributed]
BernoulliDistribution[1/2],
x \[Distributed] ExponentialDistribution[1]}];
In[12]:= CDF[di, z]
Out[12]= CDF[
TransformedDistribution[(-1 +
2 \[FormalX]1) \[FormalX]2, {\[FormalX]1 \[Distributed]
BernoulliDistribution[1/2], \[FormalX]2 \[Distributed]
ExponentialDistribution[1]}], z]
As it is often the case, one can work out the answer in an alternative way:
In[13]:= CharacteristicFunction[di, t] // Simplify
Out[13]= 1/(1 + t^2)
In[14]:= pdf =
InverseFourierTransform[%, t, x, FourierParameters -> {1, 1}]
Out[14]= 1/2 E^-Abs[x]
PDF[...]
actually returns values ? $\endgroup$ – b.gates.you.know.what Apr 26 '12 at 8:24TransformedDistribution
doesn't seem to like products of distributions, or the mixture of Exponential and Bernoulli, $\endgroup$ – image_doctor Apr 26 '12 at 10:16TransformedDistribution
isn't anything more than a toy at this point: it can take a large amount of computation to obtain simple sums (such as adding an Exponential to a Gamma variate), if it succeeds at all, and simply fails quietly when evaluating most multivariate expressions. $\endgroup$ – whuber Apr 26 '12 at 14:52