Transcript Chapter5-2

Chapter 5. Continuous Random
Variables
Uniform Random Variable
• X is a uniform random variable on the interval
(α, β) if its probability function is given by
 1
if   x  

f ( x)     

otherwise
0
0
 x  
F ( x)  
 
 1
x 
 x
x
2
• Ex 3a. Let X be uniformly distributed over (α, β). Find (a) E[X]
and (b) Var(X).

(a ) E[ X ]   xf ( x)dx




x
dx
 
 2  2

2(    )
 

2
• The expected value of a random variable uniformly distributed
over some interval is equal to the midpoint of that interval.
3
(b) To find Var( X ), we first calculate E[ X 2 ]

1 2
2
E[ X ]  
x dx
  
 3  3

3(    )

 2     2
3
 2     2 (   ) 2
Var ( X ) 

3
4
4
• Ex 3b. If X is uniformly distributed over (0, 10),
calculate the probability that (a) X < 3, (b) X > 6, and
(c) 3 < X < 8.
• f(x) = 1/10, 0 ≤ x ≤ 10.
3
(a ) P( X  3)   (1 / 10)dx  3 / 10
0
10
(b) P( X  6)   (1 / 10)dx  4 / 10
6
8
(c) P(3  X  8)   (1 / 10)dx  1 / 2
3
5
• Ex 3c. Buses arrive at a specified stop at 15-minute intervals
starting at 7AM. That is, they arrive at 7, 7:15, 7:30, 7:45, and
so on. If a passenger arrives at the stop at a time that is
uniformly distributed between 7 and 7:30, find the probability
that he waits
(a) less than 5 minutes for a bus;
(b) more than 10 minutes for a bus.
f(x) = 1/30, 0 ≤ x ≤ 30.
30 1
1
(a ) P(10  X  15)  P(25  X  30)  
dx  
dx  1 / 3
10 30
25 30
15
(b) P(0  X  5)  P(15  X  20)  
5
0
20 1
1
dx  
dx  1 / 3
15
30
30
6
Normal Random Variables
1
 ( x   )2 / 2 2
f ( x) 
e
2
• The distribution associated with Normal random
variable is called Normal distribution.
• It was first studied by French mathematician
Abraham DeMoivre.
• Carl Friedrich Gauss analyzed astronomical data
using Normal distribution and defined the equation of
its probability density function.
– The distribution is also called Gaussian distribution.
7
Importance of Normal Distribution
• Describes many random processes of continuous
phenomena
– Height of a man, velocity of a molecule in gas, error made
in measuring a physical quantity.
• Can be used to approximate discrete probability
distributions
– Example: binomial
• Basis for classical statistical inference
– Central limit theorem.
8
Normal Distribution
• ‘Bell-shaped & symmetrical
f(X)
• Random variable has
infinite range
• Mean measures the center
of the distribution
• Standard deviation
measures the spread of the
distribution
X
1
 ( x   )2 / 2 2
f ( x) 
e
2
 = Mean of random variable x
 = Standard deviation
 = 3.14159…
e = 2.71828…
9
Effect of Varying Parameters ( & )
f(X)
B
A
C
X
A:  = 3.7 =1
B:  = 3.7 =0.5
C:  = 5.3 =1
10
• If X is normally distributed with parameter μ and σ2,
then Y = aX + b is normally distributed with
parameters aμ + b and (aσ)2.
FY ( x)  P (Y  x)
 P(aX  b  x)
xb
 P( X 
)
a
xb
 FX (
)
a
1
xb
fX (
)
a
a
1
x b

exp[ (
  ) 2 / 2 2 ]
a
2 a
1

exp[ ( x  b  a ) 2 / 2(a ) 2 ]
2 a
1

exp[ ( x  (a  b)) 2 / 2(a ) 2 ]
2 a
fY ( x) 
11
Standard Normal
• Normal distribution with parameter (0, 1), N(0,1), is
also called standard normal.
1  x2 / 2
f ( x) 
e
2
• If X is N(μ, σ2), then Z = (X - μ)/σ is standard normal.
12
• Ex 4a. Find E[X] and Var[X] when X is a normal
random variable with parameters μ and σ2.
For standard normal, we have

