6.8.6. statsmodels.sandbox.stats.runs

runstest

formulas for mean and var of runs taken from SAS manual NPAR tests, also idea for runstest_1samp and runstest_2samp

Description in NIST handbook and dataplot doesn’t explain their expected values, or variance

Note: There are (at least) two definitions of runs used in literature. The classical definition which is also used here, is that runs are sequences of identical observations separated by observations with different realizations. The second definition allows for overlapping runs, or runs where counting a run is also started after a run of a fixed length of the same kind.

TODO * add one-sided tests where possible or where it makes sense

6.8.6.1. Functions

cochrans_q(x) Cochran’s Q test for identical effect of k treatments
mcnemar(x[, y, exact, correction]) McNemar test
median_test_ksample(x, groups) chisquare test for equality of median/location
runstest_1samp(x[, cutoff, correction]) use runs test on binary discretized data above/below cutoff
runstest_2samp(x[, y, groups, correction]) Wald-Wolfowitz runstest for two samples
symmetry_bowker(table) Test for symmetry of a (k, k) square contingency table

6.8.6.2. Classes

Runs(x) class for runs in a binary sequence
RunsProb distribution of success runs of length k or more (classical definition)
TotalRunsProb(n0, n1) class for the probability distribution of total runs