poissonPdf

Evaluates the Poisson probability function.

Synopsis

poissonPdf (k, theta)

Required Arguments

int k (Input)
Argument for which the Poisson distribution function is to be evaluated.
float theta (Input)
Mean of the Poisson distribution. theta must be positive.

Return Value

Function value, the probability that a Poisson random variable takes a value equal to k.

Description

Function poissonPdf evaluates the probability function of a Poisson random variable with parameter theta. theta, which is the mean of the Poisson random variable, must be positive. The probability function (with θ = theta) is

\[f(x|θ) = e^{-θ} θ^k/k!, \phantom{...} \text{ for } k = 0, 1, 2,...\]

poissonPdf evaluates this function directly, taking logarithms and using the log gamma function.

../../_images/csch11-figure2.png

Figure 11.2 — Poisson Probability Function

Example

Suppose X is a Poisson random variable with \(\theta=10\). In this example, we evaluate the probability function at 7.

from __future__ import print_function
from numpy import *
from pyimsl.stat.poissonPdf import poissonPdf

k = 7
theta = 10.0
pr = poissonPdf(k, theta)
print("The probability that X is equal to 7 is %6.4f" % pr)

Output

The probability that X is equal to 7 is 0.0901