E[ Z ]   xfZ ( x)dx

1   x2 / 2

xe
dx

2 
1  x2 / 2 

e
| 
2
0
13
Var ( Z )  E[ Z 2 ]
1  2  x2 / 2

xe
dx

2 
Integratio n by parts (u  x,dv  xe ) gives

1
 x2 / 2 
 x2 / 2
Var ( Z ) 
( xe
|    e
dx)

2
1   x2 / 2

e
dx

2 
1
-x 2 / 2
Integratio n by parts :

b
a
b
f ( x) g ( x)dx  [ f ( x) g ( x)] |   f ' ( x) g ( x)dx
'
b
a
a
14
Because X = μ + σZ,
E[X] = μ + σE[Z] = μ
Var(X) = σ2Var(Z) = σ2.
15
The cumulative distributi on function of a standard
normal random variable is denoted by Φ( x).
1 x  y2 / 2
 ( x) 
e
dy

2 
For negative values of x: ( x)  1  ( x) -   x  
For standard normal: P(Z ≤ -x) = P(Z > x)
For X ~ N(μ, σ)
FX (a )  P( X  a )  P(
X 


a

)  (
a

)
16
• Φ(x) can be
found from the
table for
standard
normal
distribution.
17
• Ex 4b. If X is a normal random variable with parameter μ = 3
and σ2 = 9, find (a) P(2 < X < 5); (b) P(X > 0); (c) P(|X-3| > 6).
(a )
P (2  X  5)  P (
23 X 3 53


)
3
3
3
1
2
 P(  Z  )
3
3
2
 1
      
3
 3
2 
 1 
    1   
3 
 3 
 .7486  (1  .6293)
 .3779
18
X 3 03
(b) P( X  0)  P(

)
3
3
 P( Z  1)
 1  (1)
 (1)  .8413
