P. 1
alg16

# alg16

|Views: 26|Likes:

See more
See less

10/20/2015

pdf

text

original

# MATH1151 – Algebra Lecture 16

Discrete Random Variables
A/Prof Rob Womersley
R.Womersley@unsw.edu.au
Red Centre 3062
School of Mathematics and Statistics, UNSW
Session 1, 2012
Womersley (Maths & Stats) MATH1151 – Algebra Lecture 16 (Slides) Session 1, 2012 1 / 13
Discrete Random Variables Random Variables
Random Variables
Deﬁnition (Random Variable)
A random variable is a function deﬁned on the set of outcomes of a
random experiment.
Value is random, but occurs with certain probabilities
Notation
random variable X (upper case)
value taken by random variable x (lower case)
Example
X = number when a six-sided die is rolled. Outcomes {1, . . . , 6}
P (X = k) =
1
6
for k = 1, 2, . . . , 6. Discrete
X = life, in years, of Australian female. Outcomes {0, . . . , 120}
P (X = k) for k = 0, 2, . . . , 120 from Actuarial tables. Discrete
X = time waiting for next train which arrives every 10 min
T = time to next train. Outcomes t ∈ [0, 10), Continuous
P (0 ≤ T < 3) =
3
10
, P (T = 3) = 0
Womersley (Maths & Stats) MATH1151 – Algebra Lecture 16 (Slides) Session 1, 2012 2 / 13
Discrete Random Variables Discrete Random Variables
Discrete Random Variables
Discrete random variable X
Discrete set of possible outcomes {x
k
} for
k ∈ Z = {. . . , −3, −2, −1, 0, 1, 2, 3, . . .}
k ∈ N = {0, 1, 2, 3, . . .}
k ∈ {0, 1, 2, . . . , n}
Probabilities P (X = x
k
) = p
k
satisfying
p
k
≥ 0 for all k,

k
p
k
= 1 (1)
Probability distribution for X: Any set of p
k
satisfying conditions (1)
Can extend discrete set K to larger set by taking p
k
= 0, k ∈ K
Notes
Can have an inﬁnite (countable) set of outcomes
Often x
k
= k but not necessary
P (x = x
k
) OK?
Womersley (Maths & Stats) MATH1151 – Algebra Lecture 16 (Slides) Session 1, 2012 3 / 13
Discrete Random Variables Poisson Distribution
Poisson Distribution
Deﬁnition (Poisson distribution)
Poisson distribution, with parameter λ ∈ R, λ > 0
p
k
= P (X = k) =
_
λ
k
k!
e
−λ
k = 0, 1, 2, . . .
0 Otherwise
Valid distribution as
p
k
= P(X = k) ≥ 0 for all k as λ > 0 (λ
0
= 1, 0! = 1)

k∈Z
p
k
= 1 as

k=−∞
p
k
=

k=0
p
k
=

k=0
λ
k
k!
e
−λ
= e
−λ

k=0
λ
k
k!
= e
−λ
e
λ
= 1
Used e
x
=

k=0
x
k
k!
Examples
X = number of customers in a queue
X = number of policy claims per day
Womersley (Maths & Stats) MATH1151 – Algebra Lecture 16 (Slides) Session 1, 2012 4 / 13
Discrete Random Variables Poisson Distribution
Poisson Distribution - Example
Matlab discrete.m
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
0
0.02
0.04
0.06
0.08
0.1
0.12
0.14
0.16
0.18
0.2
k
p
k
Poisson probabilites, λ = 5.00
Probabilities
Mean μ
μ − σ
μ + σ
Womersley (Maths & Stats) MATH1151 – Algebra Lecture 16 (Slides) Session 1, 2012 5 / 13
Discrete Random Variables Binomial Distribution
Binomial Distribution
Deﬁnition (Binomial Distribution)
Binomial distribution for n events, success probability p
P (X = k) =
_ _
n
k
_
p
k
(1 −p)
n−k
k = 0, 1, 2, . . . , n
0 Otherwise
Notation B(n, p, k) =
_
n
k
_
p
k
(1 −p)
n−k
Binomial coeﬃcient
_
n
k
_
=
n!
k!(n −k)!
Matlab nchoosek
Example
Event occurs with probability p ∈ [0, 1]
Event does not occur with probability 1 −p
Number of trials = n
Probability of exactly k events is B(n, p, k)
Womersley (Maths & Stats) MATH1151 – Algebra Lecture 16 (Slides) Session 1, 2012 6 / 13
Discrete Random Variables Binomial Distribution
Binomial Distribution - Example
Matlab discrete.m
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
0
0.02
0.04
0.06
0.08
0.1
0.12
0.14
0.16
0.18
0.2
k
B
(
n
,
p
,
k
)
Binomial probabilites, n = 20, p = 0.60
Probabilities
Mean μ
μ − σ
μ + σ
Womersley (Maths & Stats) MATH1151 – Algebra Lecture 16 (Slides) Session 1, 2012 7 / 13
Discrete Random Variables Expected Values
Expected Values
Set of possible outcomes {x
k
, k ∈ Z}
Probability P (X = x
k
) = p
k
for k ∈ Z
Mean or Expected value
μ = E[X] =

