Download as ppt, pdf, or txt
Download as ppt, pdf, or txt
You are on page 1of 21

Chapter 3

Random Variables and Probability Distributions


 
3.1 Concept of a Random Variable:
·      In a statistical experiment, it is often very important to
allocate numerical values to the outcomes.
Example:
·      Experiment: testing two components. (D=defective,
N=non-defective)
·      Sample space: S={DD,DN,ND,NN}
·      Let X = number of defective components when two
components are tested.
·      Assigned numerical values to the outcomes are:
Sample point Assigned
(Outcome) Numerical Value (x)
DD 2
DN 1
ND 1
NN 0

Notice that, the set of all possible values of the random


variable X is {0, 1, 2}.
Definition 3.1:
A random variable X is a function that associates each element
in the sample space with a real number (i.e., X : S  R.)

Notation: " X " denotes the random variable .


" x " denotes a value of the random variable X.
Types of Random Variables:
·      A random variable X is called a discrete random
variable if its set of possible values is countable, i.e.,
.x  {x1, x2, …, xn} or x  {x1, x2, …}
·      A random variable X is called a continuous random
variable if it can take values on a continuous scale, i.e.,
.x  {x: a < x < b; a, b R}
      In most practical problems:
o      A discrete random variable represents count data, such
as the number of defectives in a sample of k items.
o      A continuous random variable represents measured
data, such as height.
3.2 Discrete Probability Distributions
·      A discrete random variable X assumes each of its values
with a certain probability.
Example:
·    Experiment: tossing a non-balance coin 2 times
independently.
·    H= head , T=tail
·    Sample space: S={HH, HT, TH, TT}
·    Suppose P(H)=½P(T)  P(H)=1/3 and P(T)=2/3
·    Let X= point
Sample number of headsProbability Value of X
(Outcome) (x)
HH P(HH)=P(H) P(H)=1/31/3 = 1/9 2

HT P(HT)=P(H) P(T)=1/32/3 = 2/9 1

TH P(TH)=P(T) P(H)=2/31/3 = 2/9 1


TT P(TT)=P(T) P(T)=2/32/3 = 4/9 0
·      The possible values of X are: 0, 1, and 2.
·      X is a discrete random variable.
·      Define the following events:
Event (X=x) Probability = P(X=x)
(X=0)={TT} P(X=0) = P(TT)=4/9
(X=1)={HT,TH} P(X=1) =P(HT)+P(TH)=2/9+2/9=4/9
(X=2)={HH} P(X=2) = P(HH)= 1/9

·      The possible values of X with their probabilities are:


X 0 1 2 Total
P(X=x)=f(x) 4/9 4/9 1/9 1.00

The function f(x)=P(X=x) is called the probability function


(probability distribution) of the discrete random variable X.
Definition 3.4:
The function f(x) is a probability function of a discrete random
variable X if, for each possible values x, we have:
1) f(x)  0
2)  f ( x)  1
all x
3) f(x)= P(X=x)
Note:
P(X  A )   f ( x )   P( X  x )
all xA all xA
Example:
For the previous example, we have:

X 0 1 2 Total
2
f(x)= P(X=x) 4/9 4/9 1/9  f ( x)  1
x0
P(X<1) = P(X=0)=4/9
P(X1) = P(X=0) + P(X=1) = 4/9+4/9 = 8/9
P(X0.5) = P(X=1) + P(X=2) = 4/9+1/9 = 5/9
P(X>8) = P() = 0
P(X<10) = P(X=0) + P(X=1) + P(X=2) = P(S) = 1
Example 3.3:
A shipment of 8 similar microcomputers
to a retail outlet contains 3 that are
defective and 5 are non-defective.
If a school makes a random purchase of 2
of these computers, find the probability
distribution of the number of defectives.
Solution:
We need to find the probability distribution of the random
variable: X = the number of defective computers purchased.
Experiment: selecting 2 computers at random out of 8
8 
n(S) =  2  equally likely outcomes
 
The possible values of X are: x=0, 1, 2.
Consider the events:
3 5 
(X  0)  {0D and 2N}  n(X  0)      
 0  2
 3  5 
(X  1)  {1D and 1N}  n(X  1)      
1  1 
3 5
(X  2)  {2D and 0N}  n(X  2)      
 2  0
3 5 
    
n (X  0)  0   2  10
f (0)  P(X  0)   
n (S) 8  28
 
 2
 3  5 
    
n (X  1) 1  1  15
f (1)  P(X  1)   
n (S) 8  28
 
 2
3  5
    
n (X  2)  2   0  3
f (2)  P(X  2)   
n (S) 8  28
 
 2
In general, for x=0,1, 2, we have:
3  5 
    
n (X  x )  x   2  x 
f ( x )  P(X  x )  
n (S) 8 
 
 2
The probability distribution of X is:

x 0 1 2 Total
10 15 3
f(x)= P(X=x) 1.00
28 28 28

 3   5 
     
  x   2  x  ; x  0, 1, 2
f ( x)  P( X  x)   8  Hypergeometric
   Distribution
  2
0 ; otherwise

