Skip to Content

POISSON_DIST

Overview

The POISSON_DIST function computes values related to the Poisson distribution, a discrete probability distribution that expresses the probability of a given number of events occurring in a fixed interval of time or space, given the average number of times the event occurs over that interval. This function can return the probability mass function (PMF), cumulative distribution function (CDF), or survival function (SF) for a given value, as well as the mean or variance of the distribution. The Poisson distribution is defined by the parameter μ\mu (mean rate of occurrence). The probability mass function is:

f(k)=exp(μ)μkk!f(k) = \exp(-\mu) \frac{\mu^k}{k!}

where k0k \ge 0 and μ0\mu \ge 0.

For more details, see the scipy.stats.poisson documentation.

This example function is provided as-is without any representation of accuracy.

Usage

To use the function in Excel:

=POISSON_DIST(k, mu, [mode], [loc])
  • k (float or 2D list, required): Value(s) at which to evaluate the distribution. For PMF, CDF, and SF, this is the event count. For ‘mean’ or ‘var’ mode, this is ignored and can be set to 0.
  • mu (float, required): The mean (expected value, μ\mu) of the distribution. Must be 0\geq 0.
  • mode (str, optional, default=“pmf”): Output type. One of "pmf", "cdf", "sf", "mean", or "var".
  • loc (float, optional, default=0): Location parameter (shifts the distribution).

The function returns a scalar or 2D list of floats (for array input), or an error message (string) if the input is invalid. The output depends on the selected mode:

  • pmf: Probability mass function at k.
  • cdf: Cumulative distribution function at k.
  • sf: Survival function (1 - CDF) at k.
  • mean: Mean of the distribution.
  • var: Variance of the distribution.

Examples

Example 1: PMF at k=3, mu=2

Inputs:

kmumodeloc
32pmf0

Excel formula:

=POISSON_DIST(3, 2, "pmf", 0)

Expected output:

Result
0.1804

Example 2: CDF at k=3, mu=2

Inputs:

kmumodeloc
32cdf0

Excel formula:

=POISSON_DIST(3, 2, "cdf", 0)

Expected output:

Result
0.8571

Example 3: Survival Function at k=3, mu=2

Inputs:

kmumodeloc
32sf0

Excel formula:

=POISSON_DIST(3, 2, "sf", 0)

Expected output:

Result
0.1429

Example 4: Mean and Variance

Inputs:

kmumodeloc
02mean0
02var0

Excel formulas:

=POISSON_DIST(0, 2, "mean", 0) =POISSON_DIST(0, 2, "var", 0)

Expected outputs:

Result
2
2

Python Code

from scipy.stats import poisson as scipy_poisson def poisson_dist(k, mu, mode="pmf", loc=0): """ Compute Poisson distribution values: PMF, CDF, SF, mean, or variance. Args: k: Value(s) at which to evaluate (float or 2D list). mu: Mean of the distribution (float, >=0). mode: Output type: 'pmf', 'cdf', 'sf', 'mean', or 'var'. loc: Location parameter (float, default 0). Returns: Scalar or 2D list of floats, or error message (str) if invalid. This example function is provided as-is without any representation of accuracy. """ # Validate mu try: mu_val = float(mu) if mu_val < 0: return "Invalid input: mu must be >= 0." except Exception: return "Invalid input: mu must be a number." # Validate loc try: loc_val = float(loc) except Exception: return "Invalid input: loc must be a number." # Validate mode if not isinstance(mode, str) or mode not in ["pmf", "cdf", "sf", "mean", "var"]: return "Invalid input: mode must be one of 'pmf', 'cdf', 'sf', 'mean', or 'var'." # Helper to process k (scalar or 2D list) def process_k(val): try: return float(val) except Exception: return None # Handle mean/var if mode == "mean": return mu_val if mode == "var": return mu_val # PMF, CDF, SF def compute(val): kval = process_k(val) if kval is None: return "Invalid input: k must be a number." if mode == "pmf": return float(scipy_poisson.pmf(kval, mu_val, loc=loc_val)) elif mode == "cdf": return float(scipy_poisson.cdf(kval, mu_val, loc=loc_val)) elif mode == "sf": return float(scipy_poisson.sf(kval, mu_val, loc=loc_val)) # 2D list or scalar if isinstance(k, list): # 2D list if not all(isinstance(row, list) for row in k): return "Invalid input: k must be a scalar or 2D list." result = [] for row in k: result_row = [] for val in row: out = compute(val) if isinstance(out, str): return out result_row.append(out) result.append(result_row) return result else: return compute(k)

Live Notebook

Edit this function in a live notebook.

Live Demo

Last updated on