^{1}

^{2}

^{*}

^{2}

^{3}

^{4}

^{1}

^{2}

^{1}

^{2}

^{3}

^{4}

Edited by: Cristina Zogmaister, University of Milano-Bicocca, Italy

Reviewed by: Alessandro Giuliani, National Institute of Health (ISS), Italy; Haydar Demirhan, RMIT University, Australia

This article was submitted to Quantitative Psychology and Measurement, a section of the journal Frontiers in Psychology

This is an open-access article distributed under the terms of the Creative Commons Attribution License (CC BY). The use, distribution or reproduction in other forums is permitted, provided the original author(s) and the copyright owner(s) are credited and that the original publication in this journal is cited, in accordance with accepted academic practice. No use, distribution or reproduction is permitted which does not comply with these terms.

The Random Number Generation (RNG) task has a long history in neuropsychology as an assessment procedure for executive functioning. In recent years, understanding of human (executive) behavior has gradually changed from reflecting a static to a dynamic process and this shift in thinking about behavior gives a new angle to interpret test results. However, this shift also asks for different methods to process random number sequences. The RNG task is suited for applying non-linear methods needed to uncover the underlying dynamics of random number generation. In the current article we present RandseqR: an R-package that combines the calculation of classic randomization measures and Recurrence Quantification Analysis. RandseqR is an easy to use, flexible and fast way to process random number sequences and readies the RNG task for current scientific and clinical use.