(c)
P(| X  3 | 6)  P( X  9)  P( X  3)
X 3 93
X 3 33

)  P(

)
3
3
3
3
 P( Z  2)  P( Z  2)
 1   (2)   (2)
 P(
 2[1   (2)]  .0456
19
• Ex 4c. An examination is often regarded as being
good if the test scores of those taking the examination
can be approximated by a normal density function.
• The instructor often uses the test scores to estimate
the normal parameters μ, and σ2 and then assign the
letter grade A to those whose test score is greater than
μ + σ, B to those whose score is between μ and μ + σ,
C to those whose score is between μ - σ and μ, D to
those whose score is between μ - 2σ and μ - σ, and F
to those getting a score below μ - 2σ. This is
sometimes referred to as grading “on the curve”.
20
P( X     )  P(
X 

 1)  1  (1)  .1587
P (   X     )  P (0 
X 

P(     X   )  P(1 
X 

P(   2  X     )  P(2 
P( X    2 )  P(
X 

 1)  (1)  (0)  .3413
 0)   (0)  (1)  .3413
X 

 1)  (2)  (1)  .1359
 2)  (2)  .0228
• Approximately 16 percent of the class will receive an
A grade on the examination, 34 percent a B grade, 34
percent a C grade, and 14 percent a D grade; 2
percent will fail.
21
• Ex 4e. Suppose that a binary message – either 0 or 1 must be
transmitted by wire from location A to location B. However,
the data sent over the wire are subject to a channel noise
disturbance, so to reduce the possibility of error, the value 2 is
sent over the wire when the message is 1 and the value -2 is
sent when the message is 0. If x, x = ±2, is the value sent at
location A, then R, the value received at location B is given by
R = x + N, where N is the channel noise disturbance. When the
message is received at location B the receiver decodes it
according to the following rule:
If R ≥ .5, then 1 is concluded
If R < .5, then 0 is concluded.
Assuming the channel noise is normally distributed, determine
the error probabilities when N is a standard normal random
variable.
22
• There are two types of errors: one is that the message
1 can be incorrectly concluded to be 0, and the other
that 0 is concluded to be 1. The first type of error will
occur if the message is 1 and 2 + N<.5, whereas the
second will occur if the message is 0 and -2 + N ≥ .5.
P(error | message is 1)  P( N  -1.5)  1 - (1.5)  .0668
P(error | message is 0)  P( N  2.5)  1 - (2.5)  .0062
23
Normal Approximation to the
Binomial Distribution
• When n is large, a binomial random variable with parameter n
and p will have approximately the same distribution as a
normal random variable with the same mean and variance.
24
• Ex 4f. Let X be the number of times that a fair coin, flipped 40
times, lands heads. Find the probability that X = 20. Use the
normal approximation and then compare it to the exact
solution.
• Since binomial is discrete and normal is continuous, we need
to apply a continuity correction
– we compute P(i-1/2 < X < i+1/2) instead of P(X = i).
P ( X  20)  P (19.5  X  20.5)
19.5  20 X  20 20.5  20
 P(


)
10
10
10
X  20
 P (.16 
 .16)
10
  (.16)   (.16)  .1272
Exact result using Binomial is :
 40  1 
P ( X  20)      .1254
 20  2 
40
25
• Ex 4g. The ideal size of a first-year class at a particular college
is 150 students. The college, knowing from past experience
that on the average only 30 percent of those accepted for
admission will actually attend, uses a policy of approving the
applications of 450 students. Compute the probability that
more than 150 first-year students attend this college.
 X  450(.3) 150.5  450(.3) 

P( X  150.5)  P

 450(.3)(.7)
450(.3)(.7) 

 1  (1.59)
 0.0559
26
• Ex 4h. To determine the effectiveness of a certain diet in
reducing the amount of cholesterol in the bloodstream, 100
people are put on the diet. After they have been on the diet for
a sufficient length of time, their cholesterol count will be
taken. The nutritionist running this experiment has decided to
endorse the diet if at least 65 percent of the people have a
lower cholesterol count after going on the diet. What is the
probability that the nutritionist endorses the new diet if, in fact,
it has no effect on the cholesterol level?
100  1 

 

i
i  65 
 2 
100
100
 P( X  64.5)
 X  (100)(1 / 2)


P
 2.9 
 100(1 / 2)(1 / 2)



 1   (2.9)
 .0019
27
Exponential Random Variables
• pdf of exponential random variable
e  x if x  0
f ( x)  
if x  0
0
• The distribution of the amount of time until
some specific event occurs.
– The amount of time until an earthquake occurs.
28
Exponential Distribution
29
Distributi on function :
F (a)  P( X  a)
a
  e x dx
0
 e x |0a
 1  e  a
• Ex 5a. Let X be an exponential random variable with
parameter λ. Calculate (a) E[X] and (b) Var(X).
30
e  x if x  0
f ( x)  
if x  0
0

E[ X n ]   x n e x dx
0
Integratin g by parts (dv  e x , u  x n ) yields
E[ X ]   x e
 0

n

n

|   nx n 1e x dx
n  x 
0
n


0
0
x n 1e x dx
Integratio n by parts :
b
 udvdx  uv | 
a
b
a
b
a
duvdx
E[ X n 1 ]
Letting n  1, and then n  2, gives
E[ X ]  1 / 
E[ X 2 ]  (2 /  ) E[ X ]  2 / 2
2
1
Var ( X )  2     1 / 2
 
2
31
• Ex 5b. Suppose that the length of a phone call in
minutes is an exponential random variable with
parameter λ = 1/10. If someone arrives immediately
ahead of you at a public telephone booth, find the
probability that you will have to wait
(a) more than 10 minutes;
(b) between 10 and 20 minutes.
(a ) P( X  10)  1  F (10)  1  (1  e 10(1/10) )  e 1
F (a)  1  e a
(b) P(10  X  20)  P( X  20)  P( X  10)
 F (20)  F (10)  e 1  e 2
32
Memory of A Random Variable
• We say a nonnegative random variable X is
memoryless if
P( X  s  t | X  t )  P( X  s)
for all s, t  0
P( X  s  t , X  t )
 P( X  s)
P( X  t )
or
P( X  s  t )  P( X  s) P( X  t )
Since e  ( s t )  e s e t , exponentia l random variables are memoryless .
33
• Ex 5c. Consider a post office that is staffed by two
clerks. Suppose that Ms. Jones is being served by one
of the clerks and Mr. Brown by the other. Suppose
also that Mr. Smith is told that his service will begin
as soon as either Jones or Brown leaves. If the
amount of time that a clerk spends with a customer is
exponentially distributed with parameter λ. what is
the probability that, of the three customers, Mr. Smith
is the last to leave the post office?
• Because exponential random variable is memoryless,
the probability of Mr. Smith is the last to leave the
post office is 1/2.
34
• Ex 5d. Suppose that the number of miles that a car can run
before its battery wears out is exponentially distributed with an
average value of 10,000 miles. If a person desires to take a
5000-mile trip, what is the probability that he or she will be
able to complete the trip without having to replace the battery?
What can be said when the distribution is not exponential?
The remaining lifetime of the battery is exponential with
parameter 1/10 (in thousands of miles).
P(remaining lifetime  5)  1  F (5)  e 5  e 1/ 2  .604
If the lifetime distributi on is not exponentia l,
P (lifetime  t  5, lifetime  t )
P (lifetime  t  5 | lifetime  t ) 
P (lifetime  t )
1  F (t  5)

1  F (t )
35
Gamma Distribution
 e  x (x) 1

f ( x)  
( )
 0
x0
x0

( )   e  y y  1dy
0
(n)  (n  1)!
• Gamma distribution is often used as the distribution
of the amount of time one has to wait until a total of n
events has occurred.
– A generalization of exponential distribution
36
Gamma Distribution
37
• Ex 6a. Let X be a gamma variable with parameters α and λ.
Calculate (a) E[X] and Var(X).
1  k  x
 1

x
e
(

x
)
dx

0
( )

1
 k
 e   x ( x)  k 1dx

 ( ) 0
(  k )
 k
 ( )
E[ X k ] 
E[ X ] 
E[ X 2 ] 
(  1) 

( ) 
(  2) (  1)

 2( )
2
Var ( X )  E[ X 2 ]  ( E[ X ]) 2 

2
38
Gamma Distribution – Special Cases
• When α = 1, the distribution reduce to exponential.
e x (x) 1
f ( x) 
 f ( x)  e x ,   1
( )
• When λ = 1, α = n/2, the distribution is also called
chi-square distribution with n degree of freedom.
– Model errors involved in attempting to hit a target in n
dimensional space when each coordinate error is normally
distributed.
– Comparison of categorical data.
39
Beta Distribution
 1
x a 1 (1  x) b 1 0  x  1

f ( x )   B ( a, b)
0
otherwise
(a )(b)
B ( a, b) 
 ( a  b)
• Used to model a random phenomenon whose set of
possible values is some finite interval [c, d] – which
can be transformed into the interval [0, 1].
• Frequently used in Bayesian inference.
40
Beta Distribution
41
Distribution of a Function of a Random
Variable
• Sometimes we would like to know the
distribution function of g(X) when the pdf of X
is known.
• Ex 7a. Let X be uniformly distributed over
(0,1). What is the distribution function of the
random variable Y, defined by Y = Xn?
42
• Distribution function
FY ( y )  P(Y  y )
 P( X n  y )
 P ( X  y1 / n )
 FX ( y )
1/ n
 y1 / n
0
 x  
F ( x)  
 
 1
x 
 x
x
• Probability density function
fY ( y)  (1 / n) y1/ n1 0  y  1
43
• Ex 7b. If X is a continuous random variable with
probability density fX, then the distribution of Y = X2
is:
FY ( y )  P(Y  y )
 P( X 2  y )
 P( y  X 
y)
 FX ( y )  FX ( y )
Differenti ation yields
1
fY ( y ) 
[ f X ( y )  f X ( y )]
2 y
44
Summary of Chapter 5
•
•
•
•
•
Continuous random variables
Expectation and expectation of function of random variables
Variance
Uniform random variable
Normal random variable
– Standard normal
• Other random variables
– Exponential
– Gamma
– Beta
• Distribution function of function of random variables
45