bundles / scipy latest / scipy / stats / _morestats / _calc_uniform_order_statistic_medians
function
scipy.stats._morestats:_calc_uniform_order_statistic_medians
source: build-install/usr/lib/python3.14/site-packages/scipy/stats/_morestats.py:423
Signature
def _calc_uniform_order_statistic_medians(n)Summary
Approximations of uniform order statistic medians.
Parameters
n: intSample size.
Returns
v: 1d float arrayApproximations of the order statistic medians.
Examples
Order statistics of the uniform distribution on the unit interval are marginally distributed according to beta distributions. The expectations of these order statistic are evenly spaced across the interval, but the distributions are skewed in a way that pushes the medians slightly towards the endpoints of the unit interval:import numpy as np n = 4 k = np.arange(1, n+1) from scipy.stats import beta a = k b = n-k+1 beta.mean(a, b)✓
array([0.2, 0.4, 0.6, 0.8])
beta.median(a, b)
✗array([0.1591 , 0.38573, 0.61427, 0.8409 ])The Filliben approximation uses the exact medians of the smallest and greatest order statistics, and the remaining medians are approximated by points spread evenly across a sub-interval of the unit interval:
from scipy.stats._morestats import _calc_uniform_order_statistic_medians
✓_calc_uniform_order_statistic_medians(n)
✗array([0.1591 , 0.38545, 0.61455, 0.8409 ])This plot shows the skewed distributions of the order statistics of a sample of size four from a uniform distribution on the unit interval:
import matplotlib.pyplot as plt x = np.linspace(0.0, 1.0, num=50, endpoint=True) pdfs = [beta.pdf(x, a[i], b[i]) for i in range(n)]✓
plt.figure() plt.plot(x, pdfs[0], x, pdfs[1], x, pdfs[2], x, pdfs[3])✗
[<matplotlib.lines.Line2D object at 0x7f3f60794ec0>, <matplotlib.lines.Line2D object at 0x7f3f60797380>, <matplotlib.lines.Line2D object at 0x7f3f6854a900>, <matplotlib.lines.Line2D object at 0x7f3f68549be0>]
Aliases
scipy.stats._morestats._calc_uniform_order_statistic_medians