Sunteți pe pagina 1din 43

COM2023

Mathematics Methods for


Computing II
Lecture 11& 12

Gianne Derks
Department of Mathematics (36AA04)
http://www.maths.surrey.ac.uk/Modules/COM2023

Autumn 2010

Use channel 04 on your EVS handset


Overview
Poisson distribution

Distributions for discrete random variables:

The binomial distribution (last hour)


The Poisson distribution
Poisson distribution

Poisson Distribution (4.6)


Poisson distribution
Poisson distribution

Poisson distributions are often used to describe the probabilities of the


number of occurances of events which occur randomly (independently) at a
constant average rate in space or time. For example:

the number of accidents per month on a given stretch of road;


the number of faults in a piece of material;
the number of telephone calls arriving at a switchboard in an hour;
the number of fish caught in a given lake in 4 hours.
Poisson distribution
Poisson distribution

Poisson distributions are often used to describe the probabilities of the


number of occurances of events which occur randomly (independently) at a
constant average rate in space or time. For example:

the number of accidents per month on a given stretch of road;


the number of faults in a piece of material;
the number of telephone calls arriving at a switchboard in an hour;
the number of fish caught in a given lake in 4 hours.

The random variable X has a Poisson distribution with parameter if it has a


probability mass function (pmf) given by

x
p(x) = P (X = x) = e , for x = 0, 1, 2, 3, . . .
x!
We denote this by X P o().
The number is the average rate with which the events occur.
Examples about the Poisson Distribution
Poisson distribution

The number of flaws in a fabric is on average 2 flaws per square meter.


Assuming that the number of flaws X satisfies a Poisson
distribution, find which one:
Examples about the Poisson Distribution
Poisson distribution

The number of flaws in a fabric is on average 2 flaws per square meter.


Assuming that the number of flaws X satisfies a Poisson
distribution, find which one: X P o(2).
Examples about the Poisson Distribution
Poisson distribution

The number of flaws in a fabric is on average 2 flaws per square meter.


Assuming that the number of flaws X satisfies a Poisson
distribution, find which one: X P o(2).
For a square metric of fabric calculate the probability that it has
no flaws:
exactly 1 flaw:
2 or more flaws:
Examples about the Poisson Distribution
Poisson distribution

The number of flaws in a fabric is on average 2 flaws per square meter.


Assuming that the number of flaws X satisfies a Poisson
distribution, find which one: X P o(2).
For a square metric of fabric calculate the probability that it has
20 e2
no flaws: P (X = 0) = 0! 0.1353
exactly 1 flaw:
2 or more flaws:
Examples about the Poisson Distribution
Poisson distribution

The number of flaws in a fabric is on average 2 flaws per square meter.


Assuming that the number of flaws X satisfies a Poisson
distribution, find which one: X P o(2).
For a square metric of fabric calculate the probability that it has
20 e2
no flaws: P (X = 0) = 0! 0.1353
21 e2
exactly 1 flaw: P (X = 1) = 1! 0.2707
2 or more flaws:
Examples about the Poisson Distribution
Poisson distribution

The number of flaws in a fabric is on average 2 flaws per square meter.


Assuming that the number of flaws X satisfies a Poisson
distribution, find which one: X P o(2).
For a square metric of fabric calculate the probability that it has
20 e2
no flaws: P (X = 0) = 0! 0.1353
21 e2
exactly 1 flaw: P (X = 1) = 1! 0.2707
2 or more flaws: P (X 2) = 1 p(0) p(1) = 1 3e2 0.5940
Examples about the Poisson Distribution
Poisson distribution

The number of flaws in a fabric is on average 2 flaws per square meter.


Assuming that the number of flaws X satisfies a Poisson
distribution, find which one: X P o(2).
For a square metric of fabric calculate the probability that it has
20 e2
no flaws: P (X = 0) = 0! 0.1353
21 e2
exactly 1 flaw: P (X = 1) = 1! 0.2707
2 or more flaws: P (X 2) = 1 p(0) p(1) = 1 3e2 0.5940
A switchboard receives on average 50 calls per day.
Assuming that the number of calls per day X satisfies a Poisson
distribution, find which one:
Examples about the Poisson Distribution
Poisson distribution

