Sunteți pe pagina 1din 7

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
Denition (Random Variable)
A random variable is a function dened 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 innite (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
Denition (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)

kZ
p
k
= 1 as

k=
p
k
=

k=0
p
k
=

k=0

k
k!
e

= e

k=0

k
k!
= 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
Denition (Binomial Distribution)
Binomial distribution for n events, success probability p
P (X = k) =
_ _
n
k
_
p
k
(1 p)
nk
k = 0, 1, 2, . . . , n
0 Otherwise
Notation B(n, p, k) =
_
n
k
_
p
k
(1 p)
nk
Binomial coecient
_
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
2p
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
= 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
k!
e

= e

k=1

k
(k 1)!
= e

k=1

k1
(k 1)!
= e

=0

!
( = k 1)
= 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
nk
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)
nk


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
_
210
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

S-ar putea să vă placă și