The UNIVERSITY of NORTH CAROLINA at CHAPEL

Chapter 7. Functions of Random Variables
Sections 7.2 -- 7.4: Functions of Discrete Random
Variables, Method of Distribution Functions and
Method of Transformations in One Dimension
Jiaping Wang
Department of Mathematical Science
04/10/2013, Wednesday
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Outline
Functions of Discrete Random Variables
Methods of Distribution Functions
Method of Transformations in One Dimension
More Examples
Homework #10
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Part 1. Functions of Discrete Random
Variables
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Introduction
For example, there is a sample X1, X2, …, Xn from same
distribution, also there is a function denoted by Y=f(X1, X2, …,
Xn)=1/n∑Xi, which is a function of random variables {X1, X2, …,
Xn}.
Considering the discrete random variables, for example, X is a
discrete random variables with space S={0, 1, 2, 3}, C is a
function of X with C=150+50X, then we can have a mass
probability table
x
0
1
2
3
p(x)
0.5
0.3
0.15
0.05
c
150
200
250
300
p(c)
0.5
0.3
0.15
0.05
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Cont.
Considering X is a discrete random variables with space S={-1,
0, 1}, define Y=X2, then we can have a mass probability table
as follows
x
-1
0
1
p(x)
0.25
0.5
0.25
y
1
0
1
p(y)
0.25
0.5
0.25
y
0
1
p(y)
0.5
0.5
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Example 7.1
A quality control manager samples from a lot of items, testing
each item until r defectives have been found. Find the distribution
of Y, the number of items that are tested to obtain r defectives.
Answer: Assume that the probability p of obtaining a defective item is constant from trial
To trial, the number of good items X sampled prior to the r-th defective one is a negative
Binomial random variable. The mass function is
𝑃 𝑋 = 𝑥 = 𝑝 𝑥 = 𝑥+𝑟−1
𝑝𝑟𝑞𝑥, 𝑥 = 0, 1, 2, …
𝑟−1
The number of trials, Y, is equal to the sum of the number of good items and defective
Ones, that is, Y=X+r thus X=Y-r, with Y=r, r+1, r+2, … so the mass function for Y is
𝑃 𝑌 = 𝑦 = 𝑝 𝑦 = 𝑦−1
𝑝𝑟𝑞𝑦 − 𝑟, 𝑦 = 𝑟, 𝑟 + 1, 𝑟 + 2, …
𝑟−1
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Part 2. Method of Distribution Functions
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Introduction
If X has a probability density function 𝒇𝑿(𝒙), and Y is a
function of X, we are interested in finding 𝑭𝒀(𝒚) = 𝑷(𝒀 ≤
𝒚) or the density 𝒇𝒀(𝒚) by using the distribution of X.
For example, 𝒀 = 𝑿𝟐 with density 𝒇𝑿(𝒙). For y≥0,
𝑭𝒀 𝒚 = 𝑷 𝒀 ≤ 𝒚 = 𝑷 𝑿𝟐 ≤ 𝒚 = 𝑷 − 𝒚 ≤ 𝑿 ≤ 𝒚
= 𝑷 𝑿 ≤ 𝒚 − 𝐏 𝐗 ≤ − 𝒚 = 𝑭𝑿 𝒚 − 𝑭𝑿 − 𝒚 .
Then we can have the density function for Y:
𝒅
𝒅
𝒅
𝒇 𝒀 𝒚 = 𝑭𝒀 𝒚 = 𝑭𝑿 𝒚 − 𝑭𝑿 − 𝒚
𝒅𝒚
𝒅𝒚
𝒅𝒚
𝟏
𝟏
=
𝒇𝑿 𝒚 +
𝒇𝑿 − 𝒚
𝟐 𝒚
𝟐 𝒚
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Application in Normal Distribution
X is standard normal random variable, what is the probability density function
of Y=X2?
We know 𝑓𝑋 𝑥 =
𝑓𝑌 𝑦 =
1
2 𝑦
[
Recall that Γ
1
exp
2𝜋
1
exp
2𝜋
1
2
𝑥2
−
2
( 𝑦)2
−
2
+
, −∞ < 𝑥 < ∞, thus for y≥0,
1
exp
2𝜋
(− 𝑦)2
−
2
]=
−
1
y
2 𝜋
1
2
y
2
exp(− )
= 𝜋, we can see Y follows a gamma distribution with
parameters α=1/2 and β=2.
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Example 7.2
The proportion of time X that a lathe is in use during a typical 40-hour
workweek is a random variable whose probability density function is given by
3𝑥2, 0 ≤ 𝑥 ≤ 1
f x =
0, 𝑜𝑡ℎ𝑒𝑟𝑤𝑖𝑠𝑒.
The actual number of hours out of a 40-hour week that the lathe is not in use
then is Y=40(1-X). Find the probability density function for Y.
Answer:
𝑦
𝐹𝑌(𝑦) = 𝑃(𝑌 ≤ 𝑦) = 𝑃(40(1 − 𝑋) ≤ 𝑦) = 𝑃(𝑋 > 1 − 40) =
1
𝑦 3𝑥2𝑑𝑥
1−40
=1− 1−
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Example 7.5
Let X have the probability density function given by
𝑥+1
,
−1 ≤ 𝑥 ≤ 1
𝑓 𝑥 =
2
0,
𝑜𝑡ℎ𝑒𝑟𝑤𝑖𝑠𝑒
Find the density function for Y=X2.
Answer: In the earlier section, we found that
𝟏
𝒇𝒀 𝒚 =
[𝒇
𝒚 + 𝒇𝑿 − 𝒚 ]
𝟐 𝒚 𝑿
By substituting into this equation, we have
𝒇𝒀 𝒚 = 𝟐
𝟏
𝒚
𝒚+𝟏
− 𝒚+𝟏
+
𝟐
𝟐
𝟏
=
𝟐 𝒚
, 𝟎≤𝒚≤𝟏
𝟎, 𝒐𝒕𝒉𝒆𝒓𝒘𝒊𝒔𝒆
As −𝟏 ≤ 𝒙 ≤ 𝟏, 𝒚 = 𝒙𝟐 𝟎 ≤ 𝒚 ≤ 𝟏
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Summary
Summary of the Distribution Function Method
Let Y be a function of the continuous random variables X1, X2, …, Xn. Then
1.
2.
3.
4.
Find the region Y=y in the (X1, X2, …, Xn) space.
Find the region Y≤y.
Find 𝐹𝑌(𝑦) = 𝑃(𝑌 ≤ 𝑦) by integrating 𝑓(𝑋1, 𝑋2, … , 𝑋𝑛) over the region Y≤y.
Find the density function fY(y) by differentiating FY(y). That is,
𝑑
𝑓𝑌 𝑦 = 𝐹𝑌 𝑦 .
𝑑𝑦
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Part 3. Method of Transformation in One
Dimension
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Introduction
The transformation method for finding the probability distribution of a function
of a random variable is simply a generalization of the distribution function
method.
Consider a random variable X with the distribution function FX(x). Suppose that
Y is a function of X, say, Y=g(X) which is an increasing function with the
inverse X=g-1(Y)=h(Y). Then
We have
𝐹𝑌 𝑦 = 𝑃 𝑌 ≤ 𝑦 = 𝑃 𝑔 𝑋 ≤ 𝑦 = 𝑃 𝑋 ≤ ℎ 𝑦 = 𝐹𝑋[ℎ 𝑦 ]
Then the density function is
𝑑
𝑑
𝑓𝑌 𝑦 = 𝐹𝑌 𝑦 = 𝐹𝑋 ℎ 𝑦 = 𝑓𝑋 ℎ 𝑦 ∙ |ℎ′ 𝑦 |.
𝑑𝑦
𝑑𝑦
Similarly, we can have the same result for g(X) is a decreasing function.
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Theorem 7.1
Transformation of Random Variable. Let X be an absolute continuous random
variable with probability density function
> 0, 𝑥 ∈ 𝐴 = (𝑎, 𝑏)
𝑓𝑋 𝑥 =
0, 𝑥 ∈ 𝐴
Let 𝑌 = 𝑔(𝑋) with inverse function 𝑋 = ℎ(𝑌) such that h is a one-to-one,
continuous function from 𝐵 = (𝛼, 𝛽) onto A. If ℎ’(𝑦) exists and ℎ’(𝑦) ≠ 0 for all
y ∈ 𝐵. Then 𝑌 = 𝑔(𝑋) determines a new random variable with density
𝑓𝑋 ℎ 𝑦 |ℎ′ 𝑦 |, 𝑦 ∈ 𝐵 = (𝛼, 𝛽)
𝑓𝑌 𝑦 =
0, 𝑦 ∈ 𝐵
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Example 7.6
Let X have the probability density function given by
2𝑥,
0≤ 𝑥≤1
𝑓 𝑥 =
0,
𝑜𝑡ℎ𝑒𝑟𝑤𝑖𝑠𝑒
Find the density function for Y=-2X+5.
5−𝑌
Answer: Here 𝑌 = 𝑔(𝑋) = −2𝑋 + 5  the inverse function 𝑋 = ℎ 𝑌 = 2
where h is a continuous and one-to-one function from B=(3,5) onto A=(0,1).
So ℎ’(𝑦) = −1/2 for any y ∈ 𝐵 .
Then we can have
𝑓𝑌 𝑦 = 𝑓𝑋 ℎ 𝑦
ℎ′ 𝑦
=
2 5−𝑦
2
1
−2 =
5−𝑦
,
2
3 < 𝑦 < 5.
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Summary
Summary of the Univariate Transformation Method
Let Y be the function of the continuous random variables X, Y=g(X). Then
1. Write the probability density function of X.
2. Find the inverse function h such that X=h(Y). Verify that h is a continuous
one-to-tone function from B=(α, β) onto A=(a, b) where for 𝑥 ∈ 𝐴, 𝑓 𝑥 >
0.
𝑑
3. Verify ℎ 𝑦 = ℎ′(𝑦) exists, and is not zero for any 𝑦 ∈ 𝐵.
𝑑𝑦
4. Find 𝑓𝑌(𝑦) by calculating 𝑓𝑋 ℎ 𝑦 |ℎ′ 𝑦 |
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Part 4. Additional Examples
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Additional Example 1
Let X be a random variable having a continuous c.d.f., F(x). Let Y=F(X).
Show that Y has a uniform distribution on (0,1). Conversely, if U has a uniform
distribution on (0,1), show that X = F-1(U) has the c.d.f, F(x).
Answer: F(X) is non-decreasing and has domain 0<F(X)<1, that is, 0<Y<1.
Suppose F(x) has inverse function, ie., y=F(x)x=F-1(y).
Then FY(y)=P(Y ≤ y)=P[F(X) ≤ y]=P[X ≤F-1(y)]=F(F-1(y))=y  fY(y)=1, for 0<y<1.
FX(x)=P(X ≤x)=P(F-1(U) ≤x)=P(U ≤F(x))=F(x).
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Additional Example 2
Show that if U is uniform on (0,1), then X=-log(U) has an exponential
distribution Exp(1).
Answer: The density function for U is fU(u)=1.
X=-log(U) U=exp(-X), so h(x)=e-x,
which is continuous and one-to-one function with B=(0, ∞) as A=(0, 1).
The derivative of h(x) is h’(x)=-e-x which is not zero in the domain.
So we can have
fX(x) =fU[h(x)]|h’(x)|=(1)(|-e-x|)=e-x.
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL
Homework #10
Page
Page
Page
Page
275:
354:
362:
366:
5.138, 5.140
7.3, 7.4
7.6, 7.8
7.18, 7.20
Due Monday, 04/22/2013
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL