Modeling and Simulation NETW 707

Similar documents
Lecture 6 More on Complete Randomized Block Design (RBD)

2016 Wiley. Study Session 2: Ethical and Professional Standards Application

Scatter Plot x

Chapter 11: Simple Linear Regression and Correlation

Simulated Power of the Discrete Cramér-von Mises Goodness-of-Fit Tests

/ n ) are compared. The logic is: if the two

Here is the rationale: If X and y have a strong positive relationship to one another, then ( x x) will tend to be positive when ( y y)

Statistics for Economics & Business

Lecture 4 Hypothesis Testing

CHAPTER 6 GOODNESS OF FIT AND CONTINGENCY TABLE PREPARED BY: DR SITI ZANARIAH SATARI & FARAHANIM MISNI

Durban Watson for Testing the Lack-of-Fit of Polynomial Regression Models without Replications

Joint Statistical Meetings - Biopharmaceutical Section

Economics 130. Lecture 4 Simple Linear Regression Continued

Dr. Shalabh Department of Mathematics and Statistics Indian Institute of Technology Kanpur

Chapter 6. Random-Number Generation 6.1. Prof. Dr. Mesut Güneş Ch. 6 Random-Number Generation

As is less than , there is insufficient evidence to reject H 0 at the 5% level. The data may be modelled by Po(2).

LINEAR REGRESSION ANALYSIS. MODULE VIII Lecture Indicator Variables

Statistics for Managers Using Microsoft Excel/SPSS Chapter 13 The Simple Linear Regression Model and Correlation

Exam. Econometrics - Exam 1

ANSWERS CHAPTER 9. TIO 9.2: If the values are the same, the difference is 0, therefore the null hypothesis cannot be rejected.

Basic Business Statistics, 10/e

STATISTICS QUESTIONS. Step by Step Solutions.

is the calculated value of the dependent variable at point i. The best parameters have values that minimize the squares of the errors

Department of Quantitative Methods & Information Systems. Time Series and Their Components QMIS 320. Chapter 6

Chapter 14 Simple Linear Regression

Learning Objectives for Chapter 11

Correlation and Regression. Correlation 9.1. Correlation. Chapter 9

[The following data appear in Wooldridge Q2.3.] The table below contains the ACT score and college GPA for eight college students.

January Examinations 2015

First Year Examination Department of Statistics, University of Florida

4.1. Lecture 4: Fitting distributions: goodness of fit. Goodness of fit: the underlying principle

Econ107 Applied Econometrics Topic 3: Classical Model (Studenmund, Chapter 4)

STAT 511 FINAL EXAM NAME Spring 2001

The middle point of each range is used to calculated the sample mean and sample variance as follows:

x = , so that calculated

See Book Chapter 11 2 nd Edition (Chapter 10 1 st Edition)

1. Inference on Regression Parameters a. Finding Mean, s.d and covariance amongst estimates. 2. Confidence Intervals and Working Hotelling Bands

Using T.O.M to Estimate Parameter of distributions that have not Single Exponential Family

Negative Binomial Regression

BOOTSTRAP METHOD FOR TESTING OF EQUALITY OF SEVERAL MEANS. M. Krishna Reddy, B. Naveen Kumar and Y. Ramu

Polynomial Regression Models

Comparison of Regression Lines

Lecture 16 Statistical Analysis in Biomaterials Research (Part II)

Dr. Shalabh Department of Mathematics and Statistics Indian Institute of Technology Kanpur

DO NOT OPEN THE QUESTION PAPER UNTIL INSTRUCTED TO DO SO BY THE CHIEF INVIGILATOR. Introductory Econometrics 1 hour 30 minutes

Basic Statistical Analysis and Yield Calculations

Professor Chris Murray. Midterm Exam

Correlation and Regression

Statistical Inference. 2.3 Summary Statistics Measures of Center and Spread. parameters ( population characteristics )

Properties of Least Squares

ISQS 6348 Final Open notes, no books. Points out of 100 in parentheses. Y 1 ε 2

Chapter 15 Student Lecture Notes 15-1

ECONOMICS 351*-A Mid-Term Exam -- Fall Term 2000 Page 1 of 13 pages. QUEEN'S UNIVERSITY AT KINGSTON Department of Economics

Continuous vs. Discrete Goods

Department of Statistics University of Toronto STA305H1S / 1004 HS Design and Analysis of Experiments Term Test - Winter Solution

Linear regression. Regression Models. Chapter 11 Student Lecture Notes Regression Analysis is the

Interval Estimation in the Classical Normal Linear Regression Model. 1. Introduction

