serialtest: the Serial test In randtoolbox: Toolbox for Pseudo and Quasi Random Number Generation and RNG Tests

Description

The Serial test for testing random number generators.

Usage

 `1` ```serial.test(u , d = 8, echo = TRUE) ```

Arguments

 `u` sample of random numbers in ]0,1[. `echo` logical to plot detailed results, default `TRUE` `d` a numeric for the dimension, see details. When necessary we assume that `d` is a multiple of the length of `u`.

Details

We consider a vector `u`, realisation of i.i.d. uniform random variables U1... Un.

The serial test computes a serie of integer pairs (p_i,p_{i+1}) from the sample `u` with p_i = floor(u_i d) (`u` must have an even length). Let n_j be the number of pairs such that j=p_i d + p_{i+1}. If `d=2`, we count the number of pairs equals to 00, 01, 10 and 11. Since all the combination of two elements in {0, ..., d-1} are equiprobable, the chi-squared statistic is

S = ∑_{j=0}^{d-1} [n_j - n/(2 d^2)]^2/[n/(2 d^2)].

Value

a list with the following components :

`statistic` the value of the chi-squared statistic.

`p.value` the p-value of the test.

`observed` the observed counts.

`expected` the expected counts under the null hypothesis.

`residuals` the Pearson residuals, (observed - expected) / sqrt(expected).

Author(s)

Christophe Dutang.

References

Planchet F., Jacquemin J. (2003), L'utilisation de methodes de simulation en assurance. Bulletin Francais d'Actuariat, vol. 6, 11, 3-69. (available online)

L'Ecuyer P. (2001), Software for uniform random number generation distinguishing the good and the bad. Proceedings of the 2001 Winter Simulation Conference. (available online)

L'Ecuyer P. (2007), Test U01: a C library for empirical testing of random number generators. ACM Trans. on Mathematical Software 33(4), 22.

other tests of this package `freq.test`, `gap.test`, `poker.test`, `order.test` and `coll.test`
`ks.test` for the Kolmogorov Smirnov test and `acf` for the autocorrelation function.
 ```1 2 3 4 5 6 7 8``` ```# (1) # serial.test(runif(1000)) print( serial.test( runif(1000000), d=2, e=FALSE) ) # (2) # serial.test(runif(5000), 5) ```