Skip to main content
`Ctrl`+`K`
scipy.stats.Mixture.

# pmf

Mixture.pmf(x, /, *, method=None)

  Probability mass function

  The probability mass function (“PMF”), denoted \(f(x)\), is the probability that the random variable \(X\) will assume the value \(x\).

  \[f(x) = P(X = x)\]

  `pmf` accepts x for \(x\).

  Parameters:
    x array_like

      The argument of the PMF.

    method{None, ‘formula’, ‘logexp’}

      The strategy used to evaluate the PMF. By default (`None`), the infrastructure chooses between the following options, listed in order of precedence.

      - `'formula'`: use a formula for the PMF itself

      - `'logexp'`: evaluate the log-PMF and exponentiate

      Not all method options are available for all distributions. If the selected method is not available, a `NotImplementedError` will be raised.

  Returns:
    out array

      The PMF evaluated at the argument x.

  See also

  `cdf`
  `logpmf`

  Notes

  Suppose a discrete probability distribution has support over the integers \({l, l+1, ..., r-1, r}\). By definition of the support, the PMF evaluates to its minimum value of \(0\) for non-integral \(x\) and for \(x\) outside the support; i.e. for \(x < l\) or \(x > r\).

  For continuous distributions, `pmf` returns `0` at all real arguments.

  References

  [1]

  Probability mass function, Wikipedia, https://en.wikipedia.org/wiki/Probability_mass_function

  Examples

  Instantiate a distribution with the desired parameters:

      >>> from scipy import stats
      >>> X = stats.Binomial(n=10, p=0.5)

  Evaluate the PMF at the desired argument:

      >>> X.pmf(5)
      np.float64(0.24609375)