The number of flaws in a fabric is on average 2 flaws per square meter.


Assuming that the number of flaws X satisfies a Poisson
distribution, find which one: X P o(2).
For a square metric of fabric calculate the probability that it has
20 e2
no flaws: P (X = 0) = 0! 0.1353
21 e2
exactly 1 flaw: P (X = 1) = 1! 0.2707
2 or more flaws: P (X 2) = 1 p(0) p(1) = 1 3e2 0.5940
A switchboard receives on average 50 calls per day.
Assuming that the number of calls per day X satisfies a Poisson
distribution, find which one: X P o(50).
Examples about the Poisson Distribution
Poisson distribution

The number of flaws in a fabric is on average 2 flaws per square meter.


Assuming that the number of flaws X satisfies a Poisson
distribution, find which one: X P o(2).
For a square metric of fabric calculate the probability that it has
20 e2
no flaws: P (X = 0) = 0! 0.1353
21 e2
exactly 1 flaw: P (X = 1) = 1! 0.2707
2 or more flaws: P (X 2) = 1 p(0) p(1) = 1 3e2 0.5940
A switchboard receives on average 50 calls per day.
Assuming that the number of calls per day X satisfies a Poisson
distribution, find which one: X P o(50).
For an arbitrary day, calculate the probability that there are
exactly 45 calls:
exactly 50 calls:
Examples about the Poisson Distribution
Poisson distribution

The number of flaws in a fabric is on average 2 flaws per square meter.


Assuming that the number of flaws X satisfies a Poisson
distribution, find which one: X P o(2).
For a square metric of fabric calculate the probability that it has
20 e2
no flaws: P (X = 0) = 0! 0.1353
21 e2
exactly 1 flaw: P (X = 1) = 1! 0.2707
2 or more flaws: P (X 2) = 1 p(0) p(1) = 1 3e2 0.5940
A switchboard receives on average 50 calls per day.
Assuming that the number of calls per day X satisfies a Poisson
distribution, find which one: X P o(50).
For an arbitrary day, calculate the probability that there are
5045 e50
exactly 45 calls: P (X = 45) = 45! = 0.0458;
exactly 50 calls:
Examples about the Poisson Distribution
Poisson distribution

The number of flaws in a fabric is on average 2 flaws per square meter.


Assuming that the number of flaws X satisfies a Poisson
distribution, find which one: X P o(2).
For a square metric of fabric calculate the probability that it has
20 e2
no flaws: P (X = 0) = 0! 0.1353
21 e2
exactly 1 flaw: P (X = 1) = 1! 0.2707
2 or more flaws: P (X 2) = 1 p(0) p(1) = 1 3e2 0.5940
A switchboard receives on average 50 calls per day.
Assuming that the number of calls per day X satisfies a Poisson
distribution, find which one: X P o(50).
For an arbitrary day, calculate the probability that there are
5045 e50
exactly 45 calls: P (X = 45) = 45! = 0.0458;
50
50 e50
exactly 50 calls: P (X = 50) = 50! = 0.0563.
Graphs for Poisson Distributions (1)
Poisson distribution

So the probability of getting the average is not very high for Poisson
distributions with a large average (i.e., large). Using matlab, we can plot
the distribution for P o(50) with x between 20 and 80:
0.06 bar(20:80,poisspdf(20:80,50))

0.05

0.04
P(X=x)

0.03

0.02

0.01

0
20 30 40 50 60 70 80
x
Graphs for Poisson Distributions (2)
Poisson distribution

The Poisson distribution with a smaller average (i.e. small) looks quite
different. Using matlab, we can plot the distribution for P o(2) with x
between 0 and 10:
bar(0:10,poisspdf(0:10,2))
0.25

0.2

0.15
P(X=x)

0.1

0.05

0
0 1 2 3 4 5 6 7 8 9 10
x
Poisson distribution and R (1)
Poisson distribution

The package R has the Poisson distribution build in:

dpois(x,) gives P (X = x) for X P o().

