Books Probability and Statistical Inference

Functions of One Random Variable

Let 𝑋𝑋 be a random variable of continuous type. If we consider a function 𝑒(π‘₯)𝑒(π‘₯) defined on the support of 𝑋𝑋, then we can define a new random variable π‘Œ=𝑒(𝑋)π‘Œ=𝑒(𝑋). If we can find its CDF via

𝐺(𝑦)=P(π‘Œβ‰€π‘¦)=P(𝑒(𝑋)≀𝑦),𝐺(𝑦)=β„™(π‘Œ\leq 𝑦)=β„™(𝑒(𝑋)\leq 𝑦),

then its PDF 𝑔(𝑦)𝑔(𝑦) is given by

𝑔(𝑦)=𝐺′(𝑦).𝑔(𝑦)={𝐺}^{\prime }(𝑦).

This method is called distribution function technique.

Example 5.1

A spinner is fixed at (0,1)(0,1) in the π‘₯𝑦π‘₯𝑦-plane and determines a ray from that point. Let π‘Šπ‘Š be the angle from the downward vertical (the direction of decreasing 𝑦𝑦) to the ray, with π‘Š>0π‘Š>0 when the ray tilts toward the positive π‘₯π‘₯-axis, and assume π‘Šπ‘Š is uniformly distributed on [βˆ’Ο€/2,Ο€/2][-\pi /2,\pi /2]. Let 𝑋𝑋 be the π‘₯π‘₯-coordinate of the point where the ray meets the π‘₯π‘₯-axis.

We have

𝑋=tan⁑(π‘Š).𝑋=\tan (π‘Š).

The CDF of π‘Šπ‘Š is

