# The distribution of one variable, which is a function of another, random variable

Suppose I have the following equation:

a = -(Log[(1 - b)/b]/Log[10])


which is visualized as

Suppose further that $b$ is drawn from a uniform distribution with minimum $L$ and maximum $H$, where $0<L<H<1$. For example $L = 0.6$ and $H = 0.8$.

How can I use Mathematica to find the associated distribution of $a$?

You can use TransformedDistribution:

a = -(Log[(1 - b)/b]/Log[10]);
l = .6; h = .8;
td = TransformedDistribution[a, Distributed[b, UniformDistribution[{l, h}]]];

PDF[td, x] // TeXForm


$\small\begin{cases} \frac{5.75646 e^{2.30259 x}}{0.5\, +1. e^{2.30259 x}+0.5 e^{4.60517 x}} & 0.176091<x<0.60206\land 1. e^{2.30259 x}\geq 1.5\land e^{-2.30259 x}\geq 0.25 \\ 0 & \text{True} \end{cases}$

Plot[Evaluate@PDF[td, x], {x, 0, 1}]


ClearAll[pdF]
pdF[l_, h_] := PDF @ TransformedDistribution[-(Log[(1 - b)/b]/Log[10]),
Distributed[b, UniformDistribution[{l, h}]]];

Manipulate[Plot[Evaluate[pdF[l, h][x]], {x, -1, 1},
Filling -> Axis, PlotLabel -> Style[Row[{"{l, h} =", {l, h}}], 16], PlotRange -> {0, 2}],
{{l, .2}, 0, 1}, {{h, .6}, l, 1}]


• Beat me to it... Yep: again! If we were gunslingers in the wild west, you would (it seems) always beat me by just a fraction of a second! (No wonder your reputation is 157k!) Aug 29 '18 at 21:47
• @David, again?:)
– kglr
Aug 29 '18 at 21:48
• What does the y-axis show here? I was expecting probabilties. Aug 30 '18 at 6:53
• @user120911, y-axis show Probability Density Function (PDF), If you want to show Cumulative Distribution Function (CDF) you can replace PDF in the code with CDF.
– kglr
Aug 30 '18 at 7:02