next up previous contents
Next: Test design Up: Empirical tests for uniform Previous: Empirical tests for uniform

A class of statistical tests for uniform PRNs

In order to build a test for s-dimensional random numbers we have to construct such vectors from the sequence of onedimensional random numbers. As any other step in the construction of the test statistic, this transformation will be expressed by a function which can be applied to the random numbers tex2html_wrap_inline3424, but also to the random variables tex2html_wrap_inline3346. The result of the former are vectors of random numbers which will be tested, the result of the later are random vectors from which we deduce the distribution of the test statistic.

The first simplification that we have to make concerns the transformation of the sequence of random variables and PRNs, respectively, into a sequence of s-dimensional vectors, where tex2html_wrap_inline3988. We will only consider the following two, somewhat natural ways to proceed:

  1. Nonoverlapping s-tuples are vectors
    eqnarray845
  2. Overlapping s-tuples are vectors
    eqnarray856

As we are thinking of an empirical test that should be evaluated by a computer in a finite amount of time, we have to limit the number of PRNs that are to be tested. We will only use a finite sample of lengthgif tex2html_wrap_inline3994 consisting of the vectors tex2html_wrap_inline4004. Let us denote this sample by tex2html_wrap_inline2956 and a realization of it by tex2html_wrap_inline3178.

The difference between the two methods to form s-dimensional vectors is the different common distribution of the resulting random vectors. Random vectors tex2html_wrap_inline2980 formed from nonoverlapping tuples are independentgif, whereas random vectors tex2html_wrap_inline2980 formed from overlapping tuples are dependent. The common distribution function for overlapping tuples will not factor to the product of the distributions of the single random variables.

In many applications it will be desirable to have independent vectors and one will choose the nonoverlapping form of tuples. However, in building statistical tests we can use both forms of tuples since we will pay attention to the common distribution while calculating the distribution of the test statistic.


tabular1797

Note that choosing overlapping tuples is more general in that the resulting sequence will also include all vectors resulting from nonoverlapping tuples. However, the information represented by the two possible sequences of random vectors is exactly the same, since every single random variable tex2html_wrap_inline3346 can be reconstructed from both forms. For the moment let us concentrate on the nonoverlapping case in order to develop the ideas.

The empirical distribution function for such a sample tex2html_wrap_inline3178 is given by
displaymath4024
for every tex2html_wrap_inline4026, where
displaymath4028

When we substitute the sequence tex2html_wrap_inline2956 for the sample tex2html_wrap_inline3178, the Glivenko-Cantelli theorem proves that the empirical distribution function of these random vectors will almost surely converge to the distribution function of tex2html_wrap_inline2980, for tex2html_wrap_inline3710, which is given by
displaymath4038
since the components of tex2html_wrap_inline2980 are independent uniformly distributed random variables tex2html_wrap_inline4042.

Convergence in the above sense is expressed by the distance of the two functions with respect to supremum norm: put d the distance
displaymath4046
then d will converge to zero almost surely when we increase the sample sizegif tex2html_wrap_inline4052.

Almost sure is defined with respect to the probability space tex2html_wrap_inline3016 which contains all infinite sequences of random numbers: the described convergence will happen for almost allgif infinite sequences of random numbers. In other words, d degenerates to a random variable having value zero on a set of measure one if tex2html_wrap_inline4052. This is a consequence of the strong law of large numbers and the compact range of probabilities.

For the 'esoterical' case tex2html_wrap_inline4052 we thus have found a test statistic d expressing the numerical properties we consider important in our definition of iud sequences of PRNs. The set of sequences for which d does not converge to zero thus contains valid sequences of random numbers which do not lead to the desired results with our 'simulation problem' d.

But since we have only finite sequences of some length tex2html_wrap_inline3994 we have to calculate the distribution of the quantity d for this given sample size. Note that tex2html_wrap_inline4074 is a random variable which is not only defined on tex2html_wrap_inline3016 but also on the probability space tex2html_wrap_inline4078 which contains all sequences of random numbers of length tex2html_wrap_inline4080. Due to the construction of tex2html_wrap_inline3016, the distribution of tex2html_wrap_inline4074 is the same with respect to these two probability spaces.

If it would be possible to calculate the distribution of d for a given tex2html_wrap_inline3994, we could mark large values of d within its range as the critical region and build a statistical test. The test would exclude sequences of vectors of random numbers of length tex2html_wrap_inline3994 for which the empirical distribution function differs - in the sense of supremum norm - too much from the theoretical distribution function of iud random vectors.

The weak law of large numbers tells us that the proportion of sequences of length tex2html_wrap_inline3994 that approximate the theoretical distribution function up to an error less or equal tex2html_wrap_inline4096 becomes one as tex2html_wrap_inline3994 increases towards infinity.

