This is a pre-release version (2.0.0.dev0+git20260907.41eeb59).Go to latest (1.18.0)
{ } Raw JSON

bundles / scipy 2.0.0.dev0+git20260907.41eeb59 / scipy / stats / _mstats_extras / compare_medians_ms

function

scipy.stats._mstats_extras:compare_medians_ms

source: build-install/usr/lib/python3.14/site-packages/scipy/stats/_mstats_extras.py:394

Signature

def compare_medians_ms(group_1, group_2, axis = None)

Summary

Compares the medians from two independent groups along the given axis.

Extended Summary

The comparison is performed using the McKean-Schrader estimate of the standard error of the medians.

Parameters

group_1 : array_like

First dataset. Has to be of size >=7.

group_2 : array_like

Second dataset. Has to be of size >=7.

axis : int, optional

Axis along which the medians are estimated. If None, the arrays are flattened. If axis is not None, then group_1 and group_2 should have the same shape.

Returns

compare_medians_ms : {float, ndarray}

If axis is None, then returns a float, otherwise returns a 1-D ndarray of floats with a length equal to the length of group_1 along axis.

Examples

from scipy import stats
a = [1, 2, 3, 4, 5, 6, 7]
b = [8, 9, 10, 11, 12, 13, 14]
✓
stats.mstats.compare_medians_ms(a, b, axis=None)
✗
np.float64(1.0693225866553746e-05)
The function is vectorized to compute along a given axis.
import numpy as np
rng = np.random.default_rng()
x = rng.random(size=(3, 7))
y = rng.random(size=(3, 8))
✓
stats.mstats.compare_medians_ms(x, y, axis=1)
✗
array([0.31771, 0.24629, 0.27995])

Aliases

  • scipy.stats._mstats_extras.compare_medians_ms