Statistical Evaluation of WATFLOOD

UNIVERSITY OF TORONTO Faculty of Arts and Science. December 2005 Examinations STA437H1F/STA1005HF. Duration - 3 hours

Biostatistics. Chapter 11 Simple Linear Correlation and Regression. Jing Li

x i1 =1 for all i (the constant ).

Composite Hypotheses testing

Lecture 6: Introduction to Linear Regression

The Multiple Classical Linear Regression Model (CLRM): Specification and Assumptions. 1. Introduction

Testing for seasonal unit roots in heterogeneous panels

Comments on Detecting Outliers in Gamma Distribution by M. Jabbari Nooghabi et al. (2010)

18. SIMPLE LINEAR REGRESSION III

DERIVATION OF THE PROBABILITY PLOT CORRELATION COEFFICIENT TEST STATISTICS FOR THE GENERALIZED LOGISTIC DISTRIBUTION

Statistics for Business and Economics

4 Analysis of Variance (ANOVA) 5 ANOVA. 5.1 Introduction. 5.2 Fixed Effects ANOVA

ANSWERS. Problem 1. and the moment generating function (mgf) by. defined for any real t. Use this to show that E( U) var( U)

28. SIMPLE LINEAR REGRESSION III

STAT 3008 Applied Regression Analysis

7.1. Single classification analysis of variance (ANOVA) Why not use multiple 2-sample 2. When to use ANOVA

Topic- 11 The Analysis of Variance

Answers Problem Set 2 Chem 314A Williamsen Spring 2000

Y = β 0 + β 1 X 1 + β 2 X β k X k + ε

Chapter 13: Multiple Regression

where I = (n x n) diagonal identity matrix with diagonal elements = 1 and off-diagonal elements = 0; and σ 2 e = variance of (Y X).

Statistics Chapter 4

Chapter 12 Analysis of Covariance

j) = 1 (note sigma notation) ii. Continuous random variable (e.g. Normal distribution) 1. density function: f ( x) 0 and f ( x) dx = 1

Chapter 8 Indicator Variables

3.1 Expectation of Functions of Several Random Variables. )' be a k-dimensional discrete or continuous random vector, with joint PMF p (, E X E X1 E X

Resource Allocation and Decision Analysis (ECON 8010) Spring 2014 Foundations of Regression Analysis

Chapter 3 Describing Data Using Numerical Measures

Dr. Shalabh Department of Mathematics and Statistics Indian Institute of Technology Kanpur

Chapter 15 - Multiple Regression

Dr. Shalabh Department of Mathematics and Statistics Indian Institute of Technology Kanpur

Simulation and Random Number Generation

Predictive Analytics : QM901.1x Prof U Dinesh Kumar, IIMB. All Rights Reserved, Indian Institute of Management Bangalore

Statistical analysis using matlab. HY 439 Presented by: George Fortetsanakis

The SAS program I used to obtain the analyses for my answers is given below.

Chapter 11: I = 2 samples independent samples paired samples Chapter 12: I 3 samples of equal size J one-way layout two-way layout

NANYANG TECHNOLOGICAL UNIVERSITY SEMESTER I EXAMINATION MTH352/MH3510 Regression Analysis

Computation of Higher Order Moments from Two Multinomial Overdispersion Likelihood Models

Midterm Examination. Regression and Forecasting Models

Linear Approximation with Regularization and Moving Least Squares

Dr. Shalabh Department of Mathematics and Statistics Indian Institute of Technology Kanpur

Chapter 2 - The Simple Linear Regression Model S =0. e i is a random error. S β2 β. This is a minimization problem. Solution is a calculus exercise.

Transcription:

Modelng and Smulaton NETW 707 Lecture 5 Tests for Random Numbers Course Instructor: Dr.-Ing. Magge Mashaly magge.ezzat@guc.edu.eg C3.220 1

Propertes of Random Numbers Random Number Generators (RNGs) must satsfy propertes of Random Numbers: 1. Unformty 2. Independence But what f you are gven some numbers generated by any RNG How to guarantee that they are Unform & Independent random numbers??? Usng Tests for Random Numbers 2

Tests for Random Numbers There are two types of tests: 1. Frequency Tests - Compare the dstrbuton of the set of numbers to a unform dstrbuton - Examples for frequency tests: 1. Kolmogorov-Smrnov Test (KS) 2. Ch-Square Test 2. Autocorrelaton Test Tests the correlaton between numbers and compares the sample correlaton to the expected correlaton of zero 3

