{ } Raw JSON

bundles / scipy 1.17.1 / scipy / stats / _probability_distribution / _ProbabilityDistribution / pdf

function

scipy.stats._probability_distribution:_ProbabilityDistribution.pdf

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

Signature

def   pdf ( self x / method )

Summary

Probability density function

Extended Summary

The probability density function ("PDF"), denoted , is the probability per unit length that the random variable will assume the value . Mathematically, it can be defined as the derivative of the cumulative distribution function :

pdf accepts x for .

Parameters

x : array_like

The argument of the PDF.

method : {None, 'formula', 'logexp'}

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

  • 'formula': use a formula for the PDF itself

  • 'logexp': evaluate the log-PDF 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 PDF evaluated at the argument x.

Notes

Suppose a continuous probability distribution has support . By definition of the support, the PDF evaluates to its minimum value of outside the support; i.e. for or . The maximum of the PDF may be less than or greater than ; since the value is a probability density, only its integral over the support must equal .

For discrete distributions, pdf returns inf at supported points and 0 elsewhere.

Examples

Instantiate a distribution with the desired parameters:
from scipy import stats
X = stats.Uniform(a=-1., b=1.)
Evaluate the PDF at the desired argument:
X.pdf(0.25)

See also

cdf
logpdf

Aliases

  • scipy.stats._distribution_infrastructure._ProbabilityDistribution.pdf