{ } Raw JSON

bundles / scipy 1.18.0 / scipy / stats / _probability_distribution / _ProbabilityDistribution / pmf

function

scipy.stats._probability_distribution:_ProbabilityDistribution.pmf

source: /scipy/stats/_probability_distribution.py:993

Signature

def pmf(self, x, /, method = None)

Summary

Probability mass function

Extended Summary

The probability mass function ("PMF"), denoted , is the probability that the random variable will assume the value .

pmf accepts x for .

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.

Notes

Suppose a discrete probability distribution has support over the integers . By definition of the support, the PMF evaluates to its minimum value of for non-integral and for outside the support; i.e. for or .

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

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.24609375000000003)

See also

cdf
logpmf

Aliases

  • scipy.stats._distribution_infrastructure._ProbabilityDistribution.pmf