Kolmogorov Smrnov Test The KS test compares a contnuous CDF F(x) to an emprcal CDF S N (x) of the sample of N observatons. If the sample from the random number generator s R 1, R 2,, R N, then the emprcal CDF S N (x) s gven by: S N number of R 1, R2, ( x) N, R N whch are x 4

5 Kolmogorov Smrnov Test How to perform the test? 1. Rank the data from smallest to largest: 2. Compute: R N R R 2 1 N R N D 1 max N R D N 1 max 1

Kolmogorov Smrnov Test 3. Compute D=max(D +,D - ) 4. Locate the crtcal value D α n the Kolmogorov Smrnov Crtcal Values Table for the specfed sgnfcance level α and the gven sample sze N 5. Compare: If D D α Accept: No dfference between S N (x) and F (x ) If D > D α Reject: Dfference exsts between S N (x) and F (x) 6

Kolmogorov Smrnov Test Kolmogorov Smrnov Crtcal Values Table 7

Kolmogorov Smrnov Test: Example The fve numbers: 0.44, 0.81, 0.14, 0.05, 0.93 were generated and t s requred to test for unformty usng the Kolmogorov-Smrnov Test wth the level of sgnfcance α = 0.05. 8

Kolmogorov Smrnov Test: Example Soluton: R N N R R 1 n 0.05 0.14 0.44 0.81 0.93 0.2 0.4 0.6 0.8 1 0.15 0.26 0.16 -- 0.07 0.05 -- 0.04 0.21 0.13 D=max(D +,D - ) = max(0.26,0.21) = 0.26 In KS crtcal values table, For α = 0.05 and N = 5, the crtcal value D α = 0.565 Snce D < D α, no dfference has been detected between the true dstrbuton of {R 1, R 2,, R N } and the unform dstrbuton 9

Kolmogorov Smrnov Test: Example Soluton: 10

Ch-square Test The Ch-square test uses the sample statstc: 2 0 Where: O = the number of observatons n the -th class E = the expected number n the -th class n = the number of classes. n 1 O E E 2 11

Ch-square Test 1. Rank the data from smallest to largest: R 1 R 2 R N 2. Dvde the Range R N -R 1 n n equdstant ntervals such that each nterval has at least 5 observatons. 3. Calculate: 2 0 n 1 O E E 2 12

Ch-square Test 4. For sgnfcance level α, utlze the table of (Percentage ponts of the ch square dstrbuton wth ν degrees of freedom) to determne χ α,n-1 5. Compare If χ 0 2 χ 2 α,n-1 Accept: No dfference between S N (x) and F(x) If χ 0 2 > χ 2 α,n-1 Reject: Dfference exsts between S N (x) and F(x) 13

Ch-square Test Percentage ponts of the CHI SQUARE dstrbuton wth ν degrees of freedom 14

Ch-square Test: Example Use the ch-square test wth α=0.05 to test whether the data shown next are unformly dstrbuted. 0.34 0.90 0.25 0.89 0.87 0.44 0.12 0.21 0.46 0.67 0.83 0.76 0.79 0.64 0.70 0.81 0.94 0.74 0.22 0.74 0.96 0.99 0.77 0.67 0.56 0.41 0.52 0.73 0.99 0.02 0.47 0.30 0.17 0.82 0.56 0.05 0.45 0.31 0.78 0.05 0.79 0.71 0.23 0.19 0.82 0.93 0.65 0.37 0.39 0.42 0.99 0.17 0.99 0.46 0.05 0.66 0.10 0.42 0.18 0.49 0.37 0.51 0.54 0.01 0.81 0.28 0.69 0.34 0.75 0.49 0.72 0.43 0.56 0.97 0.30 0.94 0.96 0.58 0.73 0.05 0.06 0.39 0.84 0.24 0.40 0.64 0.40 0.19 0.79 0.62 0.18 0.26 0.97 0.88 0.64 0.47 0.60 0.11 0.29 0.78 15

Ch-square Test: Example Soluton: Interval O E O E 2 1 8 10-2 4 0.4 2 8 10-2 4 0.4 3 10 10 0 0 0 4 9 10-1 1 0.1 5 12 10 2 4 0.4 6 8 10-2 4 0.4 7 10 10 0 0 0 8 14 10 4 16 1.6 9 10 10 0 0 0 10 11 10 1 1 0.1 100 100 0 3.4 O E O E 2 E 16

