Chapter III Random Variables
Chapter III Random Variables
[email protected]
Outline
• Definition of random variables
• Discrete Random Variables
• Continuous Random Variables
• The Expectation of a Random Variable
• The Variance of a Random Variable
• Jointly Distributed Random Variables
• Combinations and Functions of Random
Variables
Definition of random variables
-3 -2 -1 0 1 2 3
Definition of a Random Variable
• Example 1 : Machine Breakdowns
– Sample space : S {electrical , mechanical , misuse}
– Each of these failures may be associated with a
repair cost
– State space : {50, 200,350}
– Cost is a random variable : 50, 200, and 350
Concept of Random Variables
• 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:
6
Notice that, the set of all possible values of the
random variable X is {0, 1, 2}.
7
Random Variables
• A function that maps outcomes of random experiments
to numbers.
16
X denotes the random variable defined as the sum of two fair dice
P{X=2} = P{(1,1)} = 1/36
P{X=3} = P{(1,2), (2,1)}= 2/36
P{X=4} = P{(1,3), (2,2) ,(3,1)}= 3/36
P{X=5} = P{(1,4), (2,3) ,(3,2), (4,1)}= 4/36
P{X=6} = P{(1,5), (2,4) ,(3,3), (4,2),(5,1)}= 5/36
P{X=7} = P{(1,6), (2,5) ,(3,4), (4,3), (5,2),(6,1)} = 6/36
P{X=8} = P{(2,6), (3,5) ,(4,4), (5,3), (6,2)} = 5/36
P{X=9} = P{(3,6), (4,5) ,(5,4), (6,3)} = 4/36
P{X=10} = P{(4,6), (5,5) ,(6,4)} = 3/36
P{X=11} = P{(5,6), (6,5) } = 2/36
P{X=12} = P{(6,6)} = 1/36
17
• In other words, the random variable X can take on
any integral value between 2 and 12. The sum of the
probabilities is 1.
• Suppose that X can only assume the values x1,
x2, ... xn. Then
P( X x ) 1
i 1
i
18
Example
19
Solution:
• We need to find the probability distribution of
the random variable:
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
21
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
22
3 5
n (X 2) 2 0 3
f (2) P(X 2)
n (S) 8 28
2
3 5
n (X x ) x 2 x
f ( x ) P( X x )
n (S) 8
2 23
• 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
2
0 ; otherwise
24
Data Types
Data
Discrete Continuous
25
Types of Random Variables
• Discrete Random Variable
– x {x1, x2, …, xn} or x {x1, x2, …}
– Whole Number (0, 1, 2, 3 etc.)
– Countable, Finite Number of Values or infinite number
• Jump from one value to the next and cannot take any
values in between.
27
Probability Distribution
4. 0 p(x) 1
P(X A ) f ( x ) P(X x )
all xA all xA
5. p(x) = 1
29
Probability Mass Function
• Probability Mass Function (p.m.f.)
– A set of probability value p assigned to each of
i
– 0 pi 1 and i pi 1
– Probability : P ( X xi ) pi
Probability Mass Function
• Example 1 : Machine Breakdowns
– P (cost=50)=0.3, P (cost=200)=0.2,
P (cost=350)=0.5
xi 50 200 350
– 0.3 + 0.2 + 0.5 =1
f ( x) pi 0.3 0.2 0.5
0.5
0.3
0.2
– Abbreviation : c.d.f
F ( x)
1.0
0.5
0.3
x 50 F ( x) P(cost x) 0
50 x 200 F ( x) P(cost x) 0.3
200 x 350 F ( x) P(cost x) 0.3 0.2 0.5
350 x F ( x) P(cost x) 0.3 0.2 0.5 1.0
Exercise
A basketball player shoots three free throws. He
typically makes a basket exactly 60% of the time. The
random variable X is the number of baskets successfully
made.
What is the probability that the player
49.5 50.5 x
Probability Density Function
• This is a valid p.d.f.
50.5
(1.5 6( x 50.0) )dx [1.5 x 2( x 50.0) ]
2 3 50.5
49.5
49.5
dF ( x)
f ( x)
dx
P ( a X b) P ( X b) P ( X a )
F (b) F (a)
P ( a X b) P ( a X b )
Probability Density Function
• Example
x
F ( x) P( X x) (1.5 6( y 50.0) 2 ) dy
49.5
P( X 50.0) 0.5
F ( x)
P( X 49.7) 0.104
E( X ) px
i
i i
• The expected value of a random variable is also called the mean of the
random variable
Expectations of Discrete Random Variables
• Symmetric Random f ( x) E( X )
Variables
– If x has a p.d.f f ( x)that is
symmetric about a point
so that
f ( x) f ( x)
x
– Then, (why?)
E( X )
– Then, E( X ) (why?)
y 2 x
-
xf ( x ) dx +
-
yf ( y ) dy
Medians of Random Variables
• Median
– Information about the “middle” value of the
random variable F ( x) 0.5
• Example 14
F ( x) 1.5 x 2( x 50.0)3 74.5 0.5
x 50.0
The variance of a Random Variable
1 Definition and Interpretation of Variance (1/2)
2
• Variance( )
– A positive quantity that measures the spread of the distribution
of the random variable about its mean value
– Larger values of the variance indicate that the distribution is
more spread out
Var( X ) E (( X E ( X )) 2 )
– Definition: E ( X 2 ) ( E ( X )) 2
• Standard Deviation
– The positive square root of the variance
Definition and Interpretation of Variance
(2/2)
Var( X ) E (( X E ( X )) 2 )
E ( X 2 2 XE ( X ) ( E ( X )) 2 )
E ( X 2 ) 2 E ( X ) E ( X ) ( E ( X )) 2
E ( X 2 ) ( E ( X )) 2
f ( x)
Two distribution with
identical mean values
but different variances
x
Examples of Variance Calculations (1/1)
• Example 1
Var( X ) E (( X E ( X )) 2 ) pi ( xi E ( X )) 2
i
17,100 130.77
Exercise
• A basketball player shoots three free throws. The
random variable X is the number of baskets
successfully made. Calculate mean, variance &
standard deviation
Value of 0 1 2 3
x
Probabili 0.064 0.288 0.432 0.216
ty
Answer
• µX = 1.8.
• The variance σ2 of X is
• σ2 = 0.064*(0−1.8)2 + 0.288*(1−1.8)2 + 0.432*(2−1.8)2 +
0.216*(3−1.8)2
• = 0.20736 + 0.18432 + 0.01728 + 0.31104
• = 0.72 Take the square root to get SD:
• SD = 0.85
Example
• Linda is a sales associate at a large auto dealership. At her
commission rate of 25% of gross profit on each vehicle she sells,
Linda expects to earn $350 for each car sold and $400 for each truck
or SUV sold. Linda motivates herself by using probability estimates of
her sales. For a sunny Saturday in April, she estimates her car sales as
follows:
Cars Sold 0 1 2 3
Trucks Sold 0 1 2 3
Prob 0.4 0.5 0.1 0
Trucks Sold 0 1 2 3
Prob 0.4 0.5 0.1 0
Recall how with certain probability questions you have to ask yourself “disjoint or non-disjoint” or “independent or non-
indepndent”. Similarly, when calculating an expected value, the very first question you must ask yourself is “discrete or
non-discrete” since the method of determining the mean is completely different for each.
Because the type of variable we are discussing (# cars/trucks sold) is discrete, we will use the formula for
calculating the mean of discrete data that was described earlier:
If she gets $350 per car, and $400 per truck, Linda would expect to make: $350*1.1 + $400*0.7 = $665
3. Chebyshev’s Inequality (1/1)
(theorem )
Assume that mean and variance are
given.
Better estimate of probability of
events of interest using Chebyshev
inequality:
Uses of Chebyshev’s Formula:
• Chebyshev’s inequality can be used to obtain
upper bounds on the variance of a random
variable.
• The inequality can also be used to prove the
weak law of large numbers. The weak law of
large numbers tells us that if we draw samples
of increasing size from a population then the
sample mean tends towards the population
mean.
• As seen above the Chebyshev Formula gives us
results similar to the empirical rule. It tells us what
percentage of the data lies within certain distance
from the mean.
• The difference is that the empirical rule is only
applicable to normal distributions whereas the
Chebyshev formula is applicable for every
distribution. Since the empirical rule applies only to
a specific case it is much more sharper and
accurate when compared to Chebyshevs inequality.
Chebyshev’s Inequality (2/1)
• Proof: Apply Markov inequality to
non-negative r.v. (X- )2 and
number t2 to obtain
I(X ) 0
P( X t ) t0
E[ X ] t
Theorem Chebyshev's Inequality
Alternate form
E[ X ] X
2
V[X ] X
2
P X X t X
2
t
63
I(X ) 0
P( X t ) t0
E[ X ] t
Theorem Chebyshev's Inequality
2
P X X t X
2
t
Because
E X X
2
P X X t P X X
t2
2
t 2
64
2
P X X t X
2
t
Chebyshev inequality: Alternate forms
65
Theorem Chebyshev's Inequality
2
P X X t X
2
1 t
P X X k X 2
k
1
P X X k X 1 2
k
0.934
0.889
0.75
0
X X X X X X X X
X 66
2
X ~ N ( , P ) X X t
2 X
Theorem Chebyshev's Inequality t 2
1
Facts: P X X k X 2
k
1
P X X k X 1 2
k
0.934
0.889
0.75
0
X X X X X X X X
X 67
Example
68
1
P X X k X 2
Aside “just” Markov:
P( X t ) k
t
70
P ( X 84) 0.8
84
60 X 84 P X X 4 X 1/16
6 X 24 4 1000 161 62.5 70
69
Jointly Distributed Random Variables
Jointly Distributed Random Variables (1/4)
• Joint Probability Distributions
– Discrete
P ( X xi , Y y j ) pij 0
satisfying p
i j
ij 1
– Continuous
f ( x, y ) 0 satisfying
state space
f ( x, y ) dxdx 1
Jointly Distributed Random Variables (2/4)
– DiscreteF ( x, y )
i: xi x j: y j y
pij
– Continuous x y
F ( x, y ) f ( w, z )dzdw
w z
Jointly Distributed Random Variables (3/4)
Y=
X=service time • Joint p.m.f
number p 0.12 0.18
ij
of units i j
1 2 3 4
0.07 1.00
• Joint cumulative
3 0.01 0.01 0.02 0.07
distribution
function
Examples
• The joint distribution of p(x, y) of X (number of
cars) and Y (the number of buses) per signal
cycle at a traffic signal is given by
Y
0 1 2
0 0.025 0.015 0.010
X 1 0.050 0.030 0.020
2 0.125 0.075 0.050
3 0.15 0.090 0.060
4 0.1 0.060 0.04
5 0.05 0.030 0.02
Examples
• (a) Find P(X = Y).
• (b) Find the marginal distribution of X and Y.
• (c) Suppose a bus occupies three vehicle spaces and
a car occupies just one. What is the mean number of
vehicle spaces occupied during a signal cycles? That
is, find the mean or expected value of h(X, Y) = X +
3Y
• Solution: (
a) The number of cars equals the number of buses if X
= Y. Hence, P(X = Y) = p(0, 0) + p(1, 1) + p(2, 2) = .025
+ .030 + .050 = .105. That is, about 10.5% of the time.
• (b) Adding the row values yields the marginal
distribution of the x values:
x 0 1 2 3 4 5
P(X) 0.05 0.1 0.25 0.3 0.2 0.1
= 0.5*0+ 0.3*1+0.2*2=0.7
(c) Let X and Y denote the number of cars and
buses at a signal cycle. Then the number of vehicle
spaces occupied is h(X, Y) = X + 3Y. Hence, the
mean number of spaces occupied is then E(h(X, Y))
= E(X + 3Y) is
µh(x,y) = ΣΣ (x + 3y)p(x, y)
= [0 + 3(0)](.025) + [0 + 3(1)](.015) + ... + [5 +
3(2)](.020) = 4.90.
Example
P ( X i ) pi pij
j
– Continuous
f X ( x) f ( x, y )dy
Marginal Probability Distributions (2/2)
• Example 19
– Marginal p.m.f of X
3
P ( X 1) p1 j 0.12 0.08 0.01 0.21
j 1
– Marginal p.m.f of Y
4
P (Y 1) pi1 0.12 0.08 0.07 0.05 0.32
i 1
• Example 20: (a jointly continuous case)
• Joint pdf:
f ( x, y )
• Marginal pdf’s of X and Y:
f X ( x) f ( x, y )dy
fY ( y ) f ( x, y )dx
Conditional Probability Distributions (1/2)
• Conditional probability distributions
– The probabilistic properties of the random variable X under the
knowledge provided by the value of Y
– Discrete
P( X i, Y j ) pij
pi| j P ( X i | Y j )
P(Y j ) p j
– Continuous
f ( x, y )
f X |Y y ( x )
fY ( y )
• Example 19
– Marginal probability distribution of Y
P (Y 3) p3 0.01 0.01 0.02 0.07 0.11
p13 0.01
p1|Y 3 P ( X 1| Y 3) 0.091
p3 0.11
– Conditional distribution of X
Independence and Covariance (1/5)
• Two random variables X and Y are said to be independent if
– Discrete
• Correlation:
Cov( X , Y )
Corr( X , Y )
Var( X )Var(Y )
Cov( X , Y )
Corr( X , Y )
Var( X )Var(Y )
0.224
0.34
1.162 0.384
• What if random variable X and Y have linear relationship, that is,
Y aX b
where a0
Cov( X , Y ) E[ XY ] E[ X ]E[Y ]
E[ X (aX b)] E[ X ]E[aX b]
aE[ X 2 ] bE[ X ] aE 2 [ X ] bE[ X ]
a ( E[ X 2 ] E 2 [ X ]) aVar ( X )
Cov( X , Y ) aVar ( X )
Corr ( X , Y )
Var ( X )Var (Y ) Var ( X )a 2Var ( X )
That is, Corr(X,Y)=1 if a>0; -1 if a<0.
Combinations and Functions of Random Variables
• Standardization
-If a random variable has an
X expectation of
and a variance of ,
2 Y X 1 X
has an expectation of zero and a variance of one.
Linear Functions of Random Variables (2/4)
Y 112 10.58
Linear Functions of Random Variables (4/4)
Var( X
and
1 X 2 ) Var( X 1 ) Var( X 2 ) 2Cov( X 1 , X 2 )
X1 X2 Cov( X 1 , X 2 ) 0
– If and are independent, so that
thenVar( X 1 X 2 ) Var( X 1 ) Var( X 2 )
• Properties of Cov( X 1 , X 2 )
Cov( X 1 , X 2 ) E[ X 1 X 2 ] E[ X 1 ]E[ X 2 ]
Cov( X 1 , X 2 ) Cov( X 2 , X 1 )
Cov( X 1 , X 1 ) Var ( X 1 ) Cov( X 2 , X 2 ) Var ( X 2 )
Cov( X 1 X 2 , X 1 ) Cov( X 1 , X 1 ) Cov( X 2 , X 1 )
Cov( X 1 X 2 , X 1 X 2 ) Cov( X 1 , X 1 ) Cov ( X 1 , X 2 )
Cov( X 2 , X 1 ) Cov( X 2 , X 2 )
– Let X1 X n
X
n
– Then E( X )
and 2
Var( X )
n
2 2
1 1 1 1
Var( X ) Var X 1 X n Var( X 1 ) Var( X n )
n n n n
2 2
2
1 2 1 2
n n n
Linear Combinations of Random Variables
(4/5)
• Example 21
– The standardized scores of the two tests are
10 5 50
Y1 X1 and Y2 X2
3 3 3