Microsoft KB Archive/87862

= ATP Definition: POISSON =

Article ID: 87862

Article Last Modified on 11/16/2006

-

APPLIES TO


 * Microsoft Excel 97 Standard Edition
 * Microsoft Excel 95 Standard Edition
 * Microsoft Excel 5.0 Standard Edition
 * Microsoft Excel 98 for Macintosh

-



This article was previously published under Q87862



SUMMARY
The versions of Microsoft Excel listed at the beginning of this article provide a set of special analysis tools called the Analysis ToolPak. This article is part of a series of articles that provides information about the underlying formulas used in the Analysis ToolPak functions.

This article covers the following function:

  POISSON(x,mean,cumulative)



MORE INFORMATION
The POISSON function returns the result of the Poisson probability distribution function for a particular value of the random variable X. It follows the form &quot;Poisson(x,mean,cumulative)&quot;, where:

  x = number of events mean = expected value or average of the distribution cumulative = logical value specifying whether to return the cumulative distribution or the probability mass function.

The Microsoft Excel function approximates the Poisson distribution with the following code:

#include 

#define PI 3.141592654

float poidev(xm,idum) float xm; int *idum;

{

static float sq,alxm,g,oldm=(-1.0) float em,t,y; float ran1,gammln;

if (xm < 12.0) { if (xm != oldm) { oldm=xm; g=exp(-xm); }                  em = -1; t = 1.0; do { em += 1.0; t *= ran1(idum); } while (t > g); } else { if (xm != oldm) { oldm=xm; sq=sqrt(2.0*xm); alxm=log(xm); g=xm*alxm-gammln(xm+1.0); }                  do { do { y=tan(PI*ran1(idum)); em=sq*y*xm; } while (em < 0.0); em=floor(em); t=0.9*(1.0+y*y)*exp(em*alxm-gammln(em+1.0)-g); } while ran1(idum) < t);          }           return em;

}

NOTE: The corresponding code for the gammln function can be found by querying on keywords &quot;gammln&quot; and &quot;code&quot;.

The POISSON function returns the result of the Poisson probability distribution function for a particular value of the random variable X. The Poisson distribution is useful in predicting the number of events over a specific time period; for example the number of ships arriving at a pier between noon and midnight. Given that the mean number of arrivals was 5, to calculate the probability that exactly 3 ships would arrive, use POISSON(3,5,false). To find the probability that 3 or less ships would arrive, use POISSON(3,5,true).

