Tests for Random Numbers Dr. Akram Ibrahim Aly Lecture (9)

Slides:



Advertisements
Similar presentations
1 Chi-Square Test -- X 2 Test of Goodness of Fit.
Advertisements

Lecture (11,12) Parameter Estimation of PDF and Fitting a Distribution Function.
Ch8 Inference concerning variance
Hypothesis Testing Steps in Hypothesis Testing:
CmpE 104 SOFTWARE STATISTICAL TOOLS & METHODS MEASURING & ESTIMATING SOFTWARE SIZE AND RESOURCE & SCHEDULE ESTIMATING.
Ch11 Curve Fitting Dr. Deshi Ye
Chapter 12 Chi-Square Tests and Nonparametric Tests
Random Number Generation
Chap 9-1 Statistics for Business and Economics, 6e © 2007 Pearson Education, Inc. Chapter 9 Estimation: Additional Topics Statistics for Business and Economics.
Bivariate Statistics GTECH 201 Lecture 17. Overview of Today’s Topic Two-Sample Difference of Means Test Matched Pairs (Dependent Sample) Tests Chi-Square.
Copyright (c) 2004 Brooks/Cole, a division of Thomson Learning, Inc. Chapter 14 Goodness-of-Fit Tests and Categorical Data Analysis.
1 Simulation Modeling and Analysis Pseudo-Random Numbers.
Copyright (c) 2004 Brooks/Cole, a division of Thomson Learning, Inc. Chapter 4 Continuous Random Variables and Probability Distributions.
1/49 EF 507 QUANTITATIVE METHODS FOR ECONOMICS AND FINANCE FALL 2008 Chapter 9 Estimation: Additional Topics.
Lecture 5 Correlation and Regression
Fall 2011 CSC 446/546 Part 6: Random Number Generation.
ETM 607 – Random Number and Random Variates
AM Recitation 2/10/11.
Introduction to Linear Regression and Correlation Analysis
1 Level of Significance α is a predetermined value by convention usually 0.05 α = 0.05 corresponds to the 95% confidence level We are accepting the risk.
NONPARAMETRIC STATISTICS
Topics: Statistics & Experimental Design The Human Visual System Color Science Light Sources: Radiometry/Photometry Geometric Optics Tone-transfer Function.
Statistical Decision Making. Almost all problems in statistics can be formulated as a problem of making a decision. That is given some data observed from.
Two Variable Statistics
Chapter 9: Non-parametric Tests n Parametric vs Non-parametric n Chi-Square –1 way –2 way.
1 Statistical Distribution Fitting Dr. Jason Merrick.
Tests for Random Number Generators Jin Ui Yim Inseok Oh Junghoon Yang.
CPSC 531: RN Generation1 CPSC 531:Random-Number Generation Instructor: Anirban Mahanti Office: ICT Class Location:
Chapter 7 Random-Number Generation
Copyright (C) 2002 Houghton Mifflin Company. All rights reserved. 1 Understandable Statistics S eventh Edition By Brase and Brase Prepared by: Lynn Smith.
CS433: Modeling and Simulation Dr. Anis Koubâa Al-Imam Mohammad bin Saud University 15 October 2010 Lecture 05: Statistical Analysis Tools.
The Examination of Residuals. Examination of Residuals The fitting of models to data is done using an iterative approach. The first step is to fit a simple.
1 Chapter 12 Simple Linear Regression. 2 Chapter Outline  Simple Linear Regression Model  Least Squares Method  Coefficient of Determination  Model.
MEGN 537 – Probabilistic Biomechanics Ch.5 – Determining Distributions and Parameters from Observed Data Anthony J Petrella, PhD.
1 Chi-squared Test (1) H 0 : population follows distribution Divide the observations into k bins O i = observed frequency in i-th bin E i = expected frequency.
Tests of Random Number Generators
Physics 270 – Experimental Physics. Let say we are given a functional relationship between several measured variables Q(x, y, …) x ±  x and x ±  y What.
Copyright © Cengage Learning. All rights reserved. 12 Analysis of Variance.
Copyright (C) 2002 Houghton Mifflin Company. All rights reserved. 1 Understandable Statistics S eventh Edition By Brase and Brase Prepared by: Lynn Smith.
Virtual University of Pakistan Lecture No. 44 of the course on Statistics and Probability by Miss Saleha Naghmi Habibullah.
Testing Random-Number Generators Andy Wang CIS Computer Systems Performance Analysis.
© Copyright McGraw-Hill 2004
Week 13a Making Inferences, Part III t and chi-square tests.
Chapter 15 The Chi-Square Statistic: Tests for Goodness of Fit and Independence PowerPoint Lecture Slides Essentials of Statistics for the Behavioral.
Statistical Inference Statistical inference is concerned with the use of sample data to make inferences about unknown population parameters. For example,
1 Chi-square Test Dr. T. T. Kachwala. Using the Chi-Square Test 2 The following are the two Applications: 1. Chi square as a test of Independence 2.Chi.
Section 6.4 Inferences for Variances. Chi-square probability densities.
Correlation. u Definition u Formula Positive Correlation r =
Lesson Test to See if Samples Come From Same Population.
Environmental Modeling Basic Testing Methods - Statistics II.
MONTE CARLO METHOD DISCRETE SIMULATION RANDOM NUMBER GENERATION Chapter 3 : Random Number Generation.
MEGN 537 – Probabilistic Biomechanics Ch.5 – Determining Distributions and Parameters from Observed Data Anthony J Petrella, PhD.
Chapter 11: Categorical Data n Chi-square goodness of fit test allows us to examine a single distribution of a categorical variable in a population. n.
Statistical Decision Making. Almost all problems in statistics can be formulated as a problem of making a decision. That is given some data observed from.
CHI SQUARE DISTRIBUTION. The Chi-Square (  2 ) Distribution The chi-square distribution is the probability distribution of the sum of several independent,
Virtual University of Pakistan
Virtual University of Pakistan
Chapter 4. Inference about Process Quality
Goodness of Fit x² -Test
Elementary Statistics: Picturing The World
Hypothesis Theory examples.
Chapter 7 Random Number Generation
Chapter 7 Random-Number Generation
Properties of Random Numbers
Basic analysis Process the data validation editing coding data entry
Statistical Process Control
Hypothesis Tests for a Standard Deviation
Random Number Generation
Skills 5. Skills 5 Standard deviation What is it used for? This statistical test is used for measuring the degree of dispersion. It is another way.
Chapter 9 Estimation: Additional Topics
Presentation transcript:

