{ } Raw JSON

bundles / scipy latest / scipy / stats / _probability_distribution / _ProbabilityDistribution / support

function

scipy.stats._probability_distribution:_ProbabilityDistribution.support

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

Signature

def   support ( self )

Summary

Support of the random variable

Extended Summary

The support of a random variable is set of all possible outcomes; i.e., the subset of the domain of argument for which the probability density function is nonzero.

This function returns lower and upper bounds of the support.

Returns

out : tuple of Array

The lower and upper bounds of the support.

Notes

Suppose a continuous probability distribution has support (l, r). The following table summarizes the value returned by several methods when the argument is outside the support.

+----------------+---------------------+---------------------+
| Method         | Value for ``x < l`` | Value for ``x > r`` |
+================+=====================+=====================+
| ``pdf(x)``     | 0                   | 0                   |
+----------------+---------------------+---------------------+
| ``logpdf(x)``  | -inf                | -inf                |
+----------------+---------------------+---------------------+
| ``cdf(x)``     | 0                   | 1                   |
+----------------+---------------------+---------------------+
| ``logcdf(x)``  | -inf                | 0                   |
+----------------+---------------------+---------------------+
| ``ccdf(x)``    | 1                   | 0                   |
+----------------+---------------------+---------------------+
| ``logccdf(x)`` | 0                   | -inf                |
+----------------+---------------------+---------------------+

For discrete distributions, the same table is applicable with pmf and logpmf substituted for pdf and logpdf.

For the cdf and related methods of continuous distributions, the inequality need not be strict; i.e. the tabulated value is returned when the method is evaluated at the corresponding boundary.

The following table summarizes the value returned by the inverse methods for arguments 0 and 1, whether the distribution is continuous or discrete.

+-------------+-----------+-----------+
| Method      | ``x = 0`` | ``x = 1`` |
+=============+===========+===========+
| ``icdf(x)`` | ``l``     | ``r``     |
+-------------+-----------+-----------+
| ``icdf(x)`` | ``r``     | ``l``     |
+-------------+-----------+-----------+

For the inverse log-functions, the same values are returned for x = log(0) and x = log(1). All inverse functions return nan when evaluated at an argument outside the domain 0 to 1.

Examples

Instantiate a distribution with the desired parameters:
from scipy import stats
X = stats.Uniform(a=-0.5, b=0.5)
Retrieve the support of the distribution:
X.support()
For a distribution with infinite support,
X = stats.Normal()
X.support()
Due to underflow, the numerical value returned by the PDF may be zero even for arguments within the support, even if the true value is nonzero. In such cases, the log-PDF may be useful.
X.pdf([-100., 100.])
X.logpdf([-100., 100.])
Use cases for the log-CDF and related methods are analogous.

See also

pdf

Aliases

  • scipy.stats._distribution_infrastructure._ProbabilityDistribution.support