ppois(x,) gives P (X x) for X P o().


Poisson distribution and R (1)
Poisson distribution

The package R has the Poisson distribution build in:

dpois(x,) gives P (X = x) for X P o().

ppois(x,) gives P (X x) for X P o().

Examples

P(X=7) for X P o(3) is obtained by


dpois(7,3) and gives the answer 0.02160403;
Poisson distribution and R (1)
Poisson distribution

The package R has the Poisson distribution build in:

dpois(x,) gives P (X = x) for X P o().

ppois(x,) gives P (X x) for X P o().

Examples

P(X=7) for X P o(3) is obtained by


dpois(7,3) and gives the answer 0.02160403;

P (X 7) for X P o(3) is obtained by


ppois(7,3) and gives the answer 0.9880955;
Poisson distribution and R (1)
Poisson distribution

The package R has the Poisson distribution build in:

dpois(x,) gives P (X = x) for X P o().

ppois(x,) gives P (X x) for X P o().

Examples

P(X=7) for X P o(3) is obtained by


dpois(7,3) and gives the answer 0.02160403;

P (X 7) for X P o(3) is obtained by


ppois(7,3) and gives the answer 0.9880955;

A list of probabilities is obtained by dpois(0:7,3) and gives


[1] 0.04978706837 0.1493612051 0.2240418077 0.2240418077
[5] 0.1680313557 0.1008188134 0.05040940672 0.02160403145
Poisson distribution and R (2)
Poisson distribution

One can also make plots to get an overview. Below are an overview of the
pmf (left) and distribution (right) of X P o(6). Note the position of the
expectation and the long tail:

1.0
0.15

0.8
0.10

0.6
dpois(0:30, 6)

ppois(0:30, 6)

0.4
0.05

0.2
0.00

0.0

0 5 10 15 20 25 30 0 5 10 15 20 25 30

0:30 0:30

plot(0:30,dpois(0:30,6), plot(0:30,ppois(0:30,6),
type=h,lwd=4) type=h,lwd=4)
Poisson distribution and R (3)
Poisson distribution

Next plots of the pmf (left) and distribution (right) of X P o(18) Note the
shift and widening of the bump, what are the expectation and standard
deviation?:

1.0
0.08

0.8
0.06

0.6
dpois(0:30, 18)

ppois(0:30, 18)
0.04

0.4
0.02

0.2
0.00

0.0
0 5 10 15 20 25 30 0 5 10 15 20 25 30

0:30 0:30

plot(0:30,dpois(0:30,18), plot(0:30,ppois(0:30,18),
type=h,lwd=4) type=h,lwd=4)

= 18 and = 18 4.24.
Binomial and Poisson Distribution (1)
Poisson distribution

The random variable X related to n independent trials, all with success


probability , has a Binomial distribution (X B(n, )) if its pmf is

n x
p(x) = P (X = x) = x (1 )nx , x = 0, 1, . . . , n
The random variable X has a Poisson distribution with parameter
(X P o()) if it has a probability mass function (pmf) given by
p(x) = P (X = x) = x! e for x = 0, 1, 2, 3, . . .
x
Binomial and Poisson Distribution (1)
Poisson distribution

The random variable X related to n independent trials, all with success


probability , has a Binomial distribution (X B(n, )) if its pmf is

n x
p(x) = P (X = x) = x (1 )nx , x = 0, 1, . . . , n
The random variable X has a Poisson distribution with parameter
(X P o()) if it has a probability mass function (pmf) given by
p(x) = P (X = x) = x! e for x = 0, 1, 2, 3, . . .
x

The Poisson distribution can be used to approximate to the Binomial


distribution when the number of trials (n) is large and the probability of
success () is small. Just take = n.
Binomial and Poisson Distribution (1)
Poisson distribution

The random variable X related to n independent trials, all with success


probability , has a Binomial distribution (X B(n, )) if its pmf is

n x
p(x) = P (X = x) = x (1 )nx , x = 0, 1, . . . , n
The random variable X has a Poisson distribution with parameter
(X P o()) if it has a probability mass function (pmf) given by
p(x) = P (X = x) = x! e for x = 0, 1, 2, 3, . . .
x