𝐹(𝑀)=P(π‘Šβ‰€π‘€)={0,𝑀<βˆ’Ο€/21Ο€(𝑀+Ο€2),βˆ’Ο€/2≀𝑀<Ο€/21,𝑀β‰₯Ο€/2.𝐹(𝑀)=β„™(π‘Š\leq 𝑀)=\begin{cases}0,\quad & 𝑀<-\pi /2 \\ \frac{1}{\pi }\left(𝑀+\frac{\pi }{2}\right),\quad & -\pi /2\leq 𝑀<\pi /2 \\ 1,\quad & 𝑀\geq \pi /2\end{cases}.

We are interested in the distribution of 𝑋𝑋. The CDF of 𝑋𝑋 is

𝐺(π‘₯)=P(𝑋≀π‘₯)=P(tan⁑(π‘Š)≀π‘₯)=P(π‘Šβ‰€arctan⁑π‘₯)=𝐹(arctan⁑π‘₯).𝐺(π‘₯)=β„™(𝑋\leq π‘₯)=β„™(\tan (π‘Š)\leq π‘₯)=β„™(π‘Š\leq \operatorname{arctan}π‘₯)=𝐹(\operatorname{arctan}π‘₯).

Since βˆ’Ο€/2≀arctan⁑π‘₯≀π/2-\pi /2\leq \operatorname{arctan}π‘₯\leq \pi /2, applying the second case of 𝐹(𝑀)𝐹(𝑀) yields

𝐺(π‘₯)=1Ο€(arctan⁑π‘₯+Ο€2).𝐺(π‘₯)=\frac{1}{\pi }\left(\operatorname{arctan}π‘₯+\frac{\pi }{2}\right).

Differentiating, we get the PDF of 𝑋𝑋:

𝑔(π‘₯)=𝐺′(π‘₯)=1Ο€(1+π‘₯2),π‘₯∈R.𝑔(π‘₯)={𝐺}^{\prime }(π‘₯)=\frac{1}{\pi (1+{π‘₯}^{2})},\quad π‘₯\in \mathbb{R}.
(5.1)

The spinner geometry and the Cauchy density in (5.1) are illustrated in Figure 5.1.

Figure 5.1 Left: spinner at (0,1)(0,1), with angle π‘Šπ‘Š measured from the downward vertical to the ray and π‘₯π‘₯-intercept 𝑋=tanβ‘π‘Šπ‘‹=\tan π‘Š. Right: Cauchy density 𝑔(π‘₯)=1Ο€(1+π‘₯2)𝑔(π‘₯)=\frac{1}{\pi (1+{π‘₯}^{2})}.

Random variables with PDF of the form of (5.1) are said to have a Cauchy distribution.

Exercise 5.1
Show that the mean 𝐸[𝑋]𝐸[𝑋] of a Cauchy random variable is undefined.
Proof

Consider the improper integral

βˆ«βˆ’βˆžβˆžπ‘₯Ο€(1+π‘₯2) dπ‘₯.{\int }_{-\infty }^{\infty }\frac{π‘₯}{\pi (1+{π‘₯}^{2})}\, \mathrm{d}π‘₯.

For it to exist, a necessary condition is that

limβ‘π‘β†’βˆžβˆ«1𝑏π‘₯Ο€(1+π‘₯2) dπ‘₯\lim _{𝑏\to \infty }{\int }_{1}^{𝑏}\frac{π‘₯}{\pi (1+{π‘₯}^{2})}\, \mathrm{d}π‘₯

exists as a finite number. We will show that the integral above diverges by comparison test. When π‘₯π‘₯ is large enough (in fact, π‘₯β‰₯1π‘₯\geq 1), we have

π‘₯Ο€(1+π‘₯2)=1Ο€(π‘₯+1π‘₯)β‰₯1Ο€(π‘₯+π‘₯)=12Ο€π‘₯.\frac{π‘₯}{\pi (1+{π‘₯}^{2})}=\frac{1}{\pi \left(π‘₯+\frac{1}{π‘₯}\right)}\geq \frac{1}{\pi (π‘₯+π‘₯)}=\frac{1}{2\pi π‘₯}.

Since

∫1𝑏12Ο€π‘₯ dπ‘₯=[ln⁑π‘₯2Ο€]1𝑏=ln⁑𝑏2Ο€β†’βˆžasβ€‰π‘β†’βˆž,{\int }_{1}^{𝑏}\frac{1}{2\pi π‘₯}\, \mathrm{d}π‘₯={\left[\frac{\ln π‘₯}{2\pi }\right]}_{1}^{𝑏}=\frac{\ln 𝑏}{2\pi }\to \infty \quad \text{as}\, 𝑏\to \infty ,

we conclude that

limβ‘π‘β†’βˆžβˆ«1𝑏π‘₯Ο€(1+π‘₯2) dπ‘₯=∞.\lim _{𝑏\to \infty }{\int }_{1}^{𝑏}\frac{π‘₯}{\pi (1+{π‘₯}^{2})}\, \mathrm{d}π‘₯=\infty .

This means that the improper integral is undefined, and hence the mean of a Cauchy random variable is undefined.

Sometimes when the function 𝑒(π‘₯)𝑒(π‘₯) has certain properties, we can shortcut the distribution function technique by using the so-called change of variable technique. Let 𝑋𝑋 be a random variable of continuous type with PDF 𝑓𝑋(π‘₯){𝑓}_{𝑋}(π‘₯) on the support 𝑆𝑋=(𝑐1,𝑐2){𝑆}_{𝑋}=({𝑐}_{1},{𝑐}_{2}). Let π‘Œ=𝑒(𝑋)π‘Œ=𝑒(𝑋) where 𝑒(π‘₯)𝑒(π‘₯) is a strictly increasing and differentiable function on 𝑆𝑋{𝑆}_{𝑋}. Then 𝑒𝑒 has an inverse function 𝑣=π‘’βˆ’1𝑣={𝑒}^{-1} (that is also strictly increasing and differentiable). The support 𝑆𝑋{𝑆}_{𝑋} is mapped to π‘†π‘Œ=(𝑑1,𝑑2){𝑆}_{π‘Œ}=({𝑑}_{1},{𝑑}_{2}) by 𝑒𝑒. Here, 𝑑1=𝑒(𝑐1){𝑑}_{1}=𝑒({𝑐}_{1}) and 𝑑2=𝑒(𝑐2){𝑑}_{2}=𝑒({𝑐}_{2}). Then, the CDF of π‘Œπ‘Œ is

πΉπ‘Œ(𝑦)=P(π‘Œβ‰€π‘¦)=P(𝑒(𝑋)≀𝑦)=P(π‘‹β‰€π‘’βˆ’1(𝑦))=𝐹𝑋[𝑣(𝑦)]{𝐹}_{π‘Œ}(𝑦)=β„™(π‘Œ\leq 𝑦)=β„™(𝑒(𝑋)\leq 𝑦)=β„™(𝑋\leq {𝑒}^{-1}(𝑦))={𝐹}_{𝑋}[𝑣(𝑦)]

On the support π‘†π‘Œ=(𝑑1,𝑑2){𝑆}_{π‘Œ}=({𝑑}_{1},{𝑑}_{2}), we have

πΉπ‘Œ(𝑦)=βˆ«π‘1𝑣(𝑦)𝑓𝑋(π‘₯) dπ‘₯,𝑑1<𝑦<𝑑2.{𝐹}_{π‘Œ}(𝑦)={\int }_{{𝑐}_{1}}^{𝑣(𝑦)}{𝑓}_{𝑋}(π‘₯)\, \mathrm{d}π‘₯,\quad {𝑑}_{1}<𝑦<{𝑑}_{2}.

Differentiating, we get the PDF of π‘Œπ‘Œ:

π‘“π‘Œ(𝑦)=πΉπ‘Œβ€²(𝑦)=𝑓𝑋[𝑣(𝑦)]𝑣′(𝑦).{𝑓}_{π‘Œ}(𝑦)={𝐹}_{π‘Œ}\prime (𝑦)={𝑓}_{𝑋}[𝑣(𝑦)]{𝑣}^{\prime }(𝑦).

An analogous result holds for the case when 𝑒(π‘₯)𝑒(π‘₯) is decreasing. In that case, we have

π‘“π‘Œ(𝑦)=πΉπ‘Œβ€²(𝑦)=𝑓𝑋[𝑣(𝑦)][βˆ’π‘£β€²(𝑦)].{𝑓}_{π‘Œ}(𝑦)={𝐹}_{π‘Œ}\prime (𝑦)={𝑓}_{𝑋}[𝑣(𝑦)][-{𝑣}^{\prime }(𝑦)].

Since 𝑣′(𝑦)>0{𝑣}^{\prime }(𝑦)>0 when 𝑒𝑒 is increasing, and 𝑣′(𝑦)<0{𝑣}^{\prime }(𝑦)<0 when 𝑒𝑒 is decreasing, we can summarize the result for both cases as

π‘“π‘Œ(𝑦)=𝑓𝑋[𝑣(𝑦)]βˆ£π‘£β€²(𝑦)∣.{𝑓}_{π‘Œ}(𝑦)={𝑓}_{𝑋}[𝑣(𝑦)]|{𝑣}^{\prime }(𝑦)|.
(5.2)

(5.2) tells us that we can simply plug 𝑣(𝑦)𝑣(𝑦) into the PDF of 𝑋𝑋 and multiply by βˆ£π‘£β€²(𝑦)∣|{𝑣}^{\prime }(𝑦)| to get the PDF of π‘Œπ‘Œ, bypassing the determination of the CDF of π‘Œπ‘Œ.

Exercise 5.2

Let 𝑋𝑋 have the PDF

𝑓(π‘₯)=3(1βˆ’π‘₯)2,0<π‘₯<1.𝑓(π‘₯)=3{(1-π‘₯)}^{2},\quad 0<π‘₯<1.

Find the PDF of π‘Œ=𝑒(𝑋)=(1βˆ’π‘‹)3π‘Œ=𝑒(𝑋)={(1-𝑋)}^{3}.

Solution

𝑒(π‘₯)=(1βˆ’π‘₯)3𝑒(π‘₯)={(1-π‘₯)}^{3} is strictly decreasing and differentiable in (0,1)(0,1). Its inverse is

𝑣(𝑦)=1βˆ’π‘¦13,0<𝑦<1.𝑣(𝑦)=1-{𝑦}^{\frac{1}{3}},\quad 0<𝑦<1.

Differentiate,

𝑣′(𝑦)=βˆ’13π‘¦βˆ’23.{𝑣}^{\prime }(𝑦)=-\frac{1}{3}{𝑦}^{-\frac{2}{3}}.

Therefore, the PDF of π‘Œπ‘Œ is

𝑔(𝑦)=𝑓[𝑣(𝑦)]βˆ£π‘£β€²(𝑦)∣=1,0<𝑦<1.𝑔(𝑦)=𝑓[𝑣(𝑦)]|{𝑣}^{\prime }(𝑦)|=1,\quad 0<𝑦<1.

This implies that π‘Œπ‘Œ has a uniform distribution on (0,1)(0,1), i.e., π‘ŒβˆΌπ’°(0,1)π‘ŒβˆΌπ’°(0,1).

Formula (5.2) requires a one-to-one transformation. When 𝑒𝑒 is not injectiveβ€”for example, 𝑋=π‘Œ2𝑋={π‘Œ}^{2} sends both 𝑦𝑦 and βˆ’π‘¦-𝑦 to the same valueβ€”we must account for every preimage, not just one branch.

Exercise 5.3

Let π‘Ž>0π‘Ž>0, where π‘Žπ‘Ž may be ∞\infty . Let 𝑋𝑋 have support (0,π‘Ž)(0,π‘Ž) and PDF 𝑓𝑋{𝑓}_{𝑋}. Let π‘Œπ‘Œ have support (βˆ’π‘Ž,π‘Ž)\left(-\sqrt{π‘Ž},\sqrt{π‘Ž}\right) (when π‘Ž=βˆžπ‘Ž=\infty , read this as (βˆ’βˆž,∞)(-\infty ,\infty )). Suppose that π‘Œπ‘Œ and βˆ’π‘Œ-π‘Œ have the same distribution and that 𝑋=π‘Œ2𝑋={π‘Œ}^{2}. Show that

π‘“π‘Œ(𝑦)=βˆ£π‘¦βˆ£π‘“π‘‹(𝑦2),βˆ’π‘Ž<𝑦<π‘Ž.{𝑓}_{π‘Œ}(𝑦)=|𝑦|{𝑓}_{𝑋}({𝑦}^{2}),\quad -\sqrt{π‘Ž}<𝑦<\sqrt{π‘Ž}.
Remark

Here 𝑋=𝑣(π‘Œ)=π‘Œ2𝑋=𝑣(π‘Œ)={π‘Œ}^{2}, so 𝑣′(𝑦)=2𝑦{𝑣}^{\prime }(𝑦)=2𝑦. Applying (5.2) would give

π‘“π‘Œ(𝑦)=𝑓𝑋[𝑣(𝑦)]βˆ£π‘£β€²(𝑦)∣=2𝑦𝑓𝑋(𝑦2),{𝑓}_{π‘Œ}(𝑦)={𝑓}_{𝑋}[𝑣(𝑦)]|{𝑣}^{\prime }(𝑦)|=2𝑦{𝑓}_{𝑋}({𝑦}^{2}),

which cannot hold for all 𝑦𝑦 when π‘Œπ‘Œ is symmetric about 00. The transformation is two-to-one on (βˆ’π‘Ž,π‘Ž)\left(-\sqrt{π‘Ž},\sqrt{π‘Ž}\right): each π‘₯∈(0,π‘Ž)π‘₯\in (0,π‘Ž) arises from both 𝑦=π‘₯𝑦=\sqrt{π‘₯} and 𝑦=βˆ’π‘₯𝑦=-\sqrt{π‘₯}.

Proof

Symmetry of π‘Œπ‘Œ gives π‘“π‘Œ(βˆ’π‘¦)=π‘“π‘Œ(𝑦){𝑓}_{π‘Œ}(-𝑦)={𝑓}_{π‘Œ}(𝑦) and πΉπ‘Œ(βˆ’π‘¦)=1βˆ’πΉπ‘Œ(𝑦){𝐹}_{π‘Œ}(-𝑦)=1-{𝐹}_{π‘Œ}(𝑦) for all π‘¦βˆˆ(βˆ’π‘Ž,π‘Ž)𝑦\in \left(-\sqrt{π‘Ž},\sqrt{π‘Ž}\right). Because 𝑋=π‘Œ2𝑋={π‘Œ}^{2}, probabilities for π‘Œ2{π‘Œ}^{2} involve values of π‘Œπ‘Œ on both sides of 00. We treat 𝑦<0𝑦<0 and 𝑦β‰₯0𝑦\geq 0 separately; in each case 𝑦2∈(0,π‘Ž){𝑦}^{2}\in (0,π‘Ž), so 𝐹𝑋(𝑦2){𝐹}_{𝑋}({𝑦}^{2}) is defined.

When 𝑦<0𝑦<0, we have π‘Œβ‰€π‘¦π‘Œ\leq 𝑦 if and only if π‘Œβ‰₯βˆ’π‘¦π‘Œ\geq -𝑦, so by symmetry

P(π‘Œβ‰€π‘¦)=P(π‘Œβ‰₯βˆ’π‘¦).β„™(π‘Œ\leq 𝑦)=β„™(π‘Œ\geq -𝑦).

Therefore,

P(π‘Œ2β‰₯𝑦2)=P(π‘Œβ‰€π‘¦)+P(π‘Œβ‰₯βˆ’π‘¦)=2P(π‘Œβ‰€π‘¦)=2πΉπ‘Œ(𝑦).β„™({π‘Œ}^{2}\geq {𝑦}^{2})=β„™(π‘Œ\leq 𝑦)+β„™(π‘Œ\geq -𝑦)=2β„™(π‘Œ\leq 𝑦)=2{𝐹}_{π‘Œ}(𝑦).

It follows that

πΉπ‘Œ(𝑦)=12P(π‘Œ2β‰₯𝑦2)=12βˆ’12P(π‘Œ2≀𝑦2)=12βˆ’12𝐹𝑋(𝑦2).{𝐹}_{π‘Œ}(𝑦)=\frac{1}{2}β„™({π‘Œ}^{2}\geq {𝑦}^{2})=\frac{1}{2}-\frac{1}{2}β„™({π‘Œ}^{2}\leq {𝑦}^{2})=\frac{1}{2}-\frac{1}{2}{𝐹}_{𝑋}({𝑦}^{2}).

Differentiating gives, for 𝑦<0𝑦<0,

π‘“π‘Œ(𝑦)=πΉπ‘Œβ€²(𝑦)=βˆ’12𝑓𝑋(𝑦2)β‹…2𝑦=βˆ’π‘¦π‘“π‘‹(𝑦2).{𝑓}_{π‘Œ}(𝑦)={𝐹}_{π‘Œ}\prime (𝑦)=-\frac{1}{2}{𝑓}_{𝑋}({𝑦}^{2})\cdot 2𝑦=-𝑦{𝑓}_{𝑋}({𝑦}^{2}).

When 𝑦β‰₯0𝑦\geq 0, we have

P(π‘Œ2≀𝑦2)=P(βˆ’π‘¦β‰€π‘Œβ‰€π‘¦).β„™({π‘Œ}^{2}\leq {𝑦}^{2})=β„™(-𝑦\leq π‘Œ\leq 𝑦).

By symmetry,

P(βˆ’π‘¦β‰€π‘Œβ‰€π‘¦)=2P(0β‰€π‘Œβ‰€π‘¦).β„™(-𝑦\leq π‘Œ\leq 𝑦)=2β„™(0\leq π‘Œ\leq 𝑦).

Splitting P(π‘Œβ‰€π‘¦)β„™(π‘Œ\leq 𝑦) at βˆ’π‘¦-𝑦,

πΉπ‘Œ(𝑦)=P(π‘Œβ‰€π‘¦)=P(π‘Œ<βˆ’π‘¦)+P(βˆ’π‘¦β‰€π‘Œβ‰€π‘¦)=P(π‘Œ<βˆ’π‘¦)+P(π‘Œ2≀𝑦2).{𝐹}_{π‘Œ}(𝑦)=β„™(π‘Œ\leq 𝑦)=β„™(π‘Œ<-𝑦)+β„™(-𝑦\leq π‘Œ\leq 𝑦)=β„™(π‘Œ<-𝑦)+β„™({π‘Œ}^{2}\leq {𝑦}^{2}).

Since βˆ’π‘¦β‰€0-𝑦\leq 0, the case 𝑦<0𝑦<0 already gives P(π‘Œ<βˆ’π‘¦)=12βˆ’12𝐹𝑋(𝑦2)β„™(π‘Œ<-𝑦)=\frac{1}{2}-\frac{1}{2}{𝐹}_{𝑋}({𝑦}^{2}). Hence

πΉπ‘Œ(𝑦)=12βˆ’12𝐹𝑋(𝑦2)+12P(π‘Œ2≀𝑦2)=12βˆ’12𝐹𝑋(𝑦2)+𝐹𝑋(𝑦2)=12+12𝐹𝑋(𝑦2).\begin{aligned}{𝐹}_{π‘Œ}(𝑦) & =\frac{1}{2}-\frac{1}{2}{𝐹}_{𝑋}({𝑦}^{2})+\frac{1}{2}β„™({π‘Œ}^{2}\leq {𝑦}^{2}) \\ & =\frac{1}{2}-\frac{1}{2}{𝐹}_{𝑋}({𝑦}^{2})+{𝐹}_{𝑋}({𝑦}^{2}) \\ & =\frac{1}{2}+\frac{1}{2}{𝐹}_{𝑋}({𝑦}^{2}).\end{aligned}

Differentiating gives, for 𝑦β‰₯0𝑦\geq 0,

π‘“π‘Œ(𝑦)=πΉπ‘Œβ€²(𝑦)=12𝑓𝑋(𝑦2)β‹…2𝑦=𝑦𝑓𝑋(𝑦2).{𝑓}_{π‘Œ}(𝑦)={𝐹}_{π‘Œ}\prime (𝑦)=\frac{1}{2}{𝑓}_{𝑋}({𝑦}^{2})\cdot 2𝑦=𝑦{𝑓}_{𝑋}({𝑦}^{2}).

Combining the two cases,

π‘“π‘Œ(𝑦)={βˆ’π‘¦π‘“π‘‹(𝑦2),𝑦<0𝑦𝑓𝑋(𝑦2),𝑦β‰₯0=βˆ£π‘¦βˆ£π‘“π‘‹(𝑦2).{𝑓}_{π‘Œ}(𝑦)=\begin{cases}-𝑦{𝑓}_{𝑋}({𝑦}^{2}),\quad & 𝑦<0 \\ 𝑦{𝑓}_{𝑋}({𝑦}^{2}),\quad & 𝑦\geq 0\end{cases}=|𝑦|{𝑓}_{𝑋}({𝑦}^{2}).

The following theorem provides a way to generate any continuous type random variable 𝑋𝑋 from a uniform random variable π‘ŒβˆΌπ’°(0,1)π‘ŒβˆΌπ’°(0,1) and the CDF of 𝑋𝑋.

Theorem 5.1
Let π‘ŒβˆΌπ’°(0,1)π‘ŒβˆΌπ’°(0,1). Let 𝐹𝐹 have the properties of a CDF of the continuous type with 𝐹(π‘Ž)=0𝐹(π‘Ž)=0, 𝐹(𝑏)=1𝐹(𝑏)=1, and suppose that 𝐹𝐹 is strictly increasing in (π‘Ž,𝑏)(π‘Ž,𝑏) where π‘Žπ‘Ž and 𝑏𝑏 may be βˆ’βˆž-\infty and ∞\infty , respectively. Then the random variable 𝑋𝑋 defined by 𝑋=πΉβˆ’1(π‘Œ)𝑋={𝐹}^{-1}(π‘Œ) is a continuous type random variable with the CDF 𝐹𝐹.
Proof

The CDF of 𝑋𝑋 is given by

𝐹𝑋(π‘₯)=P(𝑋≀π‘₯)=P(πΉβˆ’1(π‘Œ)≀π‘₯).{𝐹}_{𝑋}(π‘₯)=β„™(𝑋\leq π‘₯)=β„™({𝐹}^{-1}(π‘Œ)\leq π‘₯).

Since the inverse πΉβˆ’1{𝐹}^{-1} is well-defined, the following two events are the same:

{πΉβˆ’1(π‘Œ)≀π‘₯}={π‘Œβ‰€πΉ(π‘₯)}.\{{𝐹}^{-1}(π‘Œ)\leq π‘₯\}=\{π‘Œ\leq 𝐹(π‘₯)\}.

Thus,

𝐹𝑋(π‘₯)=P(π‘Œβ‰€πΉ(π‘₯))=𝐺[𝐹(π‘₯)]{𝐹}_{𝑋}(π‘₯)=β„™(π‘Œ\leq 𝐹(π‘₯))=𝐺[𝐹(π‘₯)]

where 𝐺(𝑦)𝐺(𝑦) is the CDF of π‘Œπ‘Œ, and it is given by

𝐺(𝑦)={0,𝑦<0𝑦,0≀𝑦<11,𝑦β‰₯1𝐺(𝑦)=\begin{cases}0,\quad & 𝑦<0 \\ 𝑦,\quad & 0\leq 𝑦<1 \\ 1,\quad & 𝑦\geq 1\end{cases}

Since 0≀𝐹(𝑦)≀10\leq 𝐹(𝑦)\leq 1, we have

𝐹𝑋(π‘₯)=𝐺[𝐹(π‘₯)]=𝐹(π‘₯).{𝐹}_{𝑋}(π‘₯)=𝐺[𝐹(π‘₯)]=𝐹(π‘₯).

That is, the CDF of 𝑋𝑋 is 𝐹𝐹.

In practice, simulation via Theorem 5.1 is less straightforward than the theorem makes it look: the recipe πΉβˆ’1(π‘Œ){𝐹}^{-1}(π‘Œ) is simple on paper, but the bottleneck is evaluating the inverse CDF πΉβˆ’1{𝐹}^{-1}. Closed forms are rare, so one usually resorts to numerical methods for quantiles.

Consider drawing a standard normal random variable. Neither Ξ¦\Phi nor Ξ¦βˆ’1{\Phi }^{-1} is available in closed elementary form. Later we use the Box–Muller transformation for that purpose.

To illustrate Theorem 5.1 with a transparent inverse, we take the Cauchy distribution, whose quantile map is an elementary trigonometric function (after a linear change of variables, it is tan⁑\tan ).

Example 5.2

Let’s return to Example 5.1. Suppose π‘ŠβˆΌπ’°(βˆ’Ο€2,Ο€2)π‘ŠβˆΌπ’°\left(-\frac{\pi }{2},\frac{\pi }{2}\right) and define

𝑋=tan⁑(π‘Š).𝑋=\tan (π‘Š).

Now suppose π‘ŒβˆΌπ’°(0,1)π‘ŒβˆΌπ’°(0,1). The CDF of π‘Šπ‘Š is πΉπ‘Š(𝑀)=𝑀+Ο€2Ο€{𝐹}_{π‘Š}(𝑀)=\frac{𝑀+\frac{\pi }{2}}{\pi } for βˆ’Ο€2≀𝑀≀π2-\frac{\pi }{2}\leq 𝑀\leq \frac{\pi }{2}, so we may write π‘Š=Ο€π‘Œβˆ’Ο€2π‘Š=\pi π‘Œ-\frac{\pi }{2}. Then 𝑋𝑋 as a function of π‘Œπ‘Œ is

𝑋=tan⁑(Ο€π‘Œβˆ’Ο€2).𝑋=\tan \left(\pi π‘Œ-\frac{\pi }{2}\right).
(5.3)

In Example 5.1 we showed that 𝑋𝑋 has PDF

𝑓(π‘₯)=1Ο€(1+π‘₯2),π‘₯∈R,𝑓(π‘₯)=\frac{1}{\pi (1+{π‘₯}^{2})},\quad π‘₯\in \mathbb{R},

and CDF

𝐹(π‘₯)=βˆ«βˆ’βˆžπ‘₯1Ο€(1+𝑑2) d𝑑=1Ο€arctan⁑π‘₯+12,π‘₯∈R.𝐹(π‘₯)={\int }_{-\infty }^{π‘₯}\frac{1}{\pi (1+{𝑑}^{2})}\, \mathrm{d}𝑑=\frac{1}{\pi }\operatorname{arctan}π‘₯+\frac{1}{2},\quad π‘₯\in \mathbb{R}.

The inverse is

πΉβˆ’1(𝑦)=tan⁑(Ο€π‘¦βˆ’Ο€2),0<𝑦<1.{𝐹}^{-1}(𝑦)=\tan \left(\pi 𝑦-\frac{\pi }{2}\right),\quad 0<𝑦<1.

Therefore, by Theorem 5.1,

𝑋=πΉβˆ’1(π‘Œ)=tan⁑(Ο€π‘Œβˆ’Ο€2),𝑋={𝐹}^{-1}(π‘Œ)=\tan \left(\pi π‘Œ-\frac{\pi }{2}\right),

which matches (5.3).

Figure 5.2 illustrates the quantile construction: independent draws π‘ŒβˆΌπ’°(0,1)π‘ŒβˆΌπ’°(0,1) are mapped through πΉβˆ’1{𝐹}^{-1} to obtain draws of 𝑋𝑋, with a histogram of the simulated values compared to the Cauchy density.

Figure 5.2 Histogram of simulated Cauchy draws 𝑋=πΉβˆ’1(π‘Œ)𝑋={𝐹}^{-1}(π‘Œ) (104{10}^{4} samples, π‘ŒβˆΌπ’°(0,1)π‘ŒβˆΌπ’°(0,1), 5050 bins).

The following theorem is the converse of Theorem 5.1.

Theorem 5.2
Let 𝑋𝑋 be a random variable of continuous type with a strictly increasing CDF 𝐹𝐹 defined on support (π‘Ž,𝑏)(π‘Ž,𝑏) where π‘Žπ‘Ž and 𝑏𝑏 may be βˆ’βˆž-\infty and ∞\infty , respectively. Define π‘Œ=𝐹(𝑋)π‘Œ=𝐹(𝑋). We have π‘ŒβˆΌπ’°(0,1)π‘ŒβˆΌπ’°(0,1).
Proof

Consider the CDF of π‘Œπ‘Œ. We have

πΉπ‘Œ(𝑦)=P(π‘Œβ‰€π‘¦)=P(𝐹(𝑋)≀𝑦),0<𝑦<1.{𝐹}_{π‘Œ}(𝑦)=β„™(π‘Œ\leq 𝑦)=β„™(𝐹(𝑋)\leq 𝑦),\quad 0<𝑦<1.

Because 𝐹𝐹 is strictly increasing, the event {𝐹(𝑋)≀𝑦}\{𝐹(𝑋)\leq 𝑦\} is equivalent to {π‘‹β‰€πΉβˆ’1(𝑦)}\{𝑋\leq {𝐹}^{-1}(𝑦)\}. It then follows that

πΉπ‘Œ(𝑦)=P(π‘‹β‰€πΉβˆ’1(𝑦))=𝐹(πΉβˆ’1(𝑦))=𝑦,0<𝑦<1.{𝐹}_{π‘Œ}(𝑦)=β„™(𝑋\leq {𝐹}^{-1}(𝑦))=𝐹({𝐹}^{-1}(𝑦))=𝑦,\quad 0<𝑦<1.

This is exactly the CDF of 𝒰(0,1)𝒰(0,1). Therefore, π‘ŒβˆΌπ’°(0,1)π‘ŒβˆΌπ’°(0,1).

Exercises

Exercise 5.4
Let π‘‹βˆΌGamma⁑(Ξ±,ΞΈ)π‘‹βˆΌ\operatorname{Gamma}(\alpha ,\theta ). Show that π‘Žπ‘‹βˆΌGamma⁑(Ξ±,π‘ŽΞΈ)π‘Žπ‘‹βˆΌ\operatorname{Gamma}(\alpha ,π‘Ž\theta ) for π‘Ž>0π‘Ž>0.
Proof

Let π‘Œ=π‘Žπ‘‹π‘Œ=π‘Žπ‘‹. We have 𝑋=𝑣(π‘Œ)=π‘Œ/π‘Žπ‘‹=𝑣(π‘Œ)=π‘Œ/π‘Ž. Applying the change-of-variable technique, we get the PDF of π‘Œπ‘Œ:

𝑔(𝑦)=𝑓(𝑣(𝑦))βˆ£π‘£β€²(𝑦)∣=𝑓(π‘¦π‘Ž)β‹…1π‘Ž=1Ξ“(Ξ±)ΞΈΞ±(π‘¦π‘Ž)Ξ±βˆ’1π‘’βˆ’π‘¦π‘ŽΞΈβ‹…1π‘Ž=1Ξ“(Ξ±)ΞΈΞ±β‹…1π‘ŽΞ±βˆ’1β‹…1π‘Žβ‹…π‘¦Ξ±βˆ’1π‘’βˆ’π‘¦π‘ŽΞΈ=1Ξ“(Ξ±)(π‘ŽΞΈ)Ξ±π‘¦Ξ±βˆ’1π‘’βˆ’π‘¦π‘ŽΞΈ.\begin{aligned}𝑔(𝑦)=𝑓(𝑣(𝑦))|{𝑣}^{\prime }(𝑦)|=𝑓\left(\frac{𝑦}{π‘Ž}\right)\cdot \frac{1}{π‘Ž} & =\frac{1}{\Gamma (\alpha ){\theta }^{\alpha }}{\left(\frac{𝑦}{π‘Ž}\right)}^{\alpha -1}{𝑒}^{-\frac{𝑦}{π‘Ž\theta }}\cdot \frac{1}{π‘Ž} \\ & =\frac{1}{\Gamma (\alpha ){\theta }^{\alpha }}\cdot \frac{1}{{π‘Ž}^{\alpha -1}}\cdot \frac{1}{π‘Ž}\cdot {𝑦}^{\alpha -1}{𝑒}^{-\frac{𝑦}{π‘Ž\theta }} \\ & =\frac{1}{\Gamma (\alpha ){(π‘Ž\theta )}^{\alpha }}{𝑦}^{\alpha -1}{𝑒}^{-\frac{𝑦}{π‘Ž\theta }}.\end{aligned}

Therefore, π‘ŒβˆΌGamma⁑(Ξ±,π‘ŽΞΈ)π‘ŒβˆΌ\operatorname{Gamma}(\alpha ,π‘Ž\theta ).