You are on page 1of 3

NDSU

Poisson Distribution

ECE 341

Poisson Distribution
SciLab Example of a Poisson Distribution:
Example 1: Plot the probability density function for a binomial distribution with
n = 100
p = 0.05
np = 5

100
100x
x
f 1 (x) =
(0.05) (0.95)
x
Compare this to a Poisson approximation with

= np
f 2 (x) =

1
x!

5 x e 5

SciLab Code:
First, generate the binomial pdf. Use a gamma funciton rather than factorials so that the resulting pdf is
continuous (it's easier to compare graphs this way.)
-->x = [0:0.01:10]';
-->f1 = gamma(100) ./ (gamma(x) .* gamma(100-x)) .* (0.05 .^ x) .* (0.95 .^
(100-x) );

Next, generate the Poisson approximation:


-->f2 = ( 1 ./ gamma(x) ) .* (5 .^ x) .* exp(-5);

Throw in a fudge factor so that the area is one. I'm not sure why it isn't, but I do know the area has to be one.
-->f1 = f1 / ( sum(f1) * 0.01 );
-->f2 = f2 / ( sum(f2) * 0.01 );

Plot the resulting pdf's:


-->plot(x,f1,x,f2)
-->xlabel('x');
-->ylabel('f(x)')
-->title('Binomial vs. Poisson pdf')

JSG

rev September 26, 2011

NDSU

Poisson Distribution

ECE 341

Example 2: Plot the probability density function for a binomial distribution with
n = 10,000
p = 0.000 5
np = 5
This doesn't work really well using a Binomial pdf:

10, 000
f(x) =
x

10,000x
x
(0.0005) (0.9995)

10,000! is a really big number.

Instead, use a Poisson distribution:

f(x) =

1
x!

x e

were

= np
so that the two distributions have the same expected value:

f(x)

JSG

1
x!

5 x e 5

rev September 26, 2011

NDSU

Poisson Distribution

ECE 341

SciLab Code:
-1->x = [0:0.01:10]';
-1->f = ( 1 ./ gamma(x) ) .* (5 .^ x) .* exp(-5);
-1->plot(x,f)
-1->N = [1:10:1001]';
-1->plot(x(N),f(N),'.')
-1->N = [1:100:1001]';
-1->plot(x,f)
-1->plot(x(N),f(N),'.')

Resulting pdf:

pdf for a Poisson distribution with = 5


note:
I used a gamma() function rather than factorial(). Factorial only works for integers. gamma() is a
continuous function, equal to factorial at integer values. This creates a continuous plot.
The values at the integers are denoted with dots.
You could have a Poisson distribution with fractional results. For example, if n = 10,000 voting districts
with 1000 people per district, the number of people would be a discrete function with a resolution of 0.001.

JSG

rev September 26, 2011

You might also like