0% found this document useful (0 votes)
2 views51 pages

CHP 5

The document discusses the concepts of probability and random variables, including stochastic variables, discrete and continuous random variables, and their associated probability functions. It also covers properties of random numbers, methods for generating random numbers, and tests for randomness such as frequency tests and runs tests. Additionally, it highlights the distinction between true random numbers and pseudo-random numbers, emphasizing the importance of uniformity and independence in random number generation.

Uploaded by

Dikesh katwal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views51 pages

CHP 5

The document discusses the concepts of probability and random variables, including stochastic variables, discrete and continuous random variables, and their associated probability functions. It also covers properties of random numbers, methods for generating random numbers, and tests for randomness such as frequency tests and runs tests. Additionally, it highlights the distinction between true random numbers and pseudo-random numbers, emphasizing the importance of uniformity and independence in random number generation.

Uploaded by

Dikesh katwal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 51

PROBABILITY AND RANDOM

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

Therefore, probability of x falling in the range x1 to x2 is, F(x2)


– F(x1)
Random variables

■ 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

1. Discrete random variables :


Discrete random variables take on a countable number of distinct values. Consider an
experiment where a coin is tossed three times. If X represents the number of times that
the coin comes up heads, then X is a discrete random variable that can only have the
values 0, 1, 2, or 3 (from no heads in three successive coin tosses to all heads). No other
value is possible for X
For example, discrete random variables include the following
■ The number of heads that come up during a series of coin tosses.
■ The number of library books checked out per hour.
2. Continuous Random Variables

■ Continuous random variables can represent any value within a


specified range or interval and can take on an infinite number of
possible values. An example of a continuous random variable would
be an experiment that involves measuring the amount of rainfall in a
city over a year or the average height of a random group of 25
people.
■ This data type often occurs when you measure a quantity on a scale. For example,
continuous random variables include the following:
• Height and weight.
• Time and duration.
• Temperatures.

■ Analysts denote a continuous random variable as X and its possible values as x,


just like the discrete version. However, unlike discrete random variables, the
chances of X taking on a specific value for continuous data is zero. In other words:
P (X = x) = 0, where x is any specific value.
■ Instead, probabilities greater than zero only exist for ranges of values, such as
P(a ≤ X ≤ b), where a and b are the lower and upper bounds of the range
■ A probability density function (PDF) describes the probability distribution of a
continuous random variable. These functions use a curve displaying probability
densities, which are ranges of one unit.
■ Continuous random variables must satisfy the following:
Probabilities for all ranges of X are greater than or equal to zero: P(a ≤ X ≤ b) ≥ 0.
The total area under the curve equals one: P(-∞ ≤ X ≤ + ∞) = 1
Properties of Random
Numbers
■A sequence of random numbers, R1,R2…..Rn must have two important properties:

1.uniformity, i.e. they are equally probable every where


2. independence, i.e. the current value of a random variable has no relation with
the previous values
■ Each random number Ri is an independent sample drawn from a continuous
uniform distribution between zero and one.
■ Pdf

■ Expectation
Properties of Random
Numbers
■ Variance

• Some consequences of the uniformity and independence properties


• If the interval (0,1) is divided into n sub-intervals of equal length, the expected
number of observations in each interval is N/n where N is the total number of
observations. Note that N has to be sufficiently large to show this trend.
• The probability of observing a value in a particular interval is independent of the
previous values drawn.
Pseudo random numbers
■"Pseudo" means false,so false random numbers are being generated.In this instance,"pseudo'
is used to imply that the very act of generating random numbers by a known method removes
the potential for true randomness.If the method is known,the set of random numbers can be
replicated. Then an argument can be made that the numbers are not truly random. The goal of
any generation scheme,however,is to produce a sequence of numbers between 0 and 1 that
simulates, orimitates,the ideal properties of uniform distribution and independence as closely as
possible.
■To be sure, in the generation of pseudo-random numbers, certain problems or errors can
occur.These errors, or departures from ideal randomness, are all related to the properties stated:
previously. Some. examples of such departures include the following:
1. The generated numbers might not be uniformly distributed.
2.The generated numbers might be discrete-valued instead of continuous-valued,
3.The mean of tne generated numbers might be too high or too low.
4.The variance of the generated numbers might be too high or too low.
Generating Random Numbers

■ 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

LOREM IPSUM LOREM IPSUM LOREM IPSUM


DOLOR DOLOR DOLOR

You might also like