k=−∞
p
k
x
k
Expected value of function g(X) of random variable
E[g(X)] =

k=−∞
p
k
g(x
k
)
Variance of X
Var [X] = E
_
(X −E[X])
2
¸
=

k=−∞
p
k
(x
k
−E[X])
2
Standard deviation
σ(X) =
_
Var [X], Var [X] = σ
2
(X)
Womersley (Maths & Stats) MATH1151 – Algebra Lecture 16 (Slides) Session 1, 2012 8 / 13
Discrete Random Variables Calculating the Variance
Calculating the Variance
Mean μ = E[X] =

k=−∞
p
k
x
k
1st moment
Variance
σ
2
= E
_
(X −μ)
2
¸
=

k=−∞
p
k
(x
k
−μ)
2
Calculate by

k=−∞
p
k
(x
k
−μ)
2
=

k=−∞
_
p
k
x
2
k
−2μp
k
x
k

2
p
k
_
=

k=−∞
p
k
x
2
k
−2μ

k=−∞
p
k
x
k

2

k=−∞
p
k
= E
_
X
2
¸
−2μ ×μ +μ
2
×1
= E
_
X
2
¸
−μ
2
σ
2
= Var [X] = E
_
X
2
¸
−μ
2
, E
_
X
2
¸
2nd moment
Womersley (Maths & Stats) MATH1151 – Algebra Lecture 16 (Slides) Session 1, 2012 9 / 13
Discrete Random Variables Mean and Variance
Poisson - Mean, Variance
Poisson distribution P (X = k) = p
k
=
λ
k
k!
e
−λ
for k = 0, 1, , 2 . . .
Mean μ = E[X] = λ
E[X] =

k=−∞
kp
k
=

k=0

k
k!
e
−λ
= e
−λ

k=1
λ
k
(k −1)!
= λe
−λ

k=1
λ
k−1
(k −1)!
= λe
−λ

=0
λ

!
( = k −1)
= λe
−λ
×e
λ
= λ
Variance σ
2
= Var [X] = λ from E
_
X
2
¸
= λ
2
+λ (see notes)
Womersley (Maths & Stats) MATH1151 – Algebra Lecture 16 (Slides) Session 1, 2012 10 / 13
Discrete Random Variables Mean and Variance
Binomial - Mean, Variance
Binomial: parameters n, p, q = 1 −p
Probability
P (X = k) = B(n, p, k) =
_
n
k
_
p
k
q
n−k
Mean
μ = E[X] = np
Proof in notes
Variance
σ
2
= Var [X] = npq
Exercise in notes
Womersley (Maths & Stats) MATH1151 – Algebra Lecture 16 (Slides) Session 1, 2012 11 / 13
Discrete Random Variables Poisson approximation to Binomial
Poisson approximation to Binomial
Proposition
If X is a random variable with a binomial distribution with parameters n,
p and np = λ is constant, then
_
n
k
_
p
k
(1 −p)
n−k

