statsmodels.sandbox.stats.multicomp.homogeneous_subsets

statsmodels.sandbox.stats.multicomp.homogeneous_subsets(vals, dcrit)[source]

recursively check all pairs of vals for minimum distance

step down method as in Newman-Keuls and Ryan procedures. This is not a closed procedure since not all partitions are checked.

Parameters:
  • vals (array_like) – values that are pairwise compared
  • dcrit (array_like or float) – critical distance for rejecting, either float, or 2-dimensional array with distances on the upper triangle.
Returns:

  • rejs (list of pairs) – list of pair-indices with (strictly) larger than critical difference
  • nrejs (list of pairs) – list of pair-indices with smaller than critical difference
  • lli (list of tuples) – list of subsets with smaller than critical difference
  • res (tree) – result of all comparisons (for checking)

this follows description in SPSS notes on Post-Hoc Tests

Because of the recursive structure, some comparisons are made several times, but only unique pairs or sets are returned.

Examples

>>> m = [0, 2, 2.5, 3, 6, 8, 9, 9.5,10 ]
>>> rej, nrej, ssli, res = homogeneous_subsets(m, 2)
>>> set_partition(ssli)
([(5, 6, 7, 8), (1, 2, 3), (4,)], [0])
>>> [np.array(m)[list(pp)] for pp in set_partition(ssli)[0]]
[array([  8. ,   9. ,   9.5,  10. ]), array([ 2. ,  2.5,  3. ]), array([ 6.])]