Vous êtes sur la page 1sur 27

Section 7.

1: Continuous Random Variables


Discrete-Event Simulation: A First Course
c 2006 Pearson Ed., Inc. 0-13-142917-5

Discrete-Event Simulation: A First Course

Section 7.1: Continuous Random Variables

1/ 27

Section 7.1: Continuous Random Variables

A random variable X is continuous if and only if its set of possible values X is a continuum A continuous random variable X is uniquely determined by
Its set of possible values X Its probability density function (pdf): A real-valued function f () dened for each x X
b a

f (x )dx = Pr(a X b )

By denition, f (x )dx = 1
X

Discrete-Event Simulation: A First Course

Section 7.1: Continuous Random Variables

2/ 27

Example 7.1.1

X is Uniform(a, b ) X = (a, b ) and all values in this interval are equally likely f (x ) = In the continuous case,
Pr(X = x ) = 0 for any x X If [a, b ] X ,
b

1 ba

a<x <b

f (x )dx
a

= Pr(a X b ) = Pr(a < X b ) = Pr(a X < b ) = Pr(a < X < b )

Discrete-Event Simulation: A First Course

Section 7.1: Continuous Random Variables

3/ 27

Cumulative Distribution Function


The cumulative distribution function(cdf) of the continuous random variable X is the real-valued function F () for each x X as f (t )dt F (x ) = Pr(X x ) =
t x

Example 7.1.2: If X is Uniform(a, b ), the cdf is


x

F (x ) =
t =a

x a 1 dt = (b a) ba

a<x <b

In special case where U is Uniform(0, 1), the cdf is F (u ) = Pr(U u ) = u 0u1

Discrete-Event Simulation: A First Course

Section 7.1: Continuous Random Variables

4/ 27

Relationship between pdfs and cdfs

1.0 F (x) =
. . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ........... . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . tx . . . . . . . . . . . .. . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . .. . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . .

f (t) dt .........................

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

f (x0 )

F (x) F (x0 ) x 0.0

f (x)

x0

x0

Shaded area in pdf graph equals F (x0 )

Discrete-Event Simulation: A First Course

Section 7.1: Continuous Random Variables

5/ 27

More on cdfs

The cdf is strictly monotone increasing: if x1 < x2 , then F (x1 ) < F (x2 ) The cdf is bounded between 0.0 and 1.0 The cdf can be obtained from the pdf by integration The pdf can be obtained from the cdf by dierentiation as f (x ) = d F (x ) dx x X

A continuous random variable model can be specied by X and either the pdf or the cdf

Discrete-Event Simulation: A First Course

Section 7.1: Continuous Random Variables

6/ 27

Example 7.1.3: Exponential()

X = ln(1 U ) where U is Uniform(0, 1) The cdf of X is F (x ) = Pr(X x ) = Pr( ln(1 U ) x )

= 1 exp(x /) The pdf of X is f (x ) =

= Pr(U 1 exp(x /))

= Pr(1 U exp(x /))

d d 1 F (x ) = (1 exp(x /)) = exp(x /) dx dx

x >0

Discrete-Event Simulation: A First Course

Section 7.1: Continuous Random Variables

7/ 27

Mean and Standard Deviation

The mean of the continuous random variable X is =


x

xf (x )dx

The corresponding standard deviation is =


x

(x )2 f (x )dx

or

=
x

x 2 f (x )dx

The variance is 2

Discrete-Event Simulation: A First Course

Section 7.1: Continuous Random Variables

8/ 27

Examples

If X is Uniform(a, b ) = a+b 2 and ba = 12

If X is Exponential(),

xf (x )dx =
x 0

x exp(x /)dx = x2 exp(x /)dx

t exp(t )dt = =

2 =
0

2 = = 2

Discrete-Event Simulation: A First Course

Section 7.1: Continuous Random Variables

9/ 27

Expected Value
The mean of a continuous random variable is also known as the expected value The expected value of the continuous random variable X is = E [X ] =
x

xf (x )dx

