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), survival function (SF), inverse CDF (quantile/ICDF), mean or variance for a given value. 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, SF, ICDF, 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", "icdf", "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.
  • icdf: Inverse CDF (quantile) for probability 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: Inverse CDF (ICDF) for probability k=0.5, mu=2

Inputs:

kmumodeloc
0.52icdf0

Excel formula:

=POISSON_DIST(0.5, 2, "icdf", 0)

Expected output:

Result
2

Example 5: Inverse Survival Function (ISF) for probability k=0.5, mu=2

Inputs:

kmumodeloc
0.52isf0

Excel formula:

=POISSON_DIST(0.5, 2, "isf", 0)

Expected output:

Result
2

Example 6: Mean, Variance, and Standard Deviation

Inputs:

kmumodeloc
02mean0
02var0
02std0

Excel formulas:

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

Expected outputs:

Result
2
2
1.4142

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, ICDF, ISF, mean, variance, std, or median. Args: k: Value(s) at which to evaluate (float or 2D list). mu: Mean (float, required). mode: Output type (str, default "pmf"). One of "pmf", "cdf", "sf", "icdf", "isf", "mean", "var", "std", "median". 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", "icdf", "isf", "mean", "var", "std", "median"]: return "Invalid input: mode must be one of 'pmf', 'cdf', 'sf', 'icdf', 'isf', 'mean', 'var', 'std', or 'median'." # Helper to process k (scalar or 2D list) def process_k(val): try: return float(val) except Exception: return None # Handle mean/var/std/median if mode == "mean": return mu_val if mode == "var": return mu_val if mode == "std": return float(scipy_poisson.std(mu_val, loc=loc_val)) if mode == "median": return float(scipy_poisson.median(mu_val, loc=loc_val)) # PMF, CDF, SF, ICDF, ISF 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)) elif mode == "icdf": return float(scipy_poisson.ppf(kval, mu_val, loc=loc_val)) elif mode == "isf": return float(scipy_poisson.isf(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 Demo

Example Workbook

Link to Workbook

Last updated on