Joint distribution for number of crossings and longest run in independent Bernoulli observations. The R package crossrun

Autoři: Tore Wentzel-Larsen aff001;  Jacob Anhøj aff003
Působiště autorů: Centre for Child and Adolescent Mental Health, Eastern and Southern Norway, Oslo, Norway aff001;  Norwegian Centre of Violence and Traumatic Stress Studies, Oslo, Norway aff002;  Rigshospitalet, University of Copenhagen, Copenhagen, Denmark aff003
Vyšlo v časopise: PLoS ONE 14(10)
Kategorie: Research Article
prolekare.web.journal.doi_sk: 10.1371/journal.pone.0223233


The R package crossrun computes the joint distribution of the number of crossings and the longest run in a sequence of independent Bernoulli observations. The main intended application is statistical process control where the joint distribution may be used for systematic investigation, and possibly refinement, of existing rules for distinguishing between signal and noise. While the crossrun vignette is written to assist in practical use, this article gives a hands-on explanation of why the procedures works. The article also includes a discussion of limitations of the present version of crossrun together with an outline of ongoing work to meet these limitations. There is more to come, and it is necessary to grasp the basic ideas behind the procedure implemented both to understand these planned extensions, and how presently implemented rules in statistical process control, based on the number of crossings and the longest run, may be refined.

Klíčová slova:

Charts – Noise reduction – Probability distribution – Statistical data – Statistical distributions – Statistical signal processing – Binomials – Wildebeest


1. Anhøj J. Diagnostic Value of Run Chart Analysis: Using Likelihood Ratios to Compare Run Chart Rules on Simulated Data Series. PLos ONE 2015. Mar 23; 10(3): e0121349. 25799549

2. R Core Team (2014) R: A language and Environment for Statistical Computing. Version 3.6.0 or higher [software]. 2019 Apr 26. Available from

3. Wentzel-Larsen T, Anhøj J. crossrun: Joint Distribution of Number of Crossings and Longest Run. Version 0.1.0. [software]. 2018 Oct 10. Available from

4. Schilling MF. The Surprising Predictability of Long Runs. Mathematics Magazine. 2012. Dec 22; 85 (2):

5. Fazekas I, Karácsony Z, Libor Z. Longest runs in coin tossing. Comparison of recursive formulae, asymptotic theorems, computer simulations. Acta Universitatis Sapientiae. Mathematica. 2010 Jan; 2 (2): 215–228.

6. Maechler M. Rmpfr: R MPFR—Multiple Precision Floating-Point Reliable. Version 0.7–1 or higher [software]. 2018 Jul.

7. Hanrot G, Lefèvre V, Pélissier P, Théveny P, Zimmermann P. The MPFR Library Version 4.0.2 or higher. [software]. 2019 Jan 31.

8. Anhøj J, Olesen AV. Run charts revisited: A simulation study of run chart rules for detection of non-random variation in health care processes. PLoS ONE. 2014 Nov 25; 9(11): e113825. 25423037

9. Anhøj J, Wentzel-Larsen T. Sense and sensibility: on the diagnostic value of control chart rules for detection of shifts in time series data. BMC Medical Research Methodology. Oct 3; 18(1): 100. 30285737

Článok vyšiel v časopise


2019 Číslo 10