The variance is the expected value of (X )2 2 = E [(X )2 ] =


x

(x )2 f (x )dx

In general, if Y = g (X ), the expected value of Y is E [Y ] = E [g (X )] =


x

g (x )f (x )dx

Discrete-Event Simulation: A First Course

Section 7.1: Continuous Random Variables

10/ 27

Example 7.1.6
A circle of radius r and a xed point Q on the circumference P is selected at random on the circumference Let the random variable Y be the distance of the line segment joining P and Q
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . .. . . P... . . . . . . . . . . . . . . . . . . . . . .

Q Y = 2r sin(/2)

Discrete-Event Simulation: A First Course

Section 7.1: Continuous Random Variables

11/ 27

Example 7.1.6 ctd.

If is Uniform(0, 2 ), the pdf of is f ( ) = 1/2 The expected length of Y is


2 2

E [Y ] =
0

2r sin(/2)f ( )d =
0

2r sin(/2) 4r d = = 2

Y is not Uniform(0, 2r ); otherwise, E [Y ] would be r . Example 7.1.7 If continuous random variable Y = aX + b for constants a and b , E [Y ] = E [aX + b ] = aE [X ] + b

Discrete-Event Simulation: A First Course

Section 7.1: Continuous Random Variables

12/ 27

Continuous Random Variable Models


Standard Normal Random Variable Z is Normal(0, 1) if and only if the set of all possible values is Z = (, ) and the pdf is 1 f (z ) = exp(z 2 /2) 2
0.4 f (z ) 0.2

<z <

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

Discrete-Event Simulation: A First Course

Section 7.1: Continuous Random Variables

13/ 27

Standard Normal Random Variable


If Z is Normal(0, 1), Z is standardized The mean is = 1 zf (z )dz = 2

z exp(z 2 /2)dz = = 0

The variance is 2 = 1 (z )2 f (z )dz = 2


z 2 exp(z 2 /2)dz = = 1

The cdf is
z

F (z ) =

f (t )dt = (z )

<z <

Discrete-Event Simulation: A First Course

Section 7.1: Continuous Random Variables

14/ 27

Standard Normal cdf


() is dened as 1 (z ) = 2
z

exp(t 2 /2)dt

<z <

No closed-form expression for (z ) 1 + P (1/2, z 2 /2) 2 (z ) = 1 (z ) Function (z ) is available in rvms as cdfNormal(0.0, 1.0, z)

z 0 z <0

P (a, x ) is an incomplete gamma function (see Appendix D)

Discrete-Event Simulation: A First Course

Section 7.1: Continuous Random Variables

15/ 27

Scaling and Shifting

Suppose X is a random variable with mean and standard deviation Dene random variable X = aX + b for constants a, b The mean and standard deviation of X are = E [X ] = E [aX + b ] = aE [X ] + b = a + b ( )2 = E [(X )2 ] = E [(aX a)2 ] = a2 E [(X )2 ] = a2 2 Therefore, = a + b and = |a|

Discrete-Event Simulation: A First Course

Section 7.1: Continuous Random Variables

16/ 27

Example 7.1.8

Suppose Z is a random variable with mean 0 and standard deviation 1 Construct a new random variable X with specied mean and standard deviation Dene X = Z + E [X ] = E [Z ] + = E [(X )2 ] = E [ 2 Z 2 ] = 2 E [Z 2 ] = 2

Discrete-Event Simulation: A First Course

Section 7.1: Continuous Random Variables

17/ 27

Normal Random Variable

The continuous random variable X is Normal(, ) if and only if X = Z + where > 0 and Z is Normal(0, 1) The mean of X is and the standard deviation is Normal(, ) is constructed from Normal(0, 1)
by shifting the mean from 0 to via the addition of by scaling the standard deviation from 1 to via multiplication by

Discrete-Event Simulation: A First Course

Section 7.1: Continuous Random Variables

18/ 27

cdf of Normal Random Variable