Two problems remain. The first one is a mathematical one. The distribution of d is unknown for dimensions s>1. Even in the case s=1 the distribution of d is only asymptotically independent of the shape of tex2html_wrap_inline4108. The second problem is a computational one. The computation of d is practically impossible for dimensions s>1 and interesting sample sizes (tex2html_wrap_inline4114) since the complexity of the algorithm is about tex2html_wrap_inline4116, which is exponential in s.

These problems are solved by a two-step procedure. We first partition the range of the random vectors into a finite number of classes thereby simplifying the calculation of the empirical distribution function, which can be expressed by counting the number of hits for every such class.

In the second step, we calculate a certain distance measure tex2html_wrap_inline4120 which expresses the distance of the observed counters to the expected value of each such counter. The distribution of tex2html_wrap_inline4120 can be calculated approximately and provides a test statistic for iud PRNs.

We will define the partition of tex2html_wrap_inline3442 by splitting each coordinate into a finite numbergif tex2html_wrap_inline3660 of classes
displaymath4130
The components of our random vectors tex2html_wrap_inline2980 are the random variables tex2html_wrap_inline3346 and we will use the following notations in order to denote the partition of these: put
displaymath4136
an alphabet of cardinality tex2html_wrap_inline3660 containing a symbol for each class of the partition and let
displaymath4140
be a function that maps the range of tex2html_wrap_inline3346 onto the alphabet. Finally put
displaymath4144
tex2html_wrap_inline4146 thus becomes a sequence of abstract random variables from tex2html_wrap_inline3016 to tex2html_wrap_inline4150. We will use the notation
displaymath4152
in order to denote the partitioned random numbers.

We now again form vectors using nonoverlapping s-tuples of these symbols setting
displaymath4156
and
displaymath4158
Note that each vector is an element of tex2html_wrap_inline4160. The unit cube tex2html_wrap_inline3442 has been partitioned into tex2html_wrap_inline4164 classes which we denote by
displaymath4166
A sample of tex2html_wrap_inline3994 such vectors will be denoted by tex2html_wrap_inline3132 and tex2html_wrap_inline4172 respectively.

The partition transforms the multidimensional continuous random variables respectively random numbers into discrete random variables. For realizations tex2html_wrap_inline4174 of such random variables the information represented by the empirical distribution function, that is the function
displaymath4176
where tex2html_wrap_inline4178 and tex2html_wrap_inline4180 means that
displaymath4182
is equivalent to knowing the 'empirical probability density', that is the set of values
displaymath4184
since either quantity can be constructed from the other one. We thus can simplify the evaluation of the empirical distribution function to counting hits in classes. The empirical probability density is an estimator for the probability density of the random counters of hits in the classes. This function will be written
displaymath4186

