support#
- Uniform.support()[source]#
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.
See also
Notes
Suppose a continuous probability distribution has support
(l, r)
. The following table summarizes the value returned by methods ofContinuousDistribution
for arguments 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 the
cdf
and related methods, 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 of
ContinuousDistribution
for arguments at the boundaries of the domain0
to1
.Method
x = 0
x = 1
icdf(x)
l
r
icdf(x)
r
l
For the inverse log-functions, the same values are returned for for
x = log(0)
andx = log(1)
. All inverse functions returnnan
when evaluated at an argument outside the domain0
to1
.References
[1]Support (mathematics), Wikipedia, https://en.wikipedia.org/wiki/Support_(mathematics)
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.