WaldWolfowitz runstest for two samples
This tests whether two samples come from the same distribution.
Parameters:  x : array_like
y : array_like (optional)
groups : array_like
correction: bool :


Returns:  z_stat : float
pvalue : float

See also
runs_test_1samp, Runs, RunsProb
Notes
WaldWolfowitz runs test.
If there are ties, then then the test statistic and pvalue that is reported, is based on the higher pvalue between sorting all tied observations of the same group
This test is intended for continuous distributions SAS has treatment for ties, but not clear, and sounds more complicated (minimum and maximum possible runs prevent use of argsort) (maybe it’s not so difficult, idea: add small positive noise to first one, run test, then to the other, run test, take max(?) pvalue  DONE This gives not the minimum and maximum of the number of runs, but should be close. Not true, this is close to minimum but far away from maximum. maximum number of runs would use alternating groups in the ties.) Maybe adding random noise would be the better approach.
SAS has exact distribution for sample size <=30, doesn’t look standard but should be easy to add.
currently twosided test only
This has not been verified against a reference implementation. In a short Monte Carlo simulation where both samples are normally distribute, the test seems to be correctly sized for larger number of observations (30 or larger), but conservative (i.e. reject less often than nominal) with a sample size of 10 in each group.