Ch-square Test: Example Soluton: The test uses n=10 ntervals of equal length, namely [0,0.1[, [0.1,0.2[,, [0.9,1] The value of χ 02 =3.4 From table (Percentage ponts of the CHI SQUARE dstrbuton wth ν degrees of freedom), the crtcal value of χ 0.05,9 =16.9 Snce χ 02 < χ 0.05,9, the hypothess of unform dstrbuton s not rejected. 17

Notes on Unformty Tests Both the Kolmogorov-Smrnov test and the ch-square test are acceptable for testng the unformty of sample data provded that the sample sze s large. The KS test can be appled to small sample szes, whereas the ch-square test s vald only for large samples, e.g.: N 50. The KS test s more powerful and s recommended 18

Test for Auto-correlaton The tests for auto-correlaton are concerned wth the dependence between numbers n a sequence. Example: 0.12 0.01 0.23 0.28 0.89 0.31 0.64 0.28 0.83 0.93 0.99 0.15 0.33 0.35 0.91 0.41 0.60 0.27 0.75 0.88 0.68 0.49 0.05 0.43 0.95 0.58 0.19 0.36 0.69 0.87 Examnaton of the 5 th, 10 th, 15 th,,etc. ndcates a large number n that poston. 19

Test for Auto-correlaton The test requres the computaton of the autocorrelaton between every m numbers (m s known as the lag), startng wth the th number: The autocorrelaton ρ m of nterest shall be between numbers: R, R +m, R +2m, R +(M+1)m M s the largest nteger such that +(M+1)m N If the values are uncorrelated: For large values of M, the dstrbuton of the estmator of ρ m, denoted s approxmately normal. 20

Test for Auto-correlaton Test statstc s: Where: ˆ m ˆ m 1 M 1 13M 7 12 M 1 k 0 Z 0 s dstrbuted normally wth mean = 0 and varance = 1. Z M 0 R ˆ km m ˆ m R k 1 m 0.25 21

Test for Auto-correlaton Test Steps: 1. Compute Z 0 2. The hypothess of ndependence s not rejected f: z Z z / 2 0 / 2 Where α s the level of sgnfcance and z α/2 s obtaned from the standard normal dstrbuton table. / 2 -Z / 2 Z / 2 / 2 22

Test for Auto-correlaton The standard normal dstrbuton table 23

Test for Auto-correlaton Test Steps: 3. If numbers are correlated, determne the type of correlaton If ρ m > 0, the subsequence has postve autocorrelaton Hgh random numbers tend to be followed by hgh ones, and vce versa. If ρ m < 0, the subsequence has negatve autocorrelaton Low random numbers tend to be followed by hgh ones, and vce versa. 24

Test for Auto-correlaton: Example Test whether the 3 rd, 8 th, 13 th, random varables are correlated for the followng output usng α = 0.05. 0.12 0.01 0.23 0.28 0.89 0.31 0.64 0.28 0.83 0.93 0.99 0.15 0.33 0.35 0.91 0.41 0.60 0.27 0.75 0.88 0.68 0.49 0.05 0.43 0.95 0.58 0.19 0.36 0.69 0.87 25

Test for Auto-correlaton: Example Soluton: = 3, m = 5, N = 30, 3+(M+1)5 30 M = 4 M 1 ˆ 1 m R kmr M k 0 ˆ ˆ 35 35 ˆ 1 4 1 0.1945 35 13M 12 k 1 m 0.25 0.230.28 0.280.33 0.330.27 0.270.05 0.050.36 7 13 4 M 1 124 1 7 0.128 0.25 26

Test for Auto-correlaton: Example Soluton: The test statstc s gven by: ˆ m 0.1945 Z 0.1280 From the standard normal dstrbuton table, the crtcal value s: Snce 0 ˆ z m 0.05/ 2 z0.025 z 0.1516 1.96 0.025 Z0 z0.025 The hypothess of ndependence cannot be rejected 27

Test for Auto-correlaton: Example Soluton: The test statstc s gven by: ˆ m 0.1945 Z 0.1280 From the standard normal dstrbuton table, the crtcal value s: Snce 0 ˆ z m 0.05/ 2 z0.025 z 0.1516 1.96 0.025 Z0 z0.025 The hypothess of ndependence cannot be rejected 28

References NETW 707 Lectures sldes by A. Prof. Tallal El-Shabrawy, 2016 & 2017 NETW 707 Lectures sldes by Dr. Akram Al, 2014 Smulaton Modelng and Analyss by Averll M. Law, 5 th Edton, 2015 F. J. Massey, The Kolmogorov-Smrnov Test for Goodness of Ft, The Journal of the Amercan Statstcal Assocaton, Vol. 46, 1951, p.70 R. J. Wonnacolt, T.H. Wonnacolt, Statstcs: Dscoverng Its Power, New Yor,: John Wley and Sons, 1982, p.352 29