Tests a numeric series for randomness by dichotomizing around a
threshold and counting runs, with the exact normal approximation.
Reproduces randtests::runs.test.
Usage
morie_runs_test(x, threshold = stats::median(x), alternative = "two.sided")References
Wald, A., & Wolfowitz, J. (1940). On a test whether two samples are from the same population. Annals of Mathematical Statistics, 11(2), 147-162.
Examples
if (requireNamespace("randtests", quietly = TRUE)) {
set.seed(1); morie_runs_test(rnorm(50))$p.value
}
#> [1] 1
