ll{
Package: rvgtest
Type: Package
Version: 0.5.0
Date: 2010-07-12
License: GPL 2 or later
LazyLoad: yes
} rvgtest is a set of tools to investigate the quality of
non-uniform pseudo-random random generators (RVG).
Thus it provides functions to visualize and test for possible
defects. There are three mean reasons for such defects and errors:
- Errors in the design of algorithms -- The proof for theorem
that claims the correctness of the algorithm is wrong.
- Implementation errors -- Mistakes in computer programs.
- Limitations of floating point arithmetic and round-off
errors in implementations of these algorithms in real world
computers.
Of course testing software is a self-evident part of software
engineering. Implementation errors usually result in large deviations
from the requested distribution and thus errors of type 2 are easily
detected. However, this need not always be the case, for example for
rather complicated algorithms like those based on patchwork methods. The same holds for errors of type 1. In the best of all worlds, there
exists a correct proof for the validity of the algorithm. In our world
however human can err. Then the deviations are rather small, since
otherwise it would have been detected when testing the implementation
for errors of type 2.
Errors of type 3 can be a problem when the requested distribution
has extreme properties. E.g., it is no problem to generate a sample of
beta distributed random variates with shape parameters 0.001 using
rbeta(n=100, shape1=0.001, shape2=0.001)
.
However, due the limited resolution of floating point numbers it behaves
like a discrete distribution (especially near 1). It is not always
obvious whether such round-off errors will influence ones simulation
results.
It is the purpose of this package to provide some tools to find
possible errors in RVGs. However, observing a defect in (the
implementation of) a pseudo-random variate generator by purely
statistical tools may require a large sample size which that exceeds
the memory when hold in a single array in R.
(Nevertheless, there is some chance that this defect causes an error
in a particular simulation with a moderate sample size.)
Hence we have implemented routines that can run tests on very large
sample sizes (which are only limited by the available runtimes).
Currently there are two toolsets for testing random variate generators
for continuous univariate distributions:
- Testing based on histograms for all kinds of RVGs.
- Estimating errors of RVGs that are based on numerical
inversion methods.