Upload
raj-bhatt
View
713
Download
2
Tags:
Embed Size (px)
DESCRIPTION
Everything about Random Number Generation in Simulation and Modelling. Various Tests used.
Citation preview
Random Number Generation
© neo
INDEPENDENCE TEST
• Autocorrelation Test• Gap Test• Poker Test
© neo
© neo
AUTOCORRELATION TEST
AUTOCORRELATION TEST• The tests for Autocorrelation are concerned with the dependence between numbers in a sequence. For eg.
0.12 0.01 0.23 0.28 0.89 0.31 0.64 0.28 0.83 0.930.99 0.15 0.33 0.35 0.91 0.41 0.60 0.27 0.75 0.880.68 0.49 0.05 0.43 0.95 0.58 0.19 0.36 0.69 0.87
© neo
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.01 0.23 0.28 0.89 0.31 0.64 0.28 0.83 0.930.99 0.15 0.33 0.35 0.91 0.41 0.60 0.27 0.75 0.880.68 0.49 0.05 0.43 0.95 0.58 0.19 0.36 0.69 0.87
© neo
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.01 0.23 0.28 0.89 0.31 0.64 0.28 0.83 0.930.99 0.15 0.33 0.35 0.91 0.41 0.60 0.27 0.75 0.880.68 0.49 0.05 0.43 0.95 0.58 0.19 0.36 0.69 0.87
© neo
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.
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
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:
33
Z0 = ρim
33σρim
© neo
GAP TEST
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
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
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
GAP TEST
p0 = p, p1= p(1-p), p2= p(1-p) , .. .., pk= p(1-p)
© neo
2 k
Here p= ß - ä which is probability that any element Uj is between ä and ß
© neo
POKER TEST
POKER TEST
© neo
• 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:
POKER TEST
© neo
•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
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
© neo
P(C=c) = 1 k!
k (k-c)!k
2Sk
c
Thank you
© neo