Professional Documents
Culture Documents
Random Variables
Given a set of outcomes , a random variable is a number that
depends on the outcome. A random variable is discrete if its
possible values can be listed in a sequence x1 , x2 , . . .
Example: Suppose we toss a fair coin 3 times. The set of
outcomes is
= {TTT , TTH, THT , THH, HTT , HTH, HHT , HHH}
Let X be the number of heads. Then X is a random variable:
TTT : X = 0
HTT : X = 1
TTH : X = 1
HTH : X = 2
THT : X = 1
HHT : X = 2
THH : X = 2
HHH : X = 3
1
3/8
2
3/8
3
1/8
0.1
0
1/8
0.0
x
f(x)
0.2
0.3
5
6
7
8
9
10
11
6
7
8
9
10
11
12
0.10
3
4
5
6
7
8
9
0.05
1
2
3
4
5
6
2
3
4
5
6
7
8
0.00
1
2
3
4
5
6
7
0.15
10 11 12
10
11
12
f (x)
1
36
2
36
3
36
4
36
5
36
6
36
5
36
4
36
3
36
2
36
1
36
Expected Value
Definition
Given a discrete random variable X with probability mass function
f (x), the expected value of X (or mean of X) is
X
E (X ) =
x f (x)
where in the sum x ranges over all possible values of X . For E (X )
we will sometimes write X or just .
Example: Recall that if we toss a fair coin three times, the number
of heads X has probability mass function
x
f(x)
0
1/8
1
3/8
2
3/8
3
1/8
Expected Value
If X is a discrete random variable X and h(x) is a function, then
h(X ) is also a discrete random variable, and
X
E [h(X )] =
h(x) f (x)
where f (x) is the probability mass function of X .
Example: Again let X be the number of heads when tossing a fair
coin 3 times. What is the expected value of X 2 ?
Recall the pmf of X :
x
f(x)
0
1/8
1
3/8
2
3/8
3
1/8
1
3
3
1
24
+ 1 2 + 2 2 + 32 =
=3
8
8
8
8
8
Ch. 3 Discrete Random Variables
Expected Value
Example
A raffle sold 1,000 tickets at $15 each. Tickets are to be drawn at
random and monetary prizes are awarded as follows: one prize of
$800; two prizes of $500; five prizes of $300; and ten prizes of
$100.
What is the expected value of this raffle?
E (c) = c
E (cX ) = cE (X )
E (X + Y ) = E (X ) + E (Y )
Example
Someone offers to let you play a game where you pay him $10,
toss a fair coin 3 times, and then he pays you back 3X + 5 dollars,
where X is the number of times the coin comes up heads.
If you play, what is the expected amount of money that you will
you be paid? On average, would this game work in your favor?
1
3
3
1
+ (1 1.5)2 + (2 1.5)2 + (3 1.5)2
8
8
8
8
= 0.75
Ch. 3 Discrete Random Variables
Recall :
E (X 2 ) =
= 02
x 2 f (x)
1
3
3
1
24
+ 1 2 + 22 + 3 2 =
=3
8
8
8
8
8
Therefore :
V (X ) = E (X 2 ) 2
V (X ) = 3 (1.5)2
V (X ) = 0.75
Ch. 3 Discrete Random Variables
Distribution
Random variable X
Binomial
Geometric
Negative Binomial
Hypergeometric
Poisson
pmf
Mean
Variance
x
f (x)
0
1-p
1
p
1p
0
1-p
1
p
Example
If you guess on a five question multiple choice exam with twenty
questions, what is your expected score on the exam?
What is your variance of scores on the exam?
1
.432
2
.288
3
.064
0.1
0
.216
0.0
x
f(x)
0.2
0.3
0.4
Binomial Distributions
TTTH
THTH
HTTH
HHTH
TTHT
THHT
HTHT
HHHT
TTHH
THHH
HTHH
HHHH
Counting
How many ways are there to rearrange the letters ABCD?
ABCD
BACD
CABD
DABC
ABDC
BADC
CADB
DACB
ACBD
BCAD
CBAD
DBAC
ACDB
BCDA
CBDA
DBCA
ADBC
BDAC
CDAB
DCAB
ADCB
BDCA
CDBA
DCBA
There are
4 choices for which letter to put in the first position
3 choices for which letter to put in the second position
2 choices for which letter to put in the third position
1 choice for which letter to put in the fourth position
= 4 3 2 1 = 24
In general, the number of ways to rearrange n distinct symbols is
n! = n(n 1)(n 2) 3 2 1
Ch. 3 Discrete Random Variables
Counting
How many ways are there to rearrange the letters BANANA?
Simply counting them all, we find there are 60:
BANANA
BANNAA
NABANA
ABNAAN
AABNAN
ANBNAA
NANBAA
ANNABA
ANAANB
NNAAAB
BANAAN
ABNANA
ANBANA
BAAANN
AABANN
NABNAA
NNABAA
NNAABA
ANANAB
NAAANB
BAANAN
BNAANA
ANBAAN
ABAANN
AABNNA
NAABNA
NNBAAA
AANNBA
ANNAAB
NAAABN
ABANAN
BNANAA
NABAAN
ANABAN
ABNNAA
BNNAAA
NANABA
ANAABN
AANNAB
AAANBN
ABANNA
NBANAA
NBAAAN
NAABAN
AANBNA
NBNAAA
NAANBA
AANABN
NANAAB
AAANNB
BAANNA
NBAANA
BNAAAN
AANBAN
ANABNA
ANNBAA
ANANBA
AANANB
NAANAB
AAABNN
Counting
Counting
Example
How many ways are there to create a five number pin code without
repeats?
Example
How many ways are there to rearrange the letters HHTT ?
Example
If we toss a coin 6 times, what is the probability that it comes up
heads exactly 3 times?
Binomial Coefficients
Binomial Coefficients
Binomial Coefficients
Example
How many ways are there to create golfing pairs from a group of
eight golfers?
Example
How many was can a starting five basketball team be chosen from
twelve players on the bench?
The trials are independent; that is, the outcome on one trial
does not affect the outcome on other trials.
Ch. 3 Discrete Random Variables
Example
If you flip a fair coin twenty times what is the probability that you
get exactly ten heads?
1
17.6
32.1
50.0
64.3
Example
If you flip a fair coin twenty times what is the probability that you
get at least three heads?
1.0
0.30
For example, given X Bin(7, .6), f (x) and F (x) are as follows:
0.20
0.8
0.6
0.4
0.2
1 0
0.0
0.00
0.10
1 0
Example
Find the CDF when you flip a coin three times and count the
number of tails.
Properties of Variance
Let X and Y be random variables, and let c be a constant. Then
1
V (c) = 0
V (cX ) = c 2 V (X )
V (X + c) = V (X )
V (X ) = V (Y1 + Y2 + Y3 )
= V (Y1 ) + V (Y2 ) + V (Y3 )
= .25 + .25 + .25 = .75
Ch. 3 Discrete Random Variables
Properties of Variance
Example
True or False?
V (7 + 3X + X + 2) = 8V (X )
V (Yi ) = p(1 p)
Therefore,
E (X ) = E (Y1 + + Yn )
= E (Y1 ) + + E (Yn )
= p + + p = np
V (X ) = V (Y1 + + Yn )
= V (Y1 ) + + V (Yn )
= p(1 p) + + p(1 p) = np(1 p)
Ch. 3 Discrete Random Variables
Problem
Example
A manufacturer produces widgets which work with probability .4.
Suppose we test widgets one at a time until we find one that
works. Let X be the number of bad widgets we try before we find
one that works. What is the pmf of X ?
0.3
0.4
0.2
0.1
0.0
Example
An archer has a constant 60% accuracy of hitting a target. What
is the probability he will hit the target on the fourth attempt?
Example
An archer has a constant 60% accuracy of hitting a target. What
is the probability he will hit the target before the fourth attempt?
Be careful how you define your random variable and formula!
Geometric Sums
rj = 1 + r + r2 + + rn =
j=0
1
Example: 1 + +
2
1 r n+1
1r
2
5
1
1
1 (1/2)6
+ +
=
2
2
1 1/2
=
63
64
1/2
63
32
rj =
j=0
Example:
j
X
1
j=0
=1+
=
1
1
1
1r
1 1 1
+ + + ...
2 4 8
1
2
=2
Example
Find the sum of the following series:
1
1
1 1
+ +
+
+ ...
3 9 27 81
E (X ) =
1
p
V (X ) =
1p
p2
1
1
=
= 1296
p
1/1296
Example
A manufacturer produces widgets which work with probability .8.
Suppose we test widgets one at a time. Let X be the number of
bad widgets we test until we find 5 that work. What is the
probability that X = 2?
Example
A manufacturer produces widgets which work with probability .8.
Find the PMF and CDF of the number of bad widgets until we find
5 that work.
210
495
= 42/99.
Example
There are 9 students and 10 faculty. What is the probability of
selecting a five person committee with exactly three faculty?
Hypergeometric Distribution
In general if we select n individuals at random from a population of
size N, where M individuals are of type A, and N M are of type
B, then the number X of selected individuals of type A is a
hypergeometric random variable:
M NM
P(X = x) =
nx
N
n
P(X = 2) =
5
2
20
8
25
10
.385
10
25
10
9 +
25
10
8
25
10
.699
Hypergeometric Distribution
Example
An instructor who taught two sections of statistics last term, the
first with 20 students and the second with 30, decided to assign a
term project. After all projects had been turned in, the instructor
randomly ordered them before grading. Consider the first 15
graded projects. What is the probability that exactly 10 of these
are from the second section?
Example
What is the probability that at least 3 of these are from the second
section?
If the size of the batch is very large (say, 10000 widgets) and only
a few widgets are drawn, then it makes little difference whether we
sample with or without replacement, because it is very unlikely
that any widget would be chosen more than once anyway. In this
case, the hypergeometric and binomial distributions are practically
identical.
In mathematical terms, the pmf of a hypergeometric random
variable approaches the pmf of a binomial random variable, in the
limit as we increase the population size N while keeping the same
proportion p = M/N.
N n
np(1 p)
N 1
We call Nn
N1 the finite population correction factor. When the
population size N is large compared to the sample size n, the
correction factor is approximately 1 and the variance is
approximately np(1 p), the variance of a binomial, Bin(n, p).
Poisson Process
Consider a process where events occur at random times, such as
The arrival times of customers at a store
Clicks of a Geiger counter exposed to a radioactive material
Webpage requests on an internet server
Incoming calls to a customer service center
Such a process is called a Poisson process if the following
assumptions hold:
1
Poisson Process
Suppose that at random times a system suffers breakdowns
requiring immediate repairs. If the system breaks down at a rate of
once per year, what is the probability that the system will break
down 3 or more times in one year?
Solution: The given information suggests that the number X of
breakdowns in a year is a Poisson random variable with mean 1.
P(X 3) = 1 P(X 2)
= 1 P(X = 0) P(X = 1) P(X = 2)
e 1 10 e 1 11 e 1 12
0!
1! 2!
1
= 1 e 1 1 + 1 +
2
1
5e
=1
.080
2
=1
E (X ) =
V (X ) =
Poisson Distribution
Example
Suppose that trees are distributed in a forest according to a
two-dimensional Poisson process with parameter , the expected
number of trees per acre, equal to 80. What is the probability that
in an acre plot, there are ninety trees?
Example
What is the probability that in a certain quarteracre plot, there will
be between fifteen to twenty trees inclusive?
Example
If the forest covers 85,000 acres, what is the expected number of
trees in the forest?
Summary
Summary
The expected
value or mean of a discrete random variable X is
P
E (X ) = x f (x).
1
E (c) = c
E (cX ) = cE (X )
E (X + Y ) = E (X ) + E (Y )
V (c) = 0
V (cX ) = c 2 V (X )
V (X + c) = V (X )
Summary
Distribution Random variable X
Binomial
Number of successes
out of n independent
trials
Geometric Number of failures until first success
Negative
Number of failures unBinomial
til r successes
HyperNumber of type A in a
geometric
random sample of size
n from a population of
size N containing M
of type A
Poisson
Number of events occuring over an interval
of time, where events
occur at random times
pmf
n x
nx
x p (1 p)
Mean
np
Variance
np(1 p)
1
p
1
1
2
p
p
1
1
r
p2
p
Nn
N1 np(1 p)
x = 0, 1, . . . , n
p(1 p)x
x = 0, 1, 2, . . .
x+r 1
r 1
p r (1 p)x r ( 1 1)
p
x = 0, 1, 2, . . .
M
x
NM
nx
N
n
x = 0, . . . , n
e x
x!
np
where
p=M
N
x = 0, 1, 2, . . .
Summary
Fixed Trials(n)
Fixed Successes(r)
With Replacement
(p fixed)
Binomial
(Bernoulli n = 1)
Negative Binomial
(Geometric r = 1)
Without Replacement
(p varies)
Hypergeometric
Negative Hypergeometric