# Quantile & TransformedDistribution

xd = ExponentialDistribution[1.0];
yd = ExponentialDistribution[5.0];
td = TransformedDistribution[x/(x + y), {x \[Distributed] xd, y \[Distributed] yd}];
Mean[td]
CDF[td, z]


All the above works as expected. But when I do

Quantile[td, 0.95]


I get the input echoed as the answer, i.e. MMA can not do this. Same answer in 9 & 10.

Any suggestions? Known bug or am I doing something wrong?

Mathematica does not automatically calculate the quantile (or InverseCDF) for arbitrary distributions. You need to do it.

xd = ExponentialDistribution[1]; (* use exact argument *)
yd = ExponentialDistribution[5]; (* use exact argument *)
td = TransformedDistribution[
x/(x + y), {x \[Distributed] xd, y \[Distributed] yd}];

quantile[q_] = z /. Solve[{CDF[td, z] == q, 0 <= z <= 1}, z, Reals][[1]]


ConditionalExpression[(5 q)/(1 + 4 q), 0 < q < 1]

quantile[0.95]


0.989583

Plot[quantile[q], {q, 0, 1}]


EDIT: Generalizing the problem:

Clear[\[Lambda]x, \[Lambda]y, td, z]

td[\[Lambda]x_, \[Lambda]y_] = TransformedDistribution[x/(x + y),
{x \[Distributed] ExponentialDistribution[\[Lambda]x],
y \[Distributed] ExponentialDistribution[\[Lambda]y]}];

quantile[td[\[Lambda]x_, \[Lambda]y_], q_] =
z /. Solve[{CDF[td[\[Lambda]x, \[Lambda]y], z] == q, 0 < q < 1},
z, Reals][[1]] // Simplify[#, {\[Lambda]x > 0, \[Lambda]y > 0}] &


ConditionalExpression[(q*[Lambda]y)/([Lambda]x - q*[Lambda]x + q*[Lambda]y), 0 < q < 1]

({#, z = quantile[td[\[Lambda]x, \[Lambda]y], Rationalize[#]],
z /. {\[Lambda]x -> 1., \[Lambda]y ->
5}} & /@
{.5, .75, .9, .95, .99} // Simplify) //

• It is correct that Mathematica will not give a symbolic closed form of the InverseCDF for an arbitrary distribution, if it doesn't exist. But isn't Mathematica supposed to give a numarical value for, in this example, InverseCDF[td,0.95]? – Karsten 7. Jul 22 '14 at 16:28