Abstract
The inference of models from one-dimensional ordered data subject to noise is a fundamental and ubiquitous task in the physical and life sciences. A prototypical example is the analysis of small- and wide-angle solution scattering experiments using x-rays (SAXS/WAXS) or neutrons (SANS). In such cases, it is common practice to check the quality of a fit by using Pearson's chi-square test, which ignores the order of the data. We usually plot the residuals and check visually for systematic deviations without quantifying them. To quantify these deviations, we developed test statistics based on the distributions of the lengths of the runs of the signs of the residuals. Specifically, we use the probability of run-length distributions, for which we provide analytical expressions, to rank them and to calculate their P-values. We introduce the Shannon information distribution as an elegant and versatile tool for calculating P-values. We find that these distributions follow shifted gamma distributions, such that they are summarized by three parameters only. We show for a set of six models that our test statistics are more powerful than Pearson's chi-square test and common sign-based tests. We provide an open source Python 3 implementation of our tests free of charge at https://github.com/bio-phys/hplusminus.