More Related Content Similar to Random Number Generation (20) Random Number Generation4. AUTOCORRELATION TEST
• The tests for Autocorrelation are
concerned with the dependence between
numbers in a sequence. For eg.
0.12
0.99
0.68
0.01
0.15
0.49
0.23
0.33
0.05
0.28
0.35
0.43
0.89
0.91
0.95
0.31
0.41
0.58
0.64
0.60
0.19
0.28
0.27
0.36
0.83
0.75
0.69
0.93
0.88
0.87
© neo
5. AUTOCORRELATION TEST
• From a visual inspection, these numbers
appear to be random, and they would
probably pass all tests presented to this
point.
0.12
0.99
0.68
0.01
0.15
0.49
0.23
0.33
0.05
0.28
0.35
0.43
0.89
0.91
0.95
0.31
0.41
0.58
0.64
0.60
0.19
0.28
0.27
0.36
0.83
0.75
0.69
0.93
0.88
0.87
© neo
6. AUTOCORRELATION TEST
• From a visual inspection, these numbers
appear to be random, and they would
probably pass all tests presented to this
point.
0.12
0.99
0.68
0.01
0.15
0.49
0.23
0.33
0.05
0.28
0.35
0.43
0.89
0.91
0.95
0.31
0.41
0.58
0.64
0.60
0.19
0.28
0.27
0.36
0.83
0.75
0.69
0.93
0.88
0.87
© neo
7. AUTOCORRELATION TEST
• The test requires the computation of
autocorrelation between every m numbers,
starting with the ith number .
• Thus the autocorrelation ρim between the
following numbers would be of interest:
Ri , Ri+m, Ri+2m, .. .. .. .., Ri+(M+1)m.
8. AUTOCORRELATION TEST
• Where M is the largest integer such that
i+(M+1)m<=N , where N is total number of
values in sequence.
• A nonzero autocorrelation implies a lack
of independence, so following two tailed test
is appropriate: H0 : ρim = 0
H1 : ρim ×= 0
9. AUTOCORRELATION TEST
• For large values of M, the distribution of
the estimator of ρim , denoted ρim is
̂
approximately normal if the values Ri , Ri+m,
Ri+2m, .. .. .. .., Ri+(M+1)m are uncorrelated, then
the statistics can be as follows:
Z0 = ρ̂ im
σρ
im
11. GAP TEST
• For each Uj in certain range, this test
examines the length of ‘Gap’ between this
element and the next element to fall in that
range.
•So if ä and ß are two real numbers such that
0 <= ä < ß <= 1 we are looking for the length
of consecutive subsequences Uj, Uj+1,.. , Uj+(r+1)
© neo
12. GAP TEST
• Such that Uj and Uj+(r+1) are between ä and ß
but the other elements in the subsequence are
not (this is a gap of length r).
•We would then perform chi-squared test on
the results using the different lengths of
gaps as the categories, and the probabilities
are as follows:
© neo
13. GAP TEST
• Such that Uj and Uj+(r+1) are between ä and ß
but the other elements in the subsequence are
not (this is a gap of length r).
•We would then perform chi-squared test on
the results using the different lengths of
gaps as the categories, and the probabilities
are as follows:
© neo
14. GAP TEST
2
k
p0 = p, p1= p(1-p), p2= p(1-p) , .. .., pk= p(1-p)
Here p= ß - ä which is probability
that any element Uj is between ä
and ß
© neo
16. POKER TEST
• As with the gap test, the name of the poker
test suggests its description. We examine n
groups of five consecutive integers, and put
each of these groups into one of the
following categories:
© neo
17. POKER TEST
•All different: ABCDE
•One pair:
AABCD
•Two pairs:
AABBC
•Three of a kind: AAABC
•Full house:
AAABB
•Four of a kind: AAAAB
•Five of a kind: AAAAA
© neo
18. POKER TEST
• In a more intuitive way, let us consider a
hand of k cards from k dierent cards.
• The probability to have exactly c different
cards is
P(C=c) = 1
k!
k
k
(k-c)!
c
2Sk
© neo