The cdf of a Normal(, ) F (x ) = Pr(X x ) = Pr( Z + x ) = Pr(Z (x )/ ) so that F (x ) = x <x <

where () is the cdf of Normal(0, 1)

Discrete-Event Simulation: A First Course

Section 7.1: Continuous Random Variables

19/ 27

pdf of Normal Random Variable


Because d 1 (z ) = exp(z 2 /2) dz 2 the pdf of Normal(, ) is f (x ) = d dF (x ) = dx dx x 1 = = exp((x )2 /2 2 ) 2 <z <

f (x)

. . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

3 2
Discrete-Event Simulation: A First Course

+ + 2 + 3
20/ 27

Section 7.1: Continuous Random Variables

Some Properties of Normal Random Variables

Sums of iid random variables approach the normal distribution Normal(, ) is sometimes called a Gaussian random variable The 68-95-99.73 rule
Area under pdf between and + is about 0.68 Area under pdf between 2 and + 2 is about 0.95 Area under pdf between 3 and + 3 is about 0.9973

The pdf has inection points at

Common notation for Normal(, ) is N (, 2 ) Support is X = {x | x }

Usually not appropriate for simulation unless modied to produce only positive values

Discrete-Event Simulation: A First Course

Section 7.1: Continuous Random Variables

21/ 27

Lognormal Random Variable

The continuous random variable X is Lognormal(a, b ) if and only if X = exp(a + bZ ) where Z is Normal(0, 1) and b > 0 Lognormal(a, b ) is also based on transforming Normal(0, 1)
The transformation is non-linear

Discrete-Event Simulation: A First Course

Section 7.1: Continuous Random Variables

22/ 27

cdf of Lognormal Random Variable

The cdf of a Lognormal(a, b ) F (x ) = Pr(X x )

= Pr(exp(a + bZ ) x ) = Pr(a + bZ ln(x ))

x >0

so that F (x ) = Pr(Z (ln(x ) a)/b ) = where () is the cdf of Normal(0, 1) ln(x ) a b x >0

Discrete-Event Simulation: A First Course

Section 7.1: Continuous Random Variables

23/ 27

pdf of Lognormal Random Variable


The pdf of Lognormal(a, b ) is f (x ) = 1 dF (x ) = = exp((ln(x )a)2 /2b 2 ) dx bx 2
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

x >0

f (x)

(a, b ) = (0.5, 1.0)

= exp(a + b 2 /2) = exp(a + b 2 /2) exp(b 2 ) 1

Above, = 1.0 Above, 1.31


24/ 27

Discrete-Event Simulation: A First Course

Section 7.1: Continuous Random Variables

Erlang Random Variable

Uniform(a, b ) is the continuous analog of Equilikely(a, b ) Exponential() is the continuous analog of Geometric(p ) Pascal(n, p ) is the sum of n iid Geometric(p ) What is the continuous analog of Pascal(n, p )? The continuous random variable X is Erlang(n, b ) if and only if X = X1 + X2 + + Xn where X1 , X2 , , Xn are iid Exponential(b ) random variables

Discrete-Event Simulation: A First Course

Section 7.1: Continuous Random Variables

25/ 27

pdf of Erlang Random Variable


The pdf of Erlang(n, b ) is f (x ) = 1 (x /b )n1 exp(x /b ) b (n 1)! x >0

f (x)

. . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . .. . . . . . .. .. ..... . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

(n, b ) = (3, 1.0)


x

For (n, b ) = (3, 1.0), = 3.0 and 1.732

Discrete-Event Simulation: A First Course

Section 7.1: Continuous Random Variables

26/ 27

cdf of Erlang Random Variable

The corresponding cdf is


x

F (x ) =
0

f (t )dt = P (n, x /b )

x >0

Incomplete gamma function (see Appendix D) = nb = nb Chisquare And Student Random Variables Chisquare(n) and Student(n) are commonly used for statistical inference Dened in section 7.2

Discrete-Event Simulation: A First Course

Section 7.1: Continuous Random Variables

27/ 27

Vous aimerez peut-être aussi