{ } Raw JSON

bundles / scipy 1.17.1 / scipy / stats / _morestats / _calc_uniform_order_statistic_medians

function

scipy.stats._morestats:_calc_uniform_order_statistic_medians

source: /scipy/stats/_morestats.py :406

Signature

def   _calc_uniform_order_statistic_medians ( n )

Summary

Approximations of uniform order statistic medians.

Parameters

n : int

Sample size.

Returns

v : 1d float array

Approximations 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)
beta.median(a, b)
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)
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])

Aliases

  • scipy.stats._morestats._calc_uniform_order_statistic_medians