Definition 3.5:
The cumulative distribution function (CDF), F(x), of a discrete
random variable X with the probability function f(x) is given by:
F(x)  P(X  x )  f ( t )   P(X  t ); for <x<
tx tx
Example:
Find the CDF of the random variable X with the probability
function:
X 0 1 2
10 15 3
F(x)
28 28 28
Solution:
F(x)=P(Xx) for <x<
For x<0: F(x)=0
10
For 0x<1: F(x)=P(X=0)=
28
10 15 25
For 1x<2: F(x)=P(X=0)+P(X=1)=  
28 28 28
10 15 3
For x2: F(x)=P(X=0)+P(X=1)+P(X=2)=   1
28 28 28
The CDF of the random variable X is:
 0 ; x0
10
 ; 0  x 1
 28
F ( x)  P( X  x)  
 25 ; 1  x  2
 28
1 ; x2

Note:
F(0.5) = P(X0.5)=0
25
F(1.5)=P(X1.5)=F(1) =
28
F(3.8) =P(X3.8)=F(2)= 1
Result:
P(a < X  b) = P(X  b)  P(X  a) = F(b)  F(a)
P(a  X  b) = P(a < X  b) + P(X=a) = F(b)  F(a) + f(a)
P(a < X < b) = P(a < X  b)  P(X=b) = F(b)  F(a)  f(b)
Result:
Suppose that the probability function of X is:
x x1 x2 x3 … xn

F(x) f(x1) f(x2) f(x3) … f(xn)

Where x1< x2< … < xn. Then:


F(xi) = f(x1) + f(x2) + … + f(xi) ; i=1, 2, …, n
F(xi) = F(xi 1 ) + f(xi) ; i=2, …, n
f(xi) = F(xi)  F(xi 1 )
Example:
In the previous example, 25 10 15
P(0.5 < X  1.5) = F(1.5)  F(0.5) =  
28 28 28
25 3
P(1 < X  2) = F(2)  F(1) = 1  
28 28
3.3. Continuous Probability Distributions

For any continuous random variable, X, there exists a non-


negative function f(x), called the probability density function
(p.d.f) through which we can find probabilities of events
expressed in term of X.
b
P(a < X < b) =  f(x) dx
a
= area under the curve
of f(x) and over the
interval (a,b)
 

P(XA) =  f(x) dx
A
= area under the curve
f: R  [0, ) of f(x) and over the
region A
Definition 3.6:
The function f(x) is a probability density function (pdf) for a
continuous random variable X, defined on the set of real
numbers, if:
1.    f(x)  0  x R

2. f(x) dx  1
b
-
3.     P(a  X  b) = f(x) dx  a, b R; ab
a
Note:
For a continuous random variable X, we have:
1.    f(x)  P(X=x) (in general)
2.    P(X=a) = 0 for any aR
3.    P(a  X  b)= P(a < X  b)= P(a  X < b)= P(a < X < b)

4.    P(XA)=f(x) dx
A
Total area   
 f x  dx  1 area  Pa  X  b 
b
  a f x dx

area  P X  b  area  P X  a 

  b f x  dx
a
   f x dx
Example 3.6:
Suppose that the error in the reaction temperature, in oC, for a
controlled laboratory experiment is a continuous random
variable X having the following probability density function:
1 2
 x ; 1 x  2
f ( x)   3
0 ; elsewhere

 f(x) dx  1
1.    Verify that (a) f(x)  0 and (b)
2.    Find P(0<X1) -
Solution:
X = the error in the reaction
temperature in oC.
X is continuous r. v.
1 2
 x ; 1 x  2
f ( x)   3
0 ; elsewhere
1. (a) f(x)  0 because f(x) is a quadratic function.
 1 2 
1 2
(b) - f(x) dx  - 0 dx  -1 3 x dx  2 0 dx
2
1 2 1 3 x  2 
  x dx   x 
-1
3  9 x  1
1
 (8  (1))  1
9
1 11
2
2. P(0<X1) =  f(x) dx   x dx
0 03
1 3 x  1 
 x 
 9 x  0 
1
 (1  (0))
9
1

9
Definition 3.7:
The cumulative distribution function (CDF), F(x), of a continuous
random variable X with probability density function f(x) is given
by: x

F(x) = P(Xx)=  f(t) dt; for <x<


-

Result:
P(a < X  b) = P(X  b)  P(X  a) = F(b)  F(a)

Example:
in Example 3.6,
1.Find the CDF
2.Using the CDF, find P(0<X1).
Solution:
1 2
 x ; 1 x  2
f ( x)   3
0 ; elsewhere

For x< 1:


x x
F(x) =  f(t) dt   0 dt  0
- -
For 1x<2:
x 1 x1
2
F(x) =  f(t) dt   0 dt   t dt
- - -13
x
1 2
  t dt
-1
3
1 3 t  x  1 3 1 3
 t   ( x  ( 1))  ( x  1)
9 t  1 9 9
For x2:
x 1 2 x
1 2 2
1
F(x) =  f(t) dt   0 dt   t dt   0 dt =  t 2 dt  1
- - -1
3 2 3
-1
Therefore, the CDF is:
 0 ; x  1
 1
F ( x)  P( X  x)   ( x 3  1) ;  1  x  2
9
 1 ; x  2

2. Using the CDF,


2 1 1
P(0<X1) = F(1)  F(0) =  
9 9 9

You might also like