The Poisson distribution can be used to approximate to the Binomial


distribution when the number of trials (n) is large and the probability of
success () is small. Just take = n. Below is a table with P (X = x).
1 1
Value of x B(50, 100 ) B(100, 200 ) P o( 12 )
0 0.605006 0.605770 0.606531
1 0.305559 0.304407 0.303265
2 0.075618 0.075719 0.075816
3 0.012221 0.012430 0.012636
Binomial and Poisson distribution (3)
Poisson distribution

1
Compare the binomial distribution B(1000, 200 ) and Poisson
distribution P o(5) graphically:
bar(0:20,binopdf(0:20,1000,0.05)) bar(0:20,poisspdf(0:20,5))
0.18 0.18

0.16 0.16

0.14 0.14

0.12 0.12

0.1 0.1
P(X=x)

P(X=x)
0.08 0.08

0.06 0.06

0.04 0.04

0.02 0.02

0 0
0 2 4 6 8 10 12 14 16 18 20 0 2 4 6 8 10 12 14 16 18 20
x x
Binomial and Poisson distribution (3)
Poisson distribution

Example
The possibility that a person carries a rare gene is 0.002. A test is done with
1000 people. Which binomial and approximate Poisson distributions should
we use?
Binomial and Poisson distribution (3)
Poisson distribution

Example
The possibility that a person carries a rare gene is 0.002. A test is done with
1000 people. Which binomial and approximate Poisson distributions should
we use?
The binomial distribution is X B(1000, 0.002) and the approximate Poisson
distribution is X P o(2).
Binomial and Poisson distribution (3)
Poisson distribution

Example
The possibility that a person carries a rare gene is 0.002. A test is done with
1000 people. Which binomial and approximate Poisson distributions should
we use?
The binomial distribution is X B(1000, 0.002) and the approximate Poisson
distribution is X P o(2).
Using both the binomial and the approximate Poisson distributions, calculate
the following probabilities in two ways:

No person has the gene:

Less than 2 people have the gene:


Binomial and Poisson distribution (3)
Poisson distribution

Example
The possibility that a person carries a rare gene is 0.002. A test is done with
1000 people. Which binomial and approximate Poisson distributions should
we use?
The binomial distribution is X B(1000, 0.002) and the approximate Poisson
distribution is X P o(2).
Using both the binomial and the approximate Poisson distributions, calculate
the following probabilities in two ways:

No person has the gene:


The binomial probability is pB (0) = 1 0.0020 (0.998)1000 = 0.1351 and
the Poisson probability is pP (0) = 20 e2 /0! = 0.1353;

Less than 2 people have the gene:


Binomial and Poisson distribution (3)
Poisson distribution

Example
The possibility that a person carries a rare gene is 0.002. A test is done with
1000 people. Which binomial and approximate Poisson distributions should
we use?
The binomial distribution is X B(1000, 0.002) and the approximate Poisson
distribution is X P o(2).
Using both the binomial and the approximate Poisson distributions, calculate
the following probabilities in two ways:

No person has the gene:


The binomial probability is pB (0) = 1 0.0020 (0.998)1000 = 0.1351 and
the Poisson probability is pP (0) = 20 e2 /0! = 0.1353;

Less than 2 people have the gene:


Binomial: PB (X < 2) = pB (0) + pB (1) = 0.4057;
Poisson: PP (X < 2) = pP (0) + pP (1) = (1 + 2) e2 = 0.4061.
Expectation and variance
Poisson distribution

The expectation and variance of a Poisson random variable are both equal
to , i.e.,
E(X) = Var(X) = .
Expectation and variance
Poisson distribution

The expectation and variance of a Poisson random variable are both equal
to , i.e.,
E(X) = Var(X) = .
Example
The number of flaws in concrete specimens is a Poisson random variable X
with parameter = 3.5.

(i) Find the standard deviation of X:

(ii) Find P (X = 4):

(iii) Find P (X > 2):


Expectation and variance
Poisson distribution

