3.3.2 EMPIRICAL TESTS 61 G2. Set T zero
3.3.2 EMPIRICAL TESTS 61 G2. Set T zero G4. Increase T Fig. 6. Gathering data for the gap test. (Algorithms for the coupon-collector s test and the run test are similar.) Gl. [Initialize.] Set j t -1, s t 0, and set COUNT[r] t 0 for 0 2 T 2 t. 62. [Set T zero.] Set r t 0. 63. [o 2 Uj < ,B?] Increase j by 1. If Uj 2 LY and Uj < p, go to step G5. 64. [Increase r.] Increase r by one, and return to step G3. 65. [Record gap length.] (A gap of length r has now been found.) If r 2 t, increase COUNT[t] by one, otherwise increase COUNT[?+] by one. G6. [n gaps found?] Increase s by one. If s < n, return to step G2. 1 After this algorithm has been performed, the chi-square test is applied to the k = t + 1 values of COUNT[O], COUNT[l], . . . , COUNT[t], using the following probabilities: PO = P, Pl = P(l -PI, P2 = P(1 - P)2, . . . , Pt-1 = P(l -Py, Pt = (1 -PI . (4) Here p = ,L3-LY, the probability that Q 5 Uj < p. The values of n and t are to be chosen, as usual, so that each of the values of COUNT[r] is expected to be 5 or more, preferably more. .! The gap test is often applied with Q: = 0 or p = 1 in order to omit one of the comparisons in step G3. The special cases (0, p) = (0, 3) or (4, 1) give rise to tests that are sometimes called runs above the mean and runs below the mean, respectively. The probabilities in Eq. (4) are easily deduced, so this derivation is left to the reader. Note that the gap test as described above observes the lengths of n gaps; it does not observe the gap lengths among n numbers. If the sequence (Un) is sufficiently nonrandom, Algorithm G may not terminate. Other gap tests that examine a fixed number of U s have also been proposed (see exercise 5).
Note: In case you are looking for affordable webhost to host and run your servlet application check Vision ecommerce web hosting services