Suites of Tests. DIEHARD TESTS (Marsaglia, 1985) See

Similar documents
Simulation and Random Number Generation

Probability and Random Variable Primer

Chapter 2 Transformations and Expectations. , and define f

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

Notes prepared by Prof Mrs) M.J. Gholba Class M.Sc Part(I) Information Technology

Maximum Likelihood Estimation of Binary Dependent Variables Models: Probit and Logit. 1. General Formulation of Binary Dependent Variables Models

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

First Year Examination Department of Statistics, University of Florida

CS 2750 Machine Learning. Lecture 5. Density estimation. CS 2750 Machine Learning. Announcements

Maximum Likelihood Estimation of Binary Dependent Variables Models: Probit and Logit. 1. General Formulation of Binary Dependent Variables Models

Probability Theory (revisited)

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

Probability Theory. The nth coefficient of the Taylor series of f(k), expanded around k = 0, gives the nth moment of x as ( ik) n n!

Binomial Distribution: Tossing a coin m times. p = probability of having head from a trial. y = # of having heads from n trials (y = 0, 1,..., m).

Propagation of error for multivariable function

Why Monte Carlo Integration? Introduction to Monte Carlo Method. Continuous Probability. Continuous Probability

PhysicsAndMathsTutor.com

Hydrological statistics. Hydrological statistics and extremes

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

RELIABILITY ASSESSMENT

Modeling and Simulation NETW 707

b ), which stands for uniform distribution on the interval a x< b. = 0 elsewhere

Generative classification models

9.07 Introduction to Probability and Statistics for Brain and Cognitive Sciences Emery N. Brown

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

Lecture 3: Probability Distributions

Distributions /06. G.Serazzi 05/06 Dimensionamento degli Impianti Informatici distrib - 1

Equilibrium Analysis of the M/G/1 Queue

Module 3 LOSSY IMAGE COMPRESSION SYSTEMS. Version 2 ECE IIT, Kharagpur

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)

Copyright 2017 by Taylor Enterprises, Inc., All Rights Reserved. Adjusted Control Limits for P Charts. Dr. Wayne A. Taylor

MIMA Group. Chapter 2 Bayesian Decision Theory. School of Computer Science and Technology, Shandong University. Xin-Shun SDU

Probability-Theoretic Junction Trees

A REVIEW OF ERROR ANALYSIS

Statistics Spring MIT Department of Nuclear Engineering

MATH 829: Introduction to Data Mining and Analysis The EM algorithm (part 2)

Limited Dependent Variables

Correlation and Regression. Correlation 9.1. Correlation. Chapter 9

Lecture Nov

A be a probability space. A random vector

Homework 9 for BST 631: Statistical Theory I Problems, 11/02/2006

Engineering Risk Benefit Analysis

ST2352. Working backwards with conditional probability. ST2352 Week 8 1

Credit Card Pricing and Impact of Adverse Selection

Inner Product. Euclidean Space. Orthonormal Basis. Orthogonal

NUMERICAL DIFFERENTIATION

Chapter 1. Probability

18.1 Introduction and Recap

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

Expected Value and Variance

The Geometry of Logit and Probit

Line Drawing and Clipping Week 1, Lecture 2

Lecture 21: Numerical methods for pricing American type derivatives

Sampling Theory MODULE VII LECTURE - 23 VARYING PROBABILITY SAMPLING

Simulation and Probability Distribution

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

Portfolios with Trading Constraints and Payout Restrictions

AS-Level Maths: Statistics 1 for Edexcel

Markov Chain Monte Carlo (MCMC), Gibbs Sampling, Metropolis Algorithms, and Simulated Annealing Bioinformatics Course Supplement

TAIL BOUNDS FOR SUMS OF GEOMETRIC AND EXPONENTIAL VARIABLES

Errors for Linear Systems

CHAPTER 14 GENERAL PERTURBATION THEORY

Lecture 6 More on Complete Randomized Block Design (RBD)

Composite Hypotheses testing

U.C. Berkeley CS294: Beyond Worst-Case Analysis Luca Trevisan September 5, 2017

Chat eld, C. and A.J.Collins, Introduction to multivariate analysis. Chapman & Hall, 1980

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

Classification learning II

A Robust Method for Calculating the Correlation Coefficient

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

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

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

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

CIS526: Machine Learning Lecture 3 (Sept 16, 2003) Linear Regression. Preparation help: Xiaoying Huang. x 1 θ 1 output... θ M x M

A random variable is a function which associates a real number to each element of the sample space

Notes on Frequency Estimation in Data Streams

MACHINE APPLIED MACHINE LEARNING LEARNING. Gaussian Mixture Regression

Randomness and Computation

Machine learning: Density estimation

ME 501A Seminar in Engineering Analysis Page 1

Homework Assignment 3 Due in class, Thursday October 15

Double Acceptance Sampling Plan for Time Truncated Life Tests Based on Transmuted Generalized Inverse Weibull Distribution

Strong Markov property: Same assertion holds for stopping times τ.

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

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

Economics 130. Lecture 4 Simple Linear Regression Continued

Finding Dense Subgraphs in G(n, 1/2)

