{ } Raw JSON

bundles / scipy 1.17.1 / scipy / stats / _stats_py / tiecorrect

function

scipy.stats._stats_py:tiecorrect

source: /scipy/stats/_stats_py.py :8257

Signature

def   tiecorrect ( rankvals )

Summary

Tie correction factor for Mann-Whitney U and Kruskal-Wallis H tests.

Parameters

rankvals : array_like

A 1-D sequence of ranks. Typically this will be the array returned by rankdata.

Returns

factor : float

Correction factor for U or H.

Notes

Array API Standard Support

tiecorrect has experimental support for Python Array API Standard compatible backends in addition to NumPy. Please consider testing these features by setting an environment variable SCIPY_ARRAY_API=1 and providing CuPy, PyTorch, JAX, or Dask arrays as array arguments. The following combinations of backend and device (or other capability) are supported.

====================  ====================  ====================
Library               CPU                   GPU
====================  ====================  ====================
NumPy                 ✅                     n/a                 
CuPy                  n/a                   ⛔                   
PyTorch               ⛔                     ⛔                   
JAX                   ⛔                     ⛔                   
Dask                  ⛔                     n/a                 
====================  ====================  ====================

See dev-arrayapi for more information.

Examples

from scipy.stats import tiecorrect, rankdata
tiecorrect([1, 2.5, 2.5, 4])
ranks = rankdata([1, 3, 2, 4, 5, 7, 2, 8, 4])
ranks
tiecorrect(ranks)

See also

kruskal

Kruskal-Wallis H test

mannwhitneyu

Mann-Whitney rank test

rankdata

Assign ranks to the data

Aliases

  • scipy.stats.tiecorrect