Presentation is loading. Please wait.

Presentation is loading. Please wait.

ETM 607 – Random Number and Random Variates

Similar presentations


Presentation on theme: "ETM 607 – Random Number and Random Variates"— Presentation transcript:

1 ETM 607 – Random Number and Random Variates
Define random numbers and .pseudo-random numbers Generation of random numbers Test for random numbers Frequency tests Autocorrelation Random-Variate generation Inverse-transform technique

2 ETM 607 – Random Number and Random Variates
Definitions: Random number (Ri) – a value between 0 and 1.0, ~ U[0,1). Random Variable – a variable with an associated probability distribution. Random Variable – a function that assigns a real number to each outcome in the sample space (Feldman and Valdez-Flores). ex. X ~ U[0,1) Y ~ Exp(5.75) Z ~ Normal(8.0,1.0)

3 ETM 607 – Random Number and Random Variates
Random Number (Ri):

4 ETM 607 – Random Number and Random Variates
Random Number (Ri) – statistical properties: Uniformity – if divided into n intervals of equal length, then the expected number of observations in each interval is n/N, where N is the total number of observations. Independence – the probability of a value in a particular interval is independent of the previously generated value.

5 ETM 607 – Random Number and Random Variates
Generation of Pseudo-Random Number: Pseudo – false, or “not quite”. Random numbers generated in a computer. Not exactly random, but generated from an algorithm and are in fact repeatable given same starting position (good for debugging).

6 ETM 607 – Random Number and Random Variates
Generation of Pseudo-Random Number: Goal – develop generation method such that output most closely imitates ideal properties of uniformity and independence. Considerations fast and efficient (in code) portable to different computers should have long cycles (before number pattern repeats) Should be repeatable (for debugging) Closely approximate true ~U[0,1)

7 ETM 607 – Random Number and Random Variates
Linear Congruential Method: Sequence of intergers: X1, X2, X3,…. Xn between 0 and m-1. Xi+1 = (a Xi+ c) mod m Where, X0 - initial seed a - multiplier c – increment m – modulus Then,

8 ETM 607 – Random Number and Random Variates
Linear Congruential Method: In class exercise: Xi+1 = (a Xi+ c) mod m Given, X a - 13 c – 0 m – 10000 Find,

9 ETM 607 – Random Number and Random Variates
Linear Congruential Method: Why was m = effective (from a computational perspective) in the example. In computer algorithm, m is usually a function of 2b , producing same effect in binary terms. Much research done to determine effective values of a and c to produce long cycles, uniformity and independence.

10 ETM 607 – Random Number and Random Variates
Combined Linear Congruential: See book for combining linear congruential methods to produce random number streams with large cycles / periods.

11 ETM 607 – Random Number and Random Variates
Uniformity Tests : Null hypothesis, H0: Ri ~ U[0,1) and H1: Ri ~ U[0,1) Level of significance, a = P(reject H0 | H0 true) probability of rejecting the null hypothesis when in null hypothesis is true. Usually set a = .05 or .01, or probability is 5% or 1% of rejecting null hypothesis when performing the test.

12 ETM 607 – Random Number and Random Variates
Uniformity Tests – Kolmogorov-Smirnov: Step 1 – rank data from smallest to largest Ri : Step 2 - compute Step 3 – compute D Step 4 – Use Kolmogorov-Smirnov table A.8, selecting column associated with significance level, and row where N is the number of observations. Step 5 – If sample statistic D from step 3 is greater than Da, the null hypothesis is rejected. If D <= Da, cannot detect difference between random numbers and the uniform distribution.

13 ETM 607 – Random Number and Random Variates
Uniformity Tests – Kolmogorov-Smirnov: Excellent example in book, Ex. 7.6 insert Ex 7.6

14 ETM 607 – Random Number and Random Variates
Uniformity Tests – Kolmogorov-Smirnov: Excellent example in book, Ex. 7.6 insert Fig 7.2

15 ETM 607 – Random Number and Random Variates
Uniformity Tests – Chi-Square Test: Where Oi is the number of observations within a segment/range/cell, Ei is the expected number of observation in the segment/range, and n is the number of segments/ranges/cells. For a uniform distribution that has n segments or ranges,

16 ETM 607 – Random Number and Random Variates
Uniformity Tests – Chi-Square Test: Insert ex 7.7

17 ETM 607 – Random Number and Random Variates
Independence Tests – Autocorrelation: Recall correlation (r) r = r = -1.0 r = 1.0

18 ETM 607 – Random Number and Random Variates
Independence Tests – Autocorrelation: Autocorrelation is correlation of a series of data to help identify repeated patterns. Objective is to have autocorrelation values near 0 for all lags. Lag = 1, r = Lag = 3, r = Lag is the interval between plotted vales. Time series plot of data Lag = 2, r = Lag = 5, r =

19 ETM 607 – Random Number and Random Variates
Independence Tests – Autocorrelation: See book for statistical method of applying hypothesis testing for the objective of 0 correlation at various time lags.

20 ETM 607 – Random Number and Random Variates
Random-Variate Generation – Chapter 8: Random-Variate generation is converting from a random number (Ri) to a Random Variable, Xi ~ some distribution. Inverse transform method: Step 1 – compute cdf of the desired random variable X Step 2 – Set F(X) = R where R is a random number ~U[0,1) Step 3 – Solve F(X) = R for X in terms of R. X = F-1(R). Step 4 – Generate random numbers Ri and compute desired random variates: Xi = F-1(Ri)

21 ETM 607 – Random Number and Random Variates
Inverse transform method – Uniform Distibution Example: Step 1 – compute cdf of the desired random variable X Step 2 – Set F(X) = R where R is a random number ~U[0,1) Step 3 – Solve F(X) = R for X in terms of R. X = F-1(R). Step 4 – Generate random numbers Ri and compute desired random variates: Xi = Ri(b-a) + a

22 ETM 607 – Random Number and Random Variates
Inverse transform method – Uniform Distibution Example: Xi = F-1 (R) = Ri(b-a) + a If Xi ~ U[5,10) a = 5 b =10 Ri Xi .5 .5(10 - 5)+5 = 7.5 .7 .7(10 – 5) + 5 = 8.5 .1 .1(10 – 5) + 5 = 5.5

23 ETM 607 – Random Number and Random Variates
Inverse transform method – General Idea: Mapping (or transforming) from cdf to Random Variable Insert fig 8.2

24 ETM 607 – Random Number and Random Variates
In class exercise: Determine the inverse function F-1 for the triangular distribution. If, a = 5 b = 7 c = 10 Find X when R = .75.


Download ppt "ETM 607 – Random Number and Random Variates"

Similar presentations


Ads by Google