The expectation and variance of a Poisson random variable are both equal
to , i.e.,
E(X) = Var(X) = .
Example
The number of flaws in concrete specimens is a Poisson random variable X
with parameter = 3.5.
p
(i) Find the standard deviation of X: = Var(X) = 3.5 1.87;

(ii) Find P (X = 4):

(iii) Find P (X > 2):


Expectation and variance
Poisson distribution

The expectation and variance of a Poisson random variable are both equal
to , i.e.,
E(X) = Var(X) = .
Example
The number of flaws in concrete specimens is a Poisson random variable X
with parameter = 3.5.
p
(i) Find the standard deviation of X: = Var(X) = 3.5 1.87;

(3.5)4
(ii) Find P (X = 4): P (X = 4) = 4! e3.5 0.189;

(iii) Find P (X > 2):


Expectation and variance
Poisson distribution

The expectation and variance of a Poisson random variable are both equal
to , i.e.,
E(X) = Var(X) = .
Example
The number of flaws in concrete specimens is a Poisson random variable X
with parameter = 3.5.
p
(i) Find the standard deviation of X: = Var(X) = 3.5 1.87;

(3.5)4
(ii) Find P (X = 4): P (X = 4) = 4! e3.5 0.189;

(iii) Find P (X > 2):


P (X > 2) = 1 p(0) p(1) p(2)
(3.5)0 (3.5)1 3.5 (3.5)2 3.5
= 1 0! e3.5 1! e 2! e
= 1 (1 + 3.5 + 3.52 /2) e3.5 0.679 .
Adding Poisson Distributions
Poisson distribution

Property
If X P o() and Y P o() and X and Y are independent, then
X + Y P o( + ).
Adding Poisson Distributions
Poisson distribution

Property
If X P o() and Y P o() and X and Y are independent, then
X + Y P o( + ).
Example
The number of lorries per hour passing a point is modelled as a Poisson
random variable X with parameter = 4. Calculate the probability that

(i) less than 3 lorries pass in one hour:

(ii) exactly 5 lorries pass in 2 hours:

(iii) at most 1 lorry passes in 15 minutes:


Adding Poisson Distributions
Poisson distribution

Property
If X P o() and Y P o() and X and Y are independent, then
X + Y P o( + ).
Example
The number of lorries per hour passing a point is modelled as a Poisson
random variable X with parameter = 4. Calculate the probability that

(i) less than 3 lorries pass in one hour:


P (X < 3) = p(0) + p(1) + p(2) = (1 + 4 + 8) e4 = 0.238;

(ii) exactly 5 lorries pass in 2 hours:

(iii) at most 1 lorry passes in 15 minutes:


Adding Poisson Distributions
Poisson distribution

Property
If X P o() and Y P o() and X and Y are independent, then
X + Y P o( + ).
Example
The number of lorries per hour passing a point is modelled as a Poisson
random variable X with parameter = 4. Calculate the probability that

(i) less than 3 lorries pass in one hour:


P (X < 3) = p(0) + p(1) + p(2) = (1 + 4 + 8) e4 = 0.238;

(ii) exactly 5 lorries pass in 2 hours: Define Z = X + X, then


85 e8
Z P o(4 + 4) = P o(8). Hence P (Z = 5) = 5! = 0.0916;

(iii) at most 1 lorry passes in 15 minutes:


Adding Poisson Distributions
Poisson distribution

Property
If X P o() and Y P o() and X and Y are independent, then
X + Y P o( + ).
Example
The number of lorries per hour passing a point is modelled as a Poisson
random variable X with parameter = 4. Calculate the probability that

(i) less than 3 lorries pass in one hour:


P (X < 3) = p(0) + p(1) + p(2) = (1 + 4 + 8) e4 = 0.238;

(ii) exactly 5 lorries pass in 2 hours: Define Z = X + X, then


85 e8
Z P o(4 + 4) = P o(8). Hence P (Z = 5) = 5! = 0.0916;
b = X/4, then
(iii) at most 1 lorry passes in 15 minutes: Define Z
b P o(4/4) = P o(1). Hence
Z
b 1) = p(0) + p(1) = e1 + e1 = 0.736.
P (Z 0! 1!

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