Home page for accesible maths 4 Univariate Transformations

Style control - access keys in brackets

Font (2 3) - + Letter spacing (4 5) - + Word spacing (6 7) - + Line spacing (8 9) - +

4.1 Introduction

Sometimes we are interested in a function of a random variable X, say Y=g(X). For example, we have already discussed interest in the linear transformation

Y=X-μXσX.

Other applied examples include

X Y
Diameter of imperfection in material Area of imperfection
Speed of vehicle Time to complete journey
Level of liquid in a vessel Volume of liquid
Length of phone call Cost of phone call

It is easy to show that in general the expectation of a function is not equal to the function of the expectation, i.e.

𝖤[Y]=𝖤[g(X)]g(𝖤[X]).

For example 𝖤[X2]>𝖤[X]2 unless X is constant, i.e. unless 𝖵𝖺𝗋[X]=0. Therefore what can we say about the new random variable Y=g(X)?

First consider the case of a discrete random variable X and let Y=g(X) for some real-valued function, g. Then

pY(y) =ωΩ:Y(ω)=y𝖯(ω)
=ωΩ:g(X(ω))=y𝖯(ω)
=x:g(x)=yωΩ:X(ω)=x𝖯(Ω)
=x:g(x)=ypX(x).

In the discrete case finding the distribution of the transformed random variable Y=g(X) is a simple matter of adding up the corresponding probabilities for X.

Example 4.1.1.

Let X have the following pmf

Value of X 0 1 2
pX(x) 1/6 1/3 1/2

What are the pmfs of Y=X2 and V=(X-1)2?

Solution. 

Value of X 0 1 2
pX(x) 1/6 1/3 1/2
Value of Y 0 1 4
Value of V 1 0 1

Hence the mass functions are:

Value of Y 0 1 4
pY(y) 1/6 1/3 1/2
Value of V 0 1
pV(v) 1/3 2/3

For continuous random variables, we have 𝖯(X=x)=0 for all x and we cannot find the density of T=g(X) at T=t by adding up the densities of all values of x for which g(x)=t.

This is illustrated in the figure. The left panel shows the histogram of a 1000 independent samples from a random variable U with a 𝖴𝗇𝗂𝖿(0,2) distribution. The right histogram is of Y=U2. Just as in the first part of Example 4.1.1, the transformation is 1-1, so for each U there is exactly one corresponding Y; hence if we could map densities in the same way that we map mass functions the second histogram would also be approximately flat.

par(mfrow=c(1,2))
U<-runif(10000,0,2)
Y<-U^2
hist(U,br=20,prob=TRUE)
hist(Y,br=20,prob=TRUE)

Unnumbered Figure: First link, Second Link

In the following we will see different methods of obtaining the cdf FY(y) and pdf fY(y) of the transformed random variable Y=g(X) when X is a continuous random variable with cdf FX(x) and pdf fX(x).