Basic Statistical Analysis and Yield Calculations

CS-433: Simulation and Modeling Modeling and Probability Review

Additional Codes using Finite Difference Method. 1 HJB Equation for Consumption-Saving Problem Without Uncertainty

The written Master s Examination

Chapter 5. Solution of System of Linear Equations. Module No. 6. Solution of Inconsistent and Ill Conditioned Systems

Module 2. Random Processes. Version 2 ECE IIT, Kharagpur

The Fourier Transform

Unfortunately, no one has yet learned how to generate quasi-random numbers like this.

Lossy Compression. Compromise accuracy of reconstruction for increased compression.

APPROXIMATE PRICES OF BASKET AND ASIAN OPTIONS DUPONT OLIVIER. Premia 14

Monte Carlo Simulation and Generation of Random Numbers

Convergence of random processes

Topic 5: Non-Linear Regression

Transcription:

Sutes of Tests DIEHARD TESTS (Marsagla, 985 See http://stat.fsu.edu/~geo/dehard.html NIST Test sute- 6 tests on the sequences of bts http://csrc.nst.gov/rng/ Test U0 Includes the above tests. http://www.ro.umontreal.ca/~lecuyer/

Numercal Recpes Provdes C or Fortran Code for a number of numercal routnes ncludng random number generators http:\\lb-www.lanl.gov/numercal/bookcpdf.html

Increasng perod of generatorshufflng

Eample of shufflng

Sums or dfferences mod(m (see Fshman Sect. 7.3

Generatng non-unform random varates.

The nverse transform

Inverse transform for a Contnuous Dstrbuton Suppose we wsh to generate a random varable from a dstrbuton wth probablty densty functon f ( /, 0 < < Then the c.d.f. s F( Inverse / 4, for 0 < <.. F ( U U so s U where U s U[0,] the requred generator.

Eample: Inverse transform for a dscrete dstrbuton Consder the dstrbuton wth probablty functon P[ ] /0, for,,3,4. Then the nverse transform method results n the generator F ( U 3 4 U <.. U <.3.3 U <.6.6 U

Graph of c.d.f

Eponental dstrbuton generator.

j Geometrc Dstrbuton Generator Geometrc( f ( The F ( Then, F(j - ( cumulatve solvng < U p p ( log( - U log( - p Dstrbut p F(j p, for dstrbut on functon s [ ], where [] for an nteger gves where on has,,... j denotes probablt y functon denotes such that the celng. nteger part.

Bnomal generators Bnomal(n,p, n small -nverse transform or use n I( U < p Bnomal(n,p, n large, p small nf{ ; + G > n}, where G acceptance-rejecton log(- U log(- p geometrc( p

Cauchy

What f ncrements n a tme seres returns have a Cauchy dstrbuton???? plot(0+cumsum(.00./tan(p*rand(,0000

Generators n Matlab and R(Splus

Acceptance Rejecton

Acceptance-rejecton (cont

Acceptance-rejecton Suppose a probablty densty f( has c.d.f. that s NOT easly nverted. We cannot use nverse transform. How do we use the above theorem to generate from f(? Generate a pont at random (unformly under the graph of f( and output the coordnate (how? Pck the pont at random unformly n some larger regon and use t only f t s under f(

Eample Generate U[a,b] Generate Y U[0,c] If Y<f(, then accept (.e. output otherwse generate new values of,y and contnue untl one s accepted.

Acceptance-Rejecton: Dscrete Random varables Want to generate such that P[ ] We are able easly to generatey wth P[ Y ] q. p Suppose there s some constant c such that c. q Method GenerateY, say Accept ths value (.e. put wth probablty Otherwse generate new Y. p. p / cq.

Eample: acceptance rejecton for dscrete random varables E.g. generate r.v. wth probablty functon P[ k p q 0.98. ] c k 00k,,,...,00 where Here q 9.3 for all 00 y<-celng(00*runf(00000; <-y[runf(00000</y]; hst(, freq FALSE, breaks 50, p k,...,00 and, p cq.

When to use acceptance-rejecton (dscrete or contnuous The c.d.f. F( s ether hard to obtan or hard to nvert. We know the p.d.f. f( We can fnd another p.d.f. g( such that It s easy (e.g. by nverse transform to generate from random varables wth p.d.f. g(. Ideally cg( close to f( (.e. c close to f all ( cg ( for and some c.

. 3 45 where ( ( have we 0, ( gven by p.d.f. that wth Notce,0 ( 6 45 ( from p.d.f. r.v. a Generate 4 / < < < < c cg f g f Eample

Effcency of Acceptance- Rejecton Algorthm Probablty that we accept on each teraton(area under f(/(area under cg( /c Probablty we need to generate n ponts before generatng one accepted n ( c c Ths s a geometrc dstrbuton wth probablty p/c Epected number of tmes through loop to generate one s c.

Eample. Gamma(3/, Dstrbuton Want to generate gamma random varable by acceptance rejecton. f ( Γ (3/ / e, > 0 Try domnatng wth an eponental dstrbuton g( λe λ, > 0. f ( cg( f c ma( f ( / g(. For effcent method, we may choose λ so that c ma( f ( / g( s small. The best value of λ /3.(gves an eponental wth the same mean, 3/, as ths gamma dstrbuton.

Bvarate normal p.d.f. f (, y ep( π + y

The Bo-Muller transformaton for normal random varables

The Bo-Muller transformaton for normal random varables (graph

Bo-Muller generator Generate R ln( U and Θ π U, whereu, U ndep U[0,]. Put R cos( Θ, Y R sn( Θ Then (, Y ndependent N(0,

Bo-Muller & lattce Structure Can use nverse transform to machne precson: P.J. Acklam (003 http://home.onlne.no/~pjacklam/notes/nvnorm/

. Generate. If 3. Let R Y Z Z Z Marsagla Polar Normal generator + Z RZ RZ + + Z Z Z, Z >, GO TO. ln( Z,, ndep. U[-,], Then (, Y are ndep N(0, + Z

Generatng Dependent Normal ( Put ndependent N(0,., Generate. where,, but wth correlaton(,,, Normal(, Suppose we want Y Y ρ ρ σ µ σ µ ρ ρ σ µ + + + < <

Obtan the sngular value decomposton of the covarance matr so that Σ AA' for some matr A Defne AY + µ wherey`s vector of ndependent N(0, Then s mvnorm( µ,aa' Σ rmvnorm <- functon(n, meanrep(0, nrow(sgma, sgmadag(length(mean{ f(nrow(sgma! ncol(sgma{stop("sgma must be a square matr" } f(length(mean! nrow(sgma{ stop("mean and sgma have nonconformng sze" } ev <- egen(sgma, sym TRUE$values f (!all(ev > -sqrt(.machne$double.eps * abs(ev[] warnng("sgma s numercally not postve defnte" sgsvd <- svd(sgma retval <- t(sgsvd$v %*% (t(sgsvd$u * sqrt(sgsvd$d retval <- matr(rnorm(n * ncol(sgma, nrow n %*% retval retval <- sweep(retval,, mean, "+" retval} (R code from http://lb.stat.cmu.edu/r/cran/

The lognormal dstrbuton

Composton: for mtures of dstrbutons. Suppose a c.d.f. takes the form n j ( for and wth c.d.f.'s > 0 wth (. Frst choose random I,,... n wth probabltes p p F p F and then generate from the c.d.f. F p I (.

Eample: Composton 4 / / 4 4 3 set 0.4, If., Generate (, ( 0.6 0.4 (,0.4 0.8 ( U else U U U U F F F f < + < < +

λ Posson(. Use Posson process; for small nf{ n; n + U < e λ or nverse transform } λ For large use acceptance-rejecton λ

Mean squared error for medan of Cauchy n R n <- 0 nsm <- 50000 t<-proc.tme([] thetahat <- double(nsm for ( n :nsm { <- rcauchy(n thetahat[] <- medan( } mean(thetahat^ cat("calculaton took", (proc.tme([]-t, "seconds.\n" hst(thetahat, freq FALSE, breaks 00 curve(dnorm(, sd sqrt(mean(thetahat^, add TRUE curve(dnorm(, sd sqrt( / (4 * n * dcauchy(0^, add TRUE, col "red" 50000 smulatons of a medan from a Cauchy sample of sze 0. The red curve s the normal appromaton wth se estmated usng the cauchy densty; the black curve uses the standard devaton of the estmates.

Gamma( dstrbuton 0 0, 0,, ( ( / > > Γ β α β α α β α e f β α, freedom of wth n degrees - squared ch called s Gamma,, / f and Ep(/ s then, If var(, (, Gam( s., Gam s then, are ndependen t Gam( If β α β α β α β α β α β α β α n E c c ( n n : Propertes

Some gamma p.d.f.

Gamma tmes Beta

Gamma dstrbuton generators (cont when α >, agan use acceptance rejecton (domnate wth a functon lke g( cp ( c + p p for a sutable constant c or f α small (e.g..6 add ndependen t Gamma(0.6, + Gamma(,

Gamma dstrbuton generators. when α β α s ln( U a small,. When α <, β, use acceptance - rejecton wth eα g( e + α e e + α and c eαγ( α α U,, nteger are U[0,] <

Beta Dstrbuton for a and b small

Logstc Ft to Normal f logt vs. Probt b e ( + e ( a/ b ( ( a/ b

Symmetrc stable laws (specal cases. Normal dstrbuton (alpha. Cauchy dstrbuton (alpha 3. For most normal-lke data,.5<alpha< Lke the normal dstrbuton, the sum of ndependent stable(alpha random varables s stable(alpha.

Symmetrc Stable dstrbutons f c ( παc k 0 ( k k Γ( α + (k! ( y c k In the case c generate usng

Symmetrc stable random walk, alpha.7

Smulatng the Law of large numbers. z<-:0000 <-cumsum(rnorm(0000,0,/z; <-cumsum(rstable(0000,.7/z; # must defne rstable 3<-cumsum(rstable(0000,.3/z; 4<-cumsum(rt(0000,/z; plot(z,, l,col red lnes(z,,col green lnes(z,3,col blue lnes(z,4, col black"