scipy.stats.Uniform.
variance#
- Uniform.variance(*, method=None)[source]#
Variance, a measure of dispersion
For real-line distributions, the mean is the second central moment.
The variance \(\nu\) of a random angle \(X\) is defined ([2] 29) as
\[\nu = 1 - E\left[ \cos(X - \mu) \right]\]where \(\mu\) is the circular mean.
- Parameters:
- method{None, ‘formula’, ‘transform’, ‘normalize’, ‘quadrature’, ‘cache’}
Method used to calculate the central second moment. Not all methods are available for all distributions. See
momentfor details.
See also
References
[1]Variance, Wikipedia, https://en.wikipedia.org/wiki/Variance#Absolutely_continuous_random_variable
[2]Mardia, Kanti V., and Peter E. Jupp. Directional statistics. John Wiley & Sons, 1999. DOI:10.1002/9780470316979.
Examples
Instantiate a distribution with the desired parameters:
>>> from scipy import stats >>> X = stats.Normal(mu=1., sigma=2.)
Evaluate the variance:
>>> X.variance() 4.0 >>> X.variance() == X.moment(order=2, kind='central') == X.sigma**2 True