scipy.stats.VonMises.

median#

VonMises.median(*, method=None)[source]#

Median, a measure of location

If a continuous, real-line random variable \(X\) has probability \(0.5\) of taking on a value less than \(m\), then \(m\) is the median.

More generally, the median of a real-line random variable is a value \(m\) for which:

\[P(X ≤ m) ≤ 0.5 ≥ P(X ≥ m)\]

For discrete random variables, the median may not be unique, in which case the smallest value satisfying the definition is reported.

The median of a circular random variable \(X\) is defined ([2] 30) as an angle \(x'\) which minimizes

\[E\left[\pi - | \pi - |X - x'|| \right].\]
Parameters:
method{None, ‘formula’, ‘icdf’}

The strategy used to evaluate the median. By default (None), the infrastructure chooses between the following options, listed in order of precedence.

  • 'formula': use a formula for the median

  • 'icdf': evaluate the inverse CDF of 0.5 (real-line distributions only)

  • 'optimization': evaluate the inverse CDF of 0.5 (circular distributions only)

Not all method options are available for all distributions. If the selected method is not available, a NotImplementedError will be raised.

Returns:
outarray

The median

See also

mean
mode
icdf

References

[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.Uniform(a=0., b=10.)

Compute the median:

>>> X.median()
np.float64(5.0)
>>> X.median() == X.icdf(0.5) == X.iccdf(0.5)
True