Tests for Random Numbers Dr. Akram Ibrahim Aly Lecture (9)

Tests for Random Numbers Frequency Tests: compare the distribution of the set of numbers to a uniform distribution – Kolmogorov-Smirnov (KS) – Chi-Square Test. Autocorrelation Test: Test the correlation between numbers and compares the sample correlation to the expected correlation of zero.

The Kolmogorov-Smirnov Test The KS test compares a continuous CDF F(x) to an empirical CDF S N (x), of the sample of N observations. If the sample from the random number generator is R 1, R 2, …, R N, then the empirical CDF S N (x) is given by:

The Kolmogorov-Smirnov Test Step 1: – Rank the data from smallest to largest: Step 2: – Compute:

The Kolmogorov-Smirnov Test Step 3: – Compute D=max(D +,D - ) Step 4: – locate the critical value D α in the “Kolmogorov Smirnov Critical Values table” for the specified significance level α and the given sample size (N) Step 5: – If D ≤ D α → Accept: “No difference between S N (x) and F(x)” – If D > D α → Reject: “No difference between S N (x) and F(x)”

The K-S Test, Kolmogorov Smirnov Critical Values Table

Example: The K-S Test The five numbers: 0.44, 0.81, 0.14, 0.05, 0.93 were generated and it is required to test for uniformity using the Kolmogorov-Smirnov Test with the level of significance α = 0.05.

Solution D=max(D +,D - ) = max(0.26,0.21) = 0.26 In KS critical values table, For α = 0.05 and N = 5, the critical value D α = Since D < D α, no difference has been detected between the true distribution of {R 1, R 2, …, R N } and the uniform distribution

Solution: The K-S Test

The Chi-square Test The chi-square test uses the sample statistic: Where: – O i = the number of observations in the i-th class – E i = the expected number in the i-th class – n = the number of classes.

The Chi-square Test Step 1: – Rank the data from smallest to largest: Step 2: – Divide the Range R N -R 1 in n equidistant intervals such that each interval has at least 5 observations. Step 3: – Calculate:

The Chi-square Test Step 4: – For significant level α, utilize the table of (Percentage points of the chi square distribution with ν degrees of freedom) to determine χ α,n-1. Step 5: – If χ 0 2 ≤ χ 2 α,n-1 → Accept: “No difference between S N (x) and F(x)” – If χ 0 2 > χ 2 α,n-1 → Reject: “No difference between S N (x) and F(x)”

Example Use the chi-square test with α=0.05 to test whether the data shown next are uniformly distributed

Solution Interval

Solution The test uses n=10 intervals of equal length, namely [0,0.1[, [0.1,0.2[, …, [0.9,1] The value of χ 0 2 =3.4 From table (Percentage points of the CHI SQUARE distribution with ν degrees of freedom), the critical value of χ 0.05,9 =16.9 Since χ 0 2 < χ 0.05,9, the hypothesis of uniform distribution is not rejected.

Percentage points of the CHI SQUARE distribution with ν degrees of freedom

Notes on Uniformity tests Both the Kolmogorov-Smirnov test and the chi- square test are acceptable for testing the uniformity of sample data provided that the sample size is large. The KS test can be applied to small sample sizes, whereas the chi-square test is valid only for large samples, e.g.: N ≥ 50. The KS test is more powerful and is recommended

Test for Auto-correlation The tests for auto-correlation are concerned with the dependence between numbers in a sequence. Example: – Examination of the 5 th, 10 th, 15 th, …,etc. indicates a large number in that position

Test for Auto-correlation The test requires the computation of the autocorrelation between every m numbers (m is known as the lag), starting with the i th number: – The autocorrelation ρ im of interest shall be between numbers: R i, R i+m, R i+2m, R i+(M+1)m – M is the largest integer such that i+(M+1)m ≤ N If the values are uncorrelated: – For large values of M, the distribution of the estimator of ρ im, denoted is approximately normal.

Test for Auto-correlation Test statistics is: Where: Z 0 is distributed normally with mean = 0 and variance = 1.

Test for Auto-correlation Compute Z 0 The hypothesis of independence is not rejected if: Where α is the level of significance and z α/2 is obtained from the standard normal distribution table.

Test for Auto-correlation Figure illustrates the test

Test for Auto-correlation If ρ im > 0, the subsequence has positive autocorrelation – High random numbers tend to be followed by high ones, and vice versa. If ρ im < 0, the subsequence has negative autocorrelation – Low random numbers tend to be followed by high ones, and vice versa.

Example Test whether the 3 rd, 8 th, 13 th, and so on, for the following output using α =

Solution i = 3, m = 5, N = 30, 3+(M+1)5 ≤ 30→ M = 4

Solution The test statistic is given by: From the standard normal distribution table, the critical value is: Since The hypothesis of independence cannot be rejected

The standard normal distribution table