We again have to introduce arbitrariness into our test, namely the way in which we split the unit cube. An easy and evident way to do so will be to divide [0,1[ into l equals segments of length 1/l, thereby generating tex2html_wrap_inline4194 half-open mini-cubes in tex2html_wrap_inline3442. The number l has to be chosen small enough in order to allow the evaluation and storage of the empirical probability density but also large enough in order to represent actual applications which will usually work with very fine partitions, if they split the vectors at all.

Since we are working with computers, a quite general and easy to implement way to split the unit cube, including the above one for l of the form tex2html_wrap_inline4202, are bit manipulations: we will consider the single random numbers tex2html_wrap_inline3424 as, say, 32-bit integers, that is, we transform them by multiplyinggif with tex2html_wrap_inline4206. Thus, our sequence becomes a sequence of 32 bit numbers.

We now cut out some k different bits of every number. These k bits denote a unique symbol in the set tex2html_wrap_inline4212, where tex2html_wrap_inline4214 denotes the number of combinations possible with k bits, tex2html_wrap_inline4218.

This can be described by a function
displaymath4220
where k(x) is the binary number represented by the k bits selected from the random number x.

The same procedure applied to the sequence tex2html_wrap_inline2992 results in a sequence of independent random variables distributed uniformly on the alphabet tex2html_wrap_inline4150 since the probability for each symbol is the same:
displaymath4232
The described bit manipulations always lead to uniformly distributed symbols, since the whole measure on [0,1[ is divided into two parts of equal measure by every bit in a binary representation.

In the tests presented in Chapter 4, we used one of the following bit manipulations:

If you are familiar with statistical testing, you will already have recognized that we are constructing an usual tex2html_wrap_inline3040 goodness of fit test. Such tests are used to decidegif whether a set of data arises from a specified probabilistic model, or not. The test is based on two properties of the multinomial distribution:

  1. Every random variable Y, discrete or continuous, onedimensional or multidimensional, real valued or abstract, can be reduced to a multinomial random variable by splitting its range into a finite set tex2html_wrap_inline4270 of classes and calculating the probabilities tex2html_wrap_inline4272 that the random variable falls into one of these classes. tex2html_wrap_inline4274 denotes a set of indices. If tex2html_wrap_inline3994 measurements of Y are taken then the vector counting the number of realizations that fell into each class is distributed multinomial with the parameters tex2html_wrap_inline3994 and tex2html_wrap_inline4282. Thus the counters tex2html_wrap_inline4284 for our independent uniformly distributed random vectors tex2html_wrap_inline4286 should be distributed multinomial with parameters tex2html_wrap_inline3994 and
    displaymath4290
    for every tex2html_wrap_inline4292.
  2. The distribution of a sort of distance between the empirical probability density of a realization of a multinomial random variable and its theoretical probability density can be calculated at least approximately. The approximation is due to the asymptotic convergence in distribution of the multinomial random variable to a multidimensional normal variate. The main tool within this field is the famous theorem of Pearson, see [27, p.439,] for example, which establishes the asymptotic distribution of the distance measure.

Let us introduce the distance measure tex2html_wrap_inline4120. For every class tex2html_wrap_inline4296 in our partition we compute the distance between the actual number of hits tex2html_wrap_inline4298 and the expected number of hits
displaymath4300
A weighted sum of the squares of these distances becomes the overall test statistic. The weights are chosen in order to stabilize the mean and variance of the distribution of the test statistic as a function of tex2html_wrap_inline3994. This is needed to get a convergence in distribution which in turn is required since we can only calculate the asymptotic distribution. We therefore define
displaymath4304

This really is something like a distance between the empirical distribution function for tex2html_wrap_inline4172 and the theoretical distribution function of tex2html_wrap_inline3132, since the function becomes zero if and only if the mentioned distance is zero. To see this, observe that
eqnarray1071
The original random numbers tex2html_wrap_inline4310 have got more freedom to vary since the partition provides only a reduced amount of information. By this, the empirical distribution function of the tex2html_wrap_inline3178 needs only to be near to the theoretical tex2html_wrap_inline4108 in order to get tex2html_wrap_inline4316.

The theorem of Pearson states, that the test statistic tex2html_wrap_inline4120 will asymptotically be distributed tex2html_wrap_inline3040 with tex2html_wrap_inline4322 degrees of freedom if we substitute R for r. We can thus perform a statistical test on any set of random numbers by marking a set of values within the range of such a tex2html_wrap_inline3040 variable as the critical region. The quality of the approximation depends on the expectation of the number of hits in the classes and on the total number of such classes. The higher the smallest of these expectations or the higher the number of classes, the better the approximation. We will return to this question in the next section.

As we have constructed the test in order to exclude random numbers whose empirical distribution function is far from the theoretical one, the critical region should be placed at the utmost end of the values of tex2html_wrap_inline4120. However, traditional statistics often uses a critical region including values near zero as well as very high values. A test with such a critical region would exclude random numbers whose empirical distribution function is either too close to or too far from the theoretical one. The construction of the critical region tex2html_wrap_inline3654 as well as the selection of the other parameters tex2html_wrap_inline3994, s, m and the set of bits is called test design. It will be covered in the next subsection.

Yet another method is the combination of a tex2html_wrap_inline3040 test statistic with a Kolmogorov- Smirnov test. As has already been mentioned, such a test is used to compare the empirical distribution function of realizations of an onedimensional random variable Y to the distribution function tex2html_wrap_inline4344 itself by means of the supremum norm
displaymath4346
Provided that the distribution function tex2html_wrap_inline4344 is continuous, the asymptotic distribution of tex2html_wrap_inline4350 for tex2html_wrap_inline4352 is the Kolmogorov-Smirnov distribution, which is independent of the shape of tex2html_wrap_inline4344. A good approximation is available for sample sizes k>4 using an approximate distribution function which is given in [40]. See also [17, p.184,] for further information. We will denote this test statistic by tex2html_wrap_inline4358

The combined test is performed by first evaluating k times the tex2html_wrap_inline4120 test statistic. On these approximately tex2html_wrap_inline3040 distributed values a final K-S test is calculated. The critical region of the K-S test is set to include high values since we want to exclude sequences of PRNs that do not approximate the tex2html_wrap_inline3040 distribution within a fixed amount of error d. Usually the critical region is set to the interval tex2html_wrap_inline4370 which has a probability of approximately 0.01 if k=32.

The sample tests in Chapter 4 have all been performed using such combined tests. In our opinion, they are most likely to yield sequences of PRNs that are useful in the class of applications where the user makes not only one but k simulation runs in order to get a good approximation to the distribution of their model.


next up previous contents
Next: Test design Up: Empirical tests for uniform Previous: Empirical tests for uniform

Stefan Wegenkittl
Tue Dec 3 09:56:35 MET 1996