The Random Number Generation (RNG) task has potential as an easy to administer and concise assessment tool of executive functioning (EF). The rationale behind the RNG paradigm is simple: it requires executive control (i.e., inhibition of prepotent responses and monitoring of working memory content) to avoid deterministic (i.e., non-random) behavior. Over the years, several measures have been proposed that quantify RNG performance based on deviations from mathematical randomness. Research has shown that these randomization measures could be attributed to different aspects of EF, namely inhibition of prepotent responses and updating of working memory (Towse and Neil,

In general, randomization measures are not sensitive to a disruption of the temporal structure of a sequence. In a large pool of experimental and simulated time-series (including random sequences), Giuliani et al. (

Quantifying the performance on the RNG task through calculating randomization measures is an onerous task. Two decades ago, Towse and Neil (

For the reproduction of the randomization measures, the source code of the

To smooth out the output in

A quantitative description of recurrence is given by the following RQA measures: Recurrence Rate (RR), Determinism (DET), Laminarity (LAM), maximal diagonal line length (Lmax), mean diagonal line length (Lmean), entropy of diagonal line length distribution (Lentr), maximal vertical line length (Vmax), Trapping Time (TT), and entropy of vertical line length distribution (Ventr). For a full explanation of these RQA measures, see Marwan et al. (

For a tutorial on RQA in R, see Wallot (

where _{i} is the number of occurrences of the

Like redundancy,

where _{ij} is the frequency count of all observed diagrams and _{i} is the number of occurrences of the

where

_{ij} is the frequency count of all observed diagrams at time lag 2.

_{i} response and the _{i−1} response).

and adjacency is calculated for both ascending and descending diagrams as well as a total adjacency score.

The denominator is the expected amount of turning points in a sequence of length

The intervals between turning points are called

To explain the concept of recurrence, consider an auto-recurrence plot (auto-RP). An auto-RP is created by plotting a number sequence

where

where

where _{l} is the amount of diagonal line structures in the recurrence plot, and Lmean is calculated as:

where

where _{v} is the number of vertical line structures in the recurrence plot, and TT is calculated as:

In the following section, we illustrate the randseqR package based on several computer-generated random sequences: random number sequences from 1 to 9 with a length of respectively 50, 100, 275, and 550 numbers, a sequence of 275 random letters and a sequence of 100 coinflips (the sequences were all generated using the base R

where

The randomization functions in randseqR have two mandatory terms:

where

where

were

RNG output for RGcalc, RandseqR (classical), and RandseqR (default).

S50 | 3.289 | 3.289 | 0.033 |

S100 | 2.402 | 2.403 | 0.024 |

S275 | 0.374 | 0.374 | 0.004 |

S550 | 0.453 | 0.453 | 0.005 |

Letters | 1.565 | 1.565 | 0.016 |

Coinflip | 0.116 | 0.115 | 0.001 |

S50 | 0.223 | 0.223 | 0.208 |

S100 | 0.295 | 0.295 | 0.286 |

S275 | 0.396 | 0.396 | 0.393 |

S550 | 0.486 | 0.486 | 0.485 |

Letters | 0.117 | 0.187 | 0.183 |

Coinflip | 0.823 | 0.823 | 0.812 |

S50 | 55.000 | 55.000 | 0.550 |

S100 | 35.000 | 35.000 | 0.350 |

S275 | 1.250 | 1.250 | 0.012 |

S550 | 0.000 | 0.000 | 0.000 |

Letters | 67.407 | 68.593 | 0.686 |

Coinflip | 0.000 | 0.000 | 0.000 |

S50 | 0.176 | 0.177 | 0.177 |

S100 | 0.279 | 0.279 | 0.279 |

S275 | 0.387 | 0.387 | 0.387 |

S550 | 0.489 | 0.489 | 0.489 |

Letters | 0.116 | 0.178 | 0.178 |

Coinflip | 0.802 | 0.802 | 0.802 |

S50 | 103.125 | 103.125 | 0.031 |

S100 | 96.429 | 96.429 | −0.036 |

S275 | 91.758 | 91.758 | −0.082 |

S550 | 93.339 | 93.339 | −0.067 |

Letters | 96.154 | 96.154 | −0.038 |

Coinflip | 78.061 | 78.061 | −0.219 |

S50 | 0.129 | NA | 0.451 |

S100 | 0.288 | NA | 0.906 |

S275 | 0.739 | NA | 0.781 |

S550 | 0.845 | NA | 0.770 |

Letters | 0.993 | NA | 0.655 |

Coinflip | 0.000 | NA | 1.210 |

S50 | 27.000 | 27.000 | 27.000 |

S100 | 22.500 | 22.500 | 22.500 |

S275 | 25.100 | 25.100 | 25.100 |

S550 | 25.950 | 25.952 | 25.952 |

Letters | 91.330 | 91.333 | 91.333 |

Coinflip | 2.850 | 2.853 | 2.853 |

S50 | 6.000 | 6.000 | 0.060 |

S100 | 8.000 | 8.000 | 0.070 |

S275 | 10.180 | 10.182 | 0.102 |

S550 | 8.910 | 8.909 | 0.089 |

Letters | 6.180 | 6.182 | 0.062 |

Coinflip | 26.000 | 26.000 | 0.260 |

S50 | 16.000 | 16.000 | 0.160 |

S100 | 7.000 | 7.000 | 0.070 |

S275 | 8.730 | 8.727 | 0.087 |

S550 | 11.820 | 11.818 | 0.118 |

Letters | 4.730 | 4.727 | 0.047 |

Coinflip | 26.000 | 26.000 | 0.260 |

S50 | 22.000 | 22.000 | 0.220 |

S100 | 15.000 | 15.000 | 0.140 |

S275 | 18.910 | 18.909 | 0.189 |

S550 | 20.730 | 20.727 | 0.207 |

Letters | 10.910 | 10.909 | 0.109 |

Coinflip | 52.000 | 52.000 | 0.520 |

S50 | 7.320 | 7.317 | 7.317 |

S100 | 7.990 | 7.989 | 7.989 |

S275 | 8.740 | 8.744 | 8.744 |

S550 | 8.930 | 8.928 | 8.928 |

Letters | 23.060 | 23.056 | 23.056 |

Coinflip | 1.980 | 1.980 | 1.980 |

S50 | 6.000 | 6.000 | 6.000 |

S100 | 5.000 | 5.000 | 5.000 |

S275 | 6.000 | 6.000 | 6.000 |

S550 | 7.000 | 7.000 | 7.000 |

Letters | 15.000 | 15.000 | 15.000 |

Coinflip | 2.000 | 2.000 | 2.000 |

S50 | 3.000 | 3.000 | 3.000 |

S100 | 1.000 | 1.000 | 1.000 |

S275 | 1.000 | 1.000 | 1.000 |

S550 | 1.000 | 1.000 | 1.000 |

Letters | 2.000 | 2.000 | 2.000 |

Coinflip | 1.000 | 1.000 | 1.000 |

S50 | −1.753 | −1.753 | −1.753 |

S100 | 0.755 | 0.755 | 0.755 |

S275 | 0.009 | 0.009 | 0.009 |

S550 | −0.302 | −0.302 | −0.302 |

Letters | −0.195 | −0.195 | −0.195 |

Coinflip | −3.676 | −3.676 | −3.676 |

S50 | −3.008 | −3.008 | −3.008 |

S100 | 0.905 | 0.905 | 0.905 |

S275 | −0.676 | −0.676 | −0.676 |

S550 | −0.985 | −0.985 | −0.985 |

Letters | 0.506 | 0.506 | 0.506 |

Coinflip | −5.971 | −5.971 | −5.971 |

S50 | −0.312 | −0.312 | −0.312 |

S100 | −0.374 | −0.374 | −0.374 |

S275 | −0.845 | −0.845 | −0.845 |

S550 | −0.816 | −0.816 | −0.816 |

Letters | −0.195 | −0.195 | −0.195 |

Coinflip | 0.024 | 0.023 | 0.023 |

S50 | −1.336 | −1.336 | −1.336 |

S100 | −0.531 | −0.531 | −0.531 |

S275 | −0.662 | −0.662 | −0.662 |

S550 | −0.226 | −0.226 | −0.226 |

Letters | 0.183 | 0.183 | 0.183 |

Coinflip | 13.384 | 13.384 | 13.384 |

S50 | −0.534 | −0.534 | −0.534 |

S100 | −0.562 | −0.562 | −0.562 |

S275 | 0.789 | 0.789 | 0.789 |

S550 | −0.528 | −0.528 | −0.528 |

Letters | −0.173 | −0.173 | −0.173 |

Coinflip | −3.307 | −3.307 | −3.307 |

S50 | −3.544 | −3.544 | −3.544 |

S100 | 0.355 | 0.355 | 0.355 |

S275 | 0.059 | 0.059 | 0.059 |

S550 | −0.061 | −0.061 | −0.061 |

Letters | −0.466 | −0.466 | −0.466 |

Coinflip | −4.317 | −4.317 | −4.317 |

were x is one of the six sequences. For a full explanation on

RQA output.

S50 | 0.106 | 0.211 | 4.000 | 2.333 | 0.721 | 0.128 | 2.000 | 2.000 | 0.000 |

S100 | 0.112 | 0.198 | 4.000 | 2.135 | 0.410 | 0.259 | 4.000 | 2.221 | 0.532 |

S275 | 0.109 | 0.205 | 5.000 | 2.112 | 0.362 | 0.214 | 3.000 | 2.114 | 0.354 |

S550 | 0.111 | 0.213 | 6.000 | 2.147 | 0.438 | 0.200 | 3.000 | 2.122 | 0.372 |

Letters | 0.039 | 0.077 | 3.000 | 2.055 | 0.212 | 0.055 | 3.000 | 2.078 | 0.274 |

Coinflip | 0.491 | 0.734 | 10.000 | 2.902 | 1.306 | 0.735 | 5.000 | 2.721 | 1.097 |

Auto-recurrence plots of sample sequences.

Taking a closer look at the RQA output, all four number sequences are more or less stable, as is to be expected for randomly generated number sequences. Instead, many of the randomization measures (

Conceptually

The original contributions presented in the study are included in the article/

WO, FH, JM, and JE designed and planned the study. WO and FH wrote the R code for randseqR. WO drafted the manuscript. FH, JM, and JE revised and critically reviewed the manuscript for important content. All authors read and authorized the final version of the manuscript.

The authors declare that the research was conducted in the absence of any commercial or financial relationships that could be construed as a potential conflict of interest.

The Supplementary Material for this article can be found online at:

The

The