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

# pdf

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

  Probability density function

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

  \[f(x) = \frac{d}{dx} F(x)\]

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

  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.

  See also

  `cdf`
  `logpdf`

  Notes

  Suppose a continuous probability distribution has support \([l, r]\). By definition of the support, the PDF evaluates to its minimum value of \(0\) outside the support; i.e. for \(x < l\) or \(x > r\). The maximum of the PDF may be less than or greater than \(1\); since the value is a probability density, only its integral over the support must equal \(1\).

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

  References

  [1]

  Probability density function, Wikipedia, https://en.wikipedia.org/wiki/Probability_density_function

  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)
      0.5