support — SciPy v1.16.0 Manual (original) (raw)
scipy.stats.Uniform.
Support of the random variable
The support of a random variable is set of all possible outcomes; i.e., the subset of the domain of argument \(x\) for which the probability density function \(f(x)\) is nonzero.
This function returns lower and upper bounds of the support.
Returns:
outtuple 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.
For discrete distributions, the same table is applicable withpmf
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.
For the inverse log-functions, the same values are returned for x = log(0)
and x = log(1)
. All inverse functions returnnan
when evaluated at an argument outside the domain 0
to 1
.
References
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() (-0.5, 0.5)
For a distribution with infinite support,
X = stats.Normal() X.support() (-inf, inf)
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.]) array([0., 0.]) X.logpdf([-100., 100.]) array([-5000.91893853, -5000.91893853])
Use cases for the log-CDF and related methods are analogous.