Random Variables •A random variable is a numerical measure of the outcome from a probability experiment, so its value is determined by chance. Random variables are denoted X, Y, Z etc. •A discrete random variable is a random variable that has either a finite number of possible values or a countable number of possible values. •A continuous random variable is a random variable that has an infinite number of possible values that is not countable.
Example • Discrete random variable with a finite number of values Let X = number of TV sets sold at the store in one day where x can take on 5 values (0, 1, 2, 3, 4) • Discrete random variable with an infinite sequence of values Let X = number of customers arriving in one day where x can take on the values 0, 1, 2, . . . We can count the customers arriving, but there is no finite upper limit on the number that might arrive. • The waiting time of a customer in a queueContinuous.
• We use capital letter , like X, to denote the random variable and use small letter to list the possible values of the random variable. • Example. A single die is cast, X represent the number of pips showing on the die and the possible values of X are x=1,2,3,4,5,6. A probability distribution provides the possible values of the random variable and their corresponding probabilities. A probability distribution can be in the form of a table, graph or mathematical formula.
The table below shows the probability distribution for the random variable X, where X represents the number of DVDs a person rents from a video store during a single visit.
Probability Distributions for Discrete Random Variables (Probability Mass Function (PMF)). • The probability distribution is defined by a probability function, denoted by p(x), which provides the probability for each value of the random variable. • The probability distribution for discrete random variable is called Probability Mass Function (PMF).
p (x i ) = P (X = x i
)
Properties for Discrete Random Variables • The properties for a discrete probability function (PMF) are: p( x) = P ( X = x)
0 £ p( x) £ 1
å
"x
p( x) = 1
all x
• Cumulative Distribution Function (CDF) F ( x) = P ( X £ x)
F (b ) = P ( X £ b ) =
b
å p( x)
y = -¥
F ( -¥ ) = 0
F (¥ ) = 1
Example n
Using past data on TV sales (below left), a tabular representation of the probability distribution for TV sales (below right) was developed.
Units Sold 0 1 2 3 4
Number of Days 80 50 40 10 20 200
X 0 1 2 3 4
p(x) .40 .25 .20 .05 .10 1.00
• Graphical Representation of the Probability Distribution .50 p(x)
.40
.30 .20 .10 0 1 2 3 4 Values of Random Variable X (TV sales)
Example • Random Variable: Grades of the students Student ID
1
2
3
4
5
6
7
8
9
10
Grade
3
2
3
1
2
3
1
3
2
2
Probability Mass Function p (1) = P ( X =
p ( 2) = P ( X =
p ( 3) = P ( X =
PMF
2 1=) = 0.2 10
2=)
3=)
4 = 10
4 = 10
0.4
0.4
Grade
Example • Random Variable: Grades of the students Student ID
1
2
3
4
5
6
7
8
9
10
Grade
3
2
3
1
2
3
1
3
2
2
Probability Mass Function
å p (x
i
CDF
) = p (1) + p ( 2 ) + p ( 3) = 1
i
Cumulative Distribution Function p (X £ x ) = åx
i
£x
p (x i )
p ( X £ 2 ) =å x = p (x i ) £2
p ( X £ 3)
i
å=
x i £2
p (1) + p ( 2=) 0.2 + 0.4 = 0.6
p (=x i )
p (1) + p ( 2 ) + p ( 3 ) = 1
Grade
Example
• Toss a fair coin three times and define X = number of heads. x HHH
1/8
3
HHT
1/8
2
HTH
1/8
2
THH
1/8
2
HTT
1/8
1
THT
1/8
1
TTH
1/8
1
TTT
1/8
0
P(X = 0) = P(X = 1) = P(X = 2) = P(X = 3) =
1/8 3/8 3/8 1/8
X 0 1 2 3
p(x) 1/8 3/8 3/8 1/8
Probability Histogram for x
Expected Value and Variance • The expected value, or mean, of a random variable is a measure of its central location. – Expected value of a discrete random variable:
E (X ) = m =
n
å x p (x ) i
1 =1
i
• The variance summarizes the variability in the values of a random variable. – Variance of a discrete random variable: Var ( X
)=s
E= ( X - m
2
)
n
2 ( ) . p ( xi ) x m = å i
2
i =1
= E
(X )- E (X ) 2
2
=
n
å
i =1
x i2 p ( x i ) - m 2
Expected Value and Variance Ø
E ( aX + b)
aE=( X ) + b
Ex. Given that X is random variable whose mean = 4, find the mean of 3X+5. Solution. E(3X+5)= 3 E(X)+E(5)= 3x4+5=17 Ø
V (aX + b) = a 2V ( X )
Ex. Given that X is random variable whose variance = 2, find the variance of 3X+5. Solution. V(3X+5)= 9 V(X)= 9x2=18
Example n
Using past data on TV sales (below left), a tabular representation of the probability distribution for TV sales (below right) was developed.
Units Sold 0 1 2 3 4
Number of Days 80 50 40 10 20 200
X 0 1 2 3 4
Find the mean and variance.
p(x) .40 .25 .20 .05 .10 1.00
Example:
• Variance and Standard Deviation of a Discrete Random Variable x
p(x)
xp(x)
0 1 2 3 4
.40 .25 .20 .05 .10
.00 .25 .40 .15 .40 1.20
Var ( X ) = s
x 2p(x) .00 .25 .80 .45 1.6 3.1
E( X ) = m
n
2
å x p=( x ) - m i =1
2 i
2
i
= 3.1 - 1.20 = 1.66 2
n
åx p(=x ) 1=1
i
i
1.20 =
§ standard deviation is 1.66 =1.2884
Example • Toss a fair coin 3 times and record x the number of heads. X
p(x)
xp(x)
(x-m)2p(x)
0
1/8
0
(-1.5)2(1/8)
1
3/8
3/8
(-0.5)2(3/8)
2
3/8
6/8
(0.5)2(3/8)
3
1/8
3/8
(1.5)2(1/8)
12 m = å xp ( x ) = = 1.5 8
s = å( x - m ) p ( x) 2
2
s 2 = .28125 + .09375 + .09375 + .28125 = .75 s = .75 = .688
Ö
Alternative Solution (Suggested): x
p(x)
x.p(x)
x2p(x)
0
1/8
0
0
1
3/8
3/8
3/8
2
3/8
3/4
3/2
3
1/8
3/8
9/8
12 m = å xp ( x ) = = 1.5 8 ì ü Var ( X ) = s å x p=( xi ) - íå xi p ( xi ) ý i =1 î i =1 þ = 3 - 1.52 = 0.75 n
2
n
2 i
2
s = .75 =.688
Example • The probability distribution for X the number of heads in tossing 3 fair coins.
• • • •
m
Shape? Outliers? Center? Spread?
Symmetric; mound-shaped None m = 1.5 s = .688
Some important Differentiation and Integration Formulas d ò c.dx = c.x (c ) = 0 dx dx = x ò d ( x) = 1 n +1 x dx n x dx = ; n ¹ -1 ò d n +1 ( x n ) = n x n -1 x x dx e dx e = ò d (e x ) = e x 1 x x dx ò a dx = ln a a d ( a x ) = a x ln a ò ln( x)dx = x ln x - x dx 1 d 1 ln ( x ) = dx = ln x ò dx x x
Notes about Continuous RV • A continuous random variable can assume any value in an interval on the real line or in a collection of intervals. • It is not relevant to talk about the probability of the random variable assuming a particular value. • Instead, we talk about the probability of the random variable assuming a value within a given interval.
Probability Distributions for Continuous Random Variables (Probability Density Function (PDF)). • The probability distribution is defined by a probability function, denoted by f(x), which provides the probability for each value of the random variable. • The probability distribution for continuous random variable is called Probability Density Function (PDF).
Properties for Continuous Random Variables The properties for a continuous probability function (PDF) are:
f (x ) 0 £ f ( x) £ 1 ¥
ò f ( x) dx =1
-¥
f (x ) =
d F (x ) dx
Cumulative Distribution Function (CDF)
F (x ) = P( X £ x ) =
x
ò f ( x) dx
-¥
b
F ( x ) = P ( a £ x £ b) = ò f ( x ) dx a
Example – Let X be a random variable with range [0,2] and pdf defined by f(x)=1/2 for all x between 0 and 2 and f(x)=0 for all other values of x. Note that since the integral of zero is zero we get
ò
¥
-¥
2
f ( x)dx = ò =1/ 2=dx 0
2
1 x 2 0
1- 0 = 1
– That is, as with all continuous pdfs, the total area under the curve is 1. We might use this random variable to model the position at which a two-meter with length of rope breaks when put under tension, assuming “every point is equally likely”. Then the probability the break occurs in the last half-meter of the rope is
P (3 / 2 £ X £ 2)
2
2
3/ 2
3/ 2
ò = f ( x)dx= ò
2
1/ 2=dx
1 x = 1/ 4 2 3/ 2
Example – Let Y be a random variable whose range is the nonnegative and whose pdf is defined by
1 f (y) = e 750
-
y 750
The random variable Y might be a reasonable choice to model the lifetime in hours of a standard light bulb with average life 750 hours. To find the probability a bulb lasts under 500 hours, you calculate
P(0 £Y <== 500)
500
ò
0
1 -x/750 -x/750 500 -2/3 e dx -= e -e +1» 0.487 0 750
Expected Value and Variance • The expected value, or mean, of a random variable is a measure of its central location. – Expected value of a continuous random variable: E(X ) = m =
¥
ò x f (x ) dx
-¥
• The variance summarizes the variability in the values of a random variable. – Variance of a discrete random variable:
( )- E(X )
Var ( X ) = s = E ( X - m ) = E X 2
2
2
2
¥ ö æ 2 2 = ò (x - m ) . f (x )dx = çç ò x . f (x )dx ÷÷ - m 2 -¥ ø è -¥ ¥
Discrete versus Continuous Random Variables Discrete RV
Continuous RV Infinite Sample Space e.g. [0,1], [2.1, 5.3]
Finite Sample Space e.g. {0, 1, 2, 3} Probability Mass Function (PMF)
Probability Density Function (PDF)
f (x )
p ( xi ) = P( X = xi ) 1. 0 £ p ( x) £ 1 "x 2.
å p( x) = 1 all x
Cumulative Distribution Function (CDF)
F ( x ) = P ( X £ x) =
b
å p ( x)
y = -¥
p (X £ x )
F (x ) = P( X £ x ) =
x
ò f ( x) dx
-¥
F ( x ) = P ( a £ x £ b) =
b
ò f ( x) dx a
Example ¨
We assume that with average waiting time of one customer is 2 minutes ì 1 -x / 2 ï e , x³0 f ( x) = í 2 ïî0, otherwise PDF: f (time)
time
Example • Probability that the customer waits exactly 3 minutes is:
1 3 - x /2 P (x = 3) = P (3 £ x £ 3) = ò=3 e dx 2
0
• Probability that the customer waits between 2 and 3 minutes is:
P (2 £ x £ 3)
1 3 - x /2 e =dx ò 2 2
0.145 =
• The Probability that the customer waits less than 2 minutes 2
P (0 £ X £ 2) =ò e = dx 1 - e = 0.632 0
-x/2
-1
Example • Probability that the customer waits exactly 3 minutes is:
1 3 -x /2 P (x = 3) = P (3 £ x £ 3) = ò=3 e dx 2
0
• Probability that the customer waits between 2 and 3 minutes is: 1 3 - x /2 P (2 £ x £ 3) e =dx 0.145 = ò 2 2 P(2 £ X £ 3) = F (3) - F (2) = (1 - e - (3 / 2 ) ) - (1 - e -1 ) = 0.145
CDF • The Probability that the customer waits less than 2 minutes P (0 £ X £ 2)
F=(2) - F (0) = F (2) = 1 - e -1
0.632 =
CDF
Expected Value and Variance A continuous variable X has a probability density function
f ( x) = cx ;0 £ x £ 1 2
where c is constant. Find (i) the value of c (ii) (iii) P ( X > .75) (iv) P(.25 £ X £ .75) v) compute mean and variance of X.
P( X £ .25)
Key Concepts V. Discrete Random Variables and Probability Distributions 1. Random variables, discrete and continuous 2. Properties of probability distributions 0 £ p ( x) £ 1 and å p( x) = 1
3. Mean or expected value of a discrete random variable: Mean : m = å xp( x) 4. Variance and standard deviation of a discrete random variable: Variance : s 2 = å( x - m ) 2 p( x) Standard deviation : s = s 2