CHP 5
CHP 5
NUMBERS CONCEPT
DURGARAJ KATWAL
Probability concept in
simulation –stochastic
variables :
■ stochastic variables
■ Ordered set of random values
■ Stochastic process give rise to stochastic variable
■ Stochastic process can be discrete or continuous
Discrete Probability Functions
■ Or Probability Mass Function (PMF)
■ Distribution of probabilities -If a variable can take n different values xn
(n = 1, 2, 3, … N), and probability of xn being take is p(xn), then the
set of numbers comprise of p(xn) is probability mass function
■ In certain cases like dice roll, the PMF values may be known (e.g. 1/6).
But most of the time, PMF is counted from input sample
Cumulative Distribution
Function (CDF)
Cumulative Distribution
Function (CDF)
■ -As we have seen already, value of ‘infinity’ is implementation
dependent ,But, the cumulative distribution function (CDF)
will be
■ The result from the experiment becomes a variable; that is, a quantity
taking different values on different occasions. Because the experiment
involves selection at random, we call it a random variable.
■ Example : Select items at random from a batch of size N until the first
defective item is found. Record the number of non-defective items.
Sample Space: S = {0, 1, 2, . . . , N}
Types of random variables
■ Expectation
Properties of Random
Numbers
■ Variance
■ Midsquare method
■ Linear Congruential Method (LCM )
■ Combined Linear Congruential Generators (CLCG)
■ Random-Number Streams
Test for Random numbers
1. Frequency test Frequency test. Uses the Kolmogorov Uses the
Kolmogorov-Smirnov Smirnov or the chi-square test to compare the
distribution of the set of numbers generated to a uniform di t ib ti
distribution.
2. Runs test. Tests the runs up and down or the runs above and below the
mean by comparing runs above and below the mean by comparing the
actual values to expected values. The statistic for comparison is the chi-
square.
3. Autocorrelation test. Tests are the correlation between numbers and
compares the sample correlation to the expertation correlation zero.
4.Gap test Counts the number of digits that Counts the number of digits
that appear between repetitions of a particular digit and then uses the
Kolmogorov-Smirnov test to compare with the expected number of gaps.
5. Poker test. Treats numbers grouped together as a poker hand. Then the
hands obtained are a poker hand. Then the hands obtained are compared to
what is expected using the chisquare test. .
Frequency test
■ Chi-square test
■ Steps in Chi-Square
1. Determine the appropriate test
2. Establish the level of significance: α
3. Formulate the statistical hypothesis
4. Calculate the test statistic
5. Determine the degree of freedom
6. Compare computed test statistic against a Compare computed test
statistic against a tabled/critical value
RUN TESTS
Run up and run down
– an up run is a sequence of numbers each of which is succeeded by
a larger number; a down run is a squence of numbers each of which
is succeeded by a smaller number
■ If a sequence of numbers have too few runs, it is unlikely a real random
sequence. E.g. 0.08, 0.18, 0.23, 0.36, 0.42, 0.55, 0.63, 0.72, 0.89, 0.91,
the sequence has one run, an up run. It is not likely a random sequence.
■ If a sequence of numbers have too many runs, it is unlikely a real
random sequence. E.g. 0.08, 0.93, 0.15, 0.96, 0.26, 0.84, 0.28, 0.79,
0.36, 0.57. It has nine runs, five up and four down. It is not likely a
random sequence.
■ If a is the total number of runs in a truly random sequence, the mean
and variance of a is given by
■ and
Runs up and runs down
Runs above and below the
mean
Runs test: length of runs.
Title Lorem Ipsum dolor