The reverse arrangement test was first introduced by . The following examples are directly inspired from  and  where the stationarity of a signal is investigated. More specifically, the test evaluates the existence of a non-negligible trend. Only the 95% confidence interval is used here. All the credit go to the authors for the original methods.
 Julius S. Bendat, Allan G. Piersol, Random Data: Analysis and Measurement Procedures, 4th Edition; ISBN: 978-0-470-24877-5
 Homayon Aryan, Keith Yearby, Michael Balikhin, Oleksiy Agapitov, Vladimir Krasnoselskikh, Richard Boynton, Statistical study of chorus wave distributions in the inner magnetosphere usingAeand solar wind parameters, Journal of Geophysical Research: Space Physics, 2014, 119, 8, 6131
 Travis W. Beck, Terry J. Housh, Joseph P. Weir, Joel T. Cramer, Vassilios Vardaxis, Glen O. Johnson, Jared W. Coburn, Moh H. Malek, Michelle Mielke, An examination of the Runs Test, Reverse Arrangements Test, and modified Reverse Arrangements Test for assessing surface EMG signal stationarity, Journal of Neuroscience Methods, Volume 156, Issues 1–2, 30 September 2006, Pages 242-248, ISSN 0165-0270, http://dx.doi.org/10.1016/j.jneumeth.2006.03.011.
the "rng(1)" is used to ensure the reproducibility of the examples. As far as I know, the default random number generator in the recent versions of Matlab is "twister". Therefore, writing "rng(1)" or "rng(1,'twister')" should produce the same results. In addition, there is no reason for the output of the function RA.m to be affected by the type of random number generator used, although the examples will not be perfectly reproduced in this case. Note that if you use an old Matlab version, e.g. MATLAB 4.0., the default random number generator is not "twister".
In Example, need to modify rng(1) to rng(1,'twister'). Otherwise works well.
function description + some debugging
-type + picture
Create scripts with code, output, and formatted text in a single executable document.