λ
k
k!
e
−λ
Binomial can be approximated by Poisson with the same mean
Good if n > 50 and np < 5 or n(1 −p) < 5
Example
Probability of a genetic defect is 1 in 500, 000. Find the probability that in
a population of 2 million, no more than 5 people have the defect.
Womersley (Maths & Stats) MATH1151 – Algebra Lecture 16 (Slides) Session 1, 2012 12 / 13
Discrete Random Variables Poisson approximation to Binomial
Example
Solution
Binomial n = 2 ×10
6
, p = 2 ×10
−6
Exact
5

k=0
_
2 ×10
6
k
_
_
2 ×10
−6
_
k
_
1 −2 ×10
−6
_
2×10
6
−k
= 0.78513054
Matlab using nchoosek
Poisson approximation λ = np = 4
e
−4
5

k=0
4
k
k!
= e
−4
_
1 +
4
1
+
4
2
2
+
4
3
6
+
4
4
24
+
4
5
120
_
= 0.78513039
Womersley (Maths & Stats) MATH1151 – Algebra Lecture 16 (Slides) Session 1, 2012 13 / 13

. . . λ > 0 λk −λ k = 0. k pk = 1 (1) Probability distribution for X: Any set of pk satisfying conditions (1) Can extend discrete set K to larger set by taking pk = 0. . 2012 4 / 13 . 2012 3 / 13 Poisson Distribution Deﬁnition (Poisson distribution) Poisson distribution. . 0. 3. . . . . . . 1. 2. −2. 3. with parameter λ ∈ R. . 2. 0! = 1) ∞ k=0 pk = k=−∞ k=0 ∞ k=0 pk = k=0 λk −λ e = e−λ k! λk = e−λ eλ = 1 k! Used e = x xk k! Examples X = number of customers in a queue X = number of policy claims per day Womersley (Maths & Stats) MATH1151 – Algebra Lecture 16 (Slides) Session 1. n} Probabilities P (X = xk ) = pk satisfying pk ≥ 0 for all k.} k ∈ {0. .Discrete Random Variables Discrete Random Variables Discrete Random Variables Discrete random variable X Discrete set of possible outcomes {xk } for k ∈ Z = {. 1.} k ∈ N = {0. 1. 2. . 1. −1. 2. k ∈ K Notes Can have an inﬁnite (countable) set of outcomes Often xk = k but not necessary P (x = xk ) OK? Womersley (Maths & Stats) MATH1151 – Algebra Lecture 16 (Slides) Discrete Random Variables Poisson Distribution Session 1. . . −3. k! e pk = P (X = k) = 0 Otherwise Valid distribution as pk = P (X = k) ≥ 0 for all k as λ > 0 pk = 1 as k∈Z ∞ ∞ ∞ (λ0 = 1.

14 0. λ = 5.1 0. p.Example Matlab discrete. 2012 6 / 13 .00 Probabilities Mean μ μ−σ μ+σ 0 1 2 3 4 5 6 7 8 9 10 k 11 12 13 14 15 16 17 18 19 20 Womersley (Maths & Stats) MATH1151 – Algebra Lecture 16 (Slides) Discrete Random Variables Binomial Distribution Session 1.12 0.2 0. 1] Event does not occur with probability 1 − p Number of trials = n Probability of exactly k events is B(n.08 0. 1.02 0 pk Poisson probabilites. 2012 5 / 13 Binomial Distribution Deﬁnition (Binomial Distribution) Binomial distribution for n events. . success probability p P (X = k) = Notation B(n.18 0.04 0. k) = Binomial coeﬃcient n k pk (1 − p)n−k k = 0.Discrete Random Variables Poisson Distribution Poisson Distribution . . p. 2.16 0.m 0. n 0 Otherwise pk (1 − p)n−k n k = n! k!(n − k)! n k Matlab nchoosek Example Event occurs with probability p ∈ [0.06 0. . k) Womersley (Maths & Stats) MATH1151 – Algebra Lecture 16 (Slides) Session 1. .

k) 0.08 0. k ∈ Z} Probability P (X = xk ) = pk for k ∈ Z Mean or Expected value ∞ μ = E [X] = k=−∞ ∞ p k xk Expected value of function g(X) of random variable E [g(X)] = k=−∞ pk g(xk ) ∞ k=−∞ Variance of X Var [X] = E (X − E [X])2 = Standard deviation σ(X) = Womersley (Maths & Stats) pk (xk − E [X])2 Var [X].Discrete Random Variables Binomial Distribution Binomial Distribution . 2012 7 / 13 Expected Values Set of possible outcomes {xk .60 0.1 0.16 0.14 0.12 B(n.2 0. 2012 8 / 13 MATH1151 – Algebra Lecture 16 (Slides) .02 0 Probabilities Mean μ μ−σ μ+σ 0 1 2 3 4 5 6 7 8 9 10 k 11 12 13 14 15 16 17 18 19 20 Womersley (Maths & Stats) MATH1151 – Algebra Lecture 16 (Slides) Discrete Random Variables Expected Values Session 1.Example Matlab discrete. p = 0. n = 20.06 0. Var [X] = σ 2 (X) Session 1.04 0.p.m Binomial probabilites.18 0.

2012 9 / 13 MATH1151 – Algebra Lecture 16 (Slides) Poisson . . 2012 10 / 13 . . 1. Womersley (Maths & Stats) Discrete Random Variables − 2μ k=−∞ 2 p k xk + μ 2 ∞ pk k=−∞ k=−∞ 2 − 2μ × μ + μ × 1 E X2 Mean and Variance = E X 2 − μ2 2nd moment Session 1. ∞ E [X] = = e kpk = k=−∞ ∞ −λ k=1 ∞ −λ k=0 kλk −λ e k! λk (k − 1)! λk−1 (k − 1)! λ ! ( = k − 1) = λe = λe−λ k=1 ∞ =0 = λe−λ × eλ = λ Variance σ 2 = Var [X] = λ from E X 2 = λ2 + λ (see notes) Womersley (Maths & Stats) MATH1151 – Algebra Lecture 16 (Slides) Session 1.Mean. .Discrete Random Variables Calculating the Variance Calculating the Variance ∞ Mean μ = E [X] = k=−∞ p k xk 2 1st moment ∞ Variance σ = E (X − μ) Calculate by ∞ k=−∞ ∞ 2 = k=−∞ pk (xk − μ)2 pk (xk − μ) 2 = k=−∞ ∞ pk x2 − 2μpk xk + μ2 pk k p k x2 k ∞ = = E X σ 2 = Var [X] = E X 2 − μ2 . 2 . Variance Poisson distribution P (X = k) = pk = Mean μ = E [X] = λ ∞ λk −λ k! e for k = 0.

p and np = λ is constant. Find the probability that in a population of 2 million.Discrete Random Variables Mean and Variance Binomial . Womersley (Maths & Stats) MATH1151 – Algebra Lecture 16 (Slides) Session 1. k) = Mean μ = E [X] = np Proof in notes n. no more than 5 people have the defect. Variance Binomial: parameters Probability P (X = k) = B(n. 2012 12 / 13 . p. 000. q = 1 − p n k n−k p q k Variance Exercise in notes σ 2 = Var [X] = npq Womersley (Maths & Stats) MATH1151 – Algebra Lecture 16 (Slides) Discrete Random Variables Poisson approximation to Binomial Session 1. 2012 11 / 13 Poisson approximation to Binomial Proposition If X is a random variable with a binomial distribution with parameters n. then n k λk −λ n−k e p (1 − p) → k! k Binomial can be approximated by Poisson with the same mean Good if n > 50 and np < 5 or n(1 − p) < 5 Example Probability of a genetic defect is 1 in 500.Mean. p.

78513039 Womersley (Maths & Stats) MATH1151 – Algebra Lecture 16 (Slides) Session 1. p = 2 × 10−6 2 × 106 k 2 × 10 −6 k 1 − 2 × 10 6 −6 2×10 −k = 0.78513054 Matlab using nchoosek Poisson approximation λ = np = 4 e −4 5 k=0 4k 44 45 4 42 43 −4 =e + + + 1+ + k! 1 2 6 24 120 = 0. 2012 13 / 13 .Discrete Random Variables Poisson approximation to Binomial Example Solution Binomial Exact 5 k=0 n = 2 × 106 .

scribd
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->