statsmodels.stats.nonparametric.rank_compare_2ordinal

statsmodels.stats.nonparametric.rank_compare_2ordinal(count1, count2, ddof=1, use_t=True)[source]

Stochastically larger probability for 2 independent ordinal samples.

This is a special case of rank_compare_2indep when the data are given as counts of two independent ordinal, i.e. ordered multinomial, samples.

The statistic of interest is the probability that a random draw from the population of the first sample has a larger value than a random draw from the population of the second sample, specifically

p = P(x1 > x2) + 0.5 * P(x1 = x2)

Parameters:
count1 : array_like

Counts of the first sample, categories are assumed to be ordered.

count2 : array_like

Counts of the second sample, number of categories and ordering needs to be the same as for sample 1.

ddof : scalar

Degrees of freedom correction for variance estimation. The default ddof=1 corresponds to rank_compare_2indep.

use_t : bool

If use_t is true, the t distribution with Welch-Satterthwaite type degrees of freedom is used for p-value and confidence interval. If use_t is false, then the normal distribution is used.

Returns:

res – This includes methods for hypothesis tests and confidence intervals for the probability that sample 1 is stochastically larger than sample 2.

Return type:

RankCompareResult

Notes

The implementation is based on the appendix of Munzel and Hauschke (2003) with the addition of ddof so that the results match the general function rank_compare_2indep.