• Ingen resultater fundet

Stochastic Simulation Randum number generatation

N/A
N/A
Info
Hent
Protected

Academic year: 2022

Del "Stochastic Simulation Randum number generatation"

Copied!
121
0
0

Indlæser.... (se fuldtekst nu)

Hele teksten

(1)

Stochastic Simulation

Randum number generatation

Bo Friis Nielsen

Institute of Mathematical Modelling Technical University of Denmark 2800 Kgs. Lyngby – Denmark Email: bfn@imm.dtu.dk

(2)

Random number generation

Random number generation

(3)

Bo Friis Nielsen – 17/6-2001 C04245 2

Random number generation Random number generation

• Uniform distribution

(4)

Random number generation Random number generation

• Uniform distribution

• Number theory

(5)

Bo Friis Nielsen – 17/6-2001 C04245 2

Random number generation Random number generation

• Uniform distribution

• Number theory

• Testing of random numbers

(6)

Random number generation Random number generation

• Uniform distribution

• Number theory

• Testing of random numbers

Recommendations of random number generators

(7)

Bo Friis Nielsen – 17/6-2001 C04245 3

History/background

History/background

(8)

History/background History/background

• The need for random numbers evident

(9)

Bo Friis Nielsen – 17/6-2001 C04245 3

History/background History/background

• The need for random numbers evident

• Tables

(10)

History/background History/background

• The need for random numbers evident

• Tables

• Physical generators.

(11)

Bo Friis Nielsen – 17/6-2001 C04245 3

History/background History/background

• The need for random numbers evident

• Tables

• Physical generators. Lottery machines

(12)

History/background History/background

• The need for random numbers evident

• Tables

• Physical generators. Lottery machines

• Need for computer generated numbers

(13)

Bo Friis Nielsen – 17/6-2001 C04245 4

Mid-square method - Von Neumann

Mid-square method - Von Neumann

(14)

Mid-square method - Von Neumann Mid-square method - Von Neumann

• Four digit integer

(15)

Bo Friis Nielsen – 17/6-2001 C04245 4

Mid-square method - Von Neumann Mid-square method - Von Neumann

• Four digit integer

• square it.

(16)

Mid-square method - Von Neumann Mid-square method - Von Neumann

• Four digit integer

• square it. Take the middle four digits

(17)

Bo Friis Nielsen – 17/6-2001 C04245 4

Mid-square method - Von Neumann Mid-square method - Von Neumann

• Four digit integer

• square it. Take the middle four digits repeat

i Zi Ui Zi2

(18)

Mid-square method - Von Neumann Mid-square method - Von Neumann

• Four digit integer

• square it. Take the middle four digits repeat

i Zi Ui Zi2 0 7182

(19)

Bo Friis Nielsen – 17/6-2001 C04245 4

Mid-square method - Von Neumann Mid-square method - Von Neumann

• Four digit integer

• square it. Take the middle four digits repeat

i Zi Ui Zi2 0 7182 -

(20)

Mid-square method - Von Neumann Mid-square method - Von Neumann

• Four digit integer

• square it. Take the middle four digits repeat

i Zi Ui Zi2

0 7182 - 51,581,124

(21)

Bo Friis Nielsen – 17/6-2001 C04245 4

Mid-square method - Von Neumann Mid-square method - Von Neumann

• Four digit integer

• square it. Take the middle four digits repeat

i Zi Ui Zi2

0 7182 - 51,581,124

1

(22)

Mid-square method - Von Neumann Mid-square method - Von Neumann

• Four digit integer

• square it. Take the middle four digits repeat

i Zi Ui Zi2

0 7182 - 51,581,124

1 5811

(23)

Bo Friis Nielsen – 17/6-2001 C04245 4

Mid-square method - Von Neumann Mid-square method - Von Neumann

• Four digit integer

• square it. Take the middle four digits repeat

i Zi Ui Zi2

0 7182 - 51,581,124

1 5811 0.5811

(24)

Mid-square method - Von Neumann Mid-square method - Von Neumann

• Four digit integer

• square it. Take the middle four digits repeat

i Zi Ui Zi2

0 7182 - 51,581,124

1 5811 0.5811 33,767,721

(25)

Bo Friis Nielsen – 17/6-2001 C04245 4

Mid-square method - Von Neumann Mid-square method - Von Neumann

• Four digit integer

• square it. Take the middle four digits repeat

i Zi Ui Zi2

0 7182 - 51,581,124

1 5811 0.5811 33,767,721 2

(26)

Mid-square method - Von Neumann Mid-square method - Von Neumann

• Four digit integer

• square it. Take the middle four digits repeat

i Zi Ui Zi2

0 7182 - 51,581,124

1 5811 0.5811 33,767,721 2 7677

(27)

Bo Friis Nielsen – 17/6-2001 C04245 4

Mid-square method - Von Neumann Mid-square method - Von Neumann

• Four digit integer

• square it. Take the middle four digits repeat

i Zi Ui Zi2

0 7182 - 51,581,124

1 5811 0.5811 33,767,721 2 7677 0.7677

(28)

Mid-square method - Von Neumann Mid-square method - Von Neumann

• Four digit integer

• square it. Take the middle four digits repeat

i Zi Ui Zi2

0 7182 - 51,581,124

1 5811 0.5811 33,767,721 2 7677 0.7677 58,936,329

(29)

Bo Friis Nielsen – 17/6-2001 C04245 4

Mid-square method - Von Neumann Mid-square method - Von Neumann

• Four digit integer

• square it. Take the middle four digits repeat

i Zi Ui Zi2

0 7182 - 51,581,124

1 5811 0.5811 33,767,721 2 7677 0.7677 58,936,329 3 9363 0.9363 87,665,769 4 6657 0.6657 44,315,649 5 3156 0.3156 09,960,336 ... ... ... ...

• Might seem plausible

(30)

Mid-square method - Von Neumann Mid-square method - Von Neumann

• Four digit integer

• square it. Take the middle four digits repeat

i Zi Ui Zi2

0 7182 - 51,581,124

1 5811 0.5811 33,767,721 2 7677 0.7677 58,936,329 3 9363 0.9363 87,665,769 4 6657 0.6657 44,315,649 5 3156 0.3156 09,960,336 ... ... ... ...

• Might seem plausible but rather dubious

(31)

Bo Friis Nielsen – 17/6-2001 C04245 5

Fibonacci

Fibonacci

(32)

Fibonacci Fibonacci

Zi

(33)

Bo Friis Nielsen – 17/6-2001 C04245 5

Fibonacci Fibonacci

Zi = (Zi1 +

(34)

Fibonacci Fibonacci

Zi = (Zi1 + Zi2)

(35)

Bo Friis Nielsen – 17/6-2001 C04245 5

Fibonacci Fibonacci

Zi = (Zi1 + Zi2)(modm)

(36)

Fibonacci Fibonacci

Zi = (Zi1 + Zi2)(modm)

• more generally one could define

(37)

Bo Friis Nielsen – 17/6-2001 C04245 5

Fibonacci Fibonacci

Zi = (Zi1 + Zi2)(modm)

• more generally one could define

Zi = g(Z0, Z1, . . . , Zi1)

(38)

Linear congruential generators Linear congruential generators

Xi+1

(39)

Bo Friis Nielsen – 17/6-2001 C04245 6

Linear congruential generators Linear congruential generators

Xi+1 = (a ∗ Xi

(40)

Linear congruential generators Linear congruential generators

Xi+1 = (a ∗ Xi + b)

(41)

Bo Friis Nielsen – 17/6-2001 C04245 6

Linear congruential generators Linear congruential generators

Xi+1 = (a ∗ Xi + b)modm

(42)

Linear congruential generators Linear congruential generators

Xi+1 = (a ∗ Xi + b)modm

• Example: c = 16, a = 5, b = 1

(43)

Bo Friis Nielsen – 17/6-2001 C04245 6

Linear congruential generators Linear congruential generators

Xi+1 = (a ∗ Xi + b)modm

• Example: c = 16, a = 5, b = 1

• First 16 with X0 = 3:

(44)

Linear congruential generators Linear congruential generators

Xi+1 = (a ∗ Xi + b)modm

• Example: c = 16, a = 5, b = 1

• First 16 with X0 = 3: 0

(45)

Bo Friis Nielsen – 17/6-2001 C04245 6

Linear congruential generators Linear congruential generators

Xi+1 = (a ∗ Xi + b)modm

• Example: c = 16, a = 5, b = 1

• First 16 with X0 = 3: 0 1

(46)

Linear congruential generators Linear congruential generators

Xi+1 = (a ∗ Xi + b)modm

• Example: c = 16, a = 5, b = 1

• First 16 with X0 = 3: 0 1 6

(47)

Bo Friis Nielsen – 17/6-2001 C04245 6

Linear congruential generators Linear congruential generators

Xi+1 = (a ∗ Xi + b)modm

• Example: c = 16, a = 5, b = 1

• First 16 with X0 = 3: 0 1 6 15

(48)

Linear congruential generators Linear congruential generators

Xi+1 = (a ∗ Xi + b)modm

• Example: c = 16, a = 5, b = 1

• First 16 with X0 = 3: 0 1 6 15 12 13 2 11 8 9 14 7 4 5 10 3

(49)

Bo Friis Nielsen – 17/6-2001 C04245 6

Linear congruential generators Linear congruential generators

Xi+1 = (a ∗ Xi + b)modm

• Example: c = 16, a = 5, b = 1

• First 16 with X0 = 3: 0 1 6 15 12 13 2 11 8 9 14 7 4 5 10 3

Ui

(50)

Linear congruential generators Linear congruential generators

Xi+1 = (a ∗ Xi + b)modm

• Example: c = 16, a = 5, b = 1

• First 16 with X0 = 3: 0 1 6 15 12 13 2 11 8 9 14 7 4 5 10 3

Ui = Xi m

(51)

Bo Friis Nielsen – 17/6-2001 C04245 6

Linear congruential generators Linear congruential generators

Xi+1 = (a ∗ Xi + b)modm

• Example: c = 16, a = 5, b = 1

• First 16 with X0 = 3: 0 1 6 15 12 13 2 11 8 9 14 7 4 5 10 3

Ui = Xi m

• mixed generators a 6= 0 and b 6= 0

(52)

Linear congruential generators Linear congruential generators

Xi+1 = (a ∗ Xi + b)modm

• Example: c = 16, a = 5, b = 1

• First 16 with X0 = 3: 0 1 6 15 12 13 2 11 8 9 14 7 4 5 10 3

Ui = Xi m

• mixed generators a 6= 0 and b 6= 0

(53)

Bo Friis Nielsen – 17/6-2001 C04245 7

How to choose the parameters - desired properties

How to choose the parameters - desired

properties

(54)

How to choose the parameters - desired properties

How to choose the parameters - desired properties

• Speed

(55)

Bo Friis Nielsen – 17/6-2001 C04245 7

How to choose the parameters - desired properties

How to choose the parameters - desired properties

• Speed

• Cycle length

(56)

How to choose the parameters - desired properties

How to choose the parameters - desired properties

• Speed

• Cycle length

• Reproducable

(57)

Bo Friis Nielsen – 17/6-2001 C04245 7

How to choose the parameters - desired properties

How to choose the parameters - desired properties

• Speed

• Cycle length

• Reproducable

• Randomness

(58)

How to choose the parameters - desired properties

How to choose the parameters - desired properties

• Speed

• Cycle length

• Reproducable

• Randomness

• Portable

(59)

Bo Friis Nielsen – 17/6-2001 C04245 8

Theoretical considerations Theoretical considerations

• Supported by number theory to ensure:

(60)

Theoretical considerations Theoretical considerations

• Supported by number theory to ensure:

• Maximum cycle length

Theorem 1 Maximum cycle length The LCG has full period if and only if the following three conditions hold:

(61)

Bo Friis Nielsen – 17/6-2001 C04245 8

Theoretical considerations Theoretical considerations

• Supported by number theory to ensure:

• Maximum cycle length

Theorem 1 Maximum cycle length The LCG has full period if and only if the following three conditions hold:

• (a) The only positive integer that (exactly) divides both m and b is 1.

(62)

Theoretical considerations Theoretical considerations

• Supported by number theory to ensure:

• Maximum cycle length

Theorem 1 Maximum cycle length The LCG has full period if and only if the following three conditions hold:

• (a) The only positive integer that (exactly) divides both m and b is 1.

• (b) if q is a prime number that divides m, then q divides a − 1.

(63)

Bo Friis Nielsen – 17/6-2001 C04245 8

Theoretical considerations Theoretical considerations

• Supported by number theory to ensure:

• Maximum cycle length

Theorem 1 Maximum cycle length The LCG has full period if and only if the following three conditions hold:

• (a) The only positive integer that (exactly) divides both m and b is 1.

• (b) if q is a prime number that divides m, then q divides a − 1.

• (c) If 4 divides m, then 4 divides a − 1. 2

(64)

Other generators Other generators

• Midsquare method

• Shuffling methods

• Fibonacci generator

(65)

Bo Friis Nielsen – 17/6-2001 C04245 10

Shuffling generators

Shuffling generators

(66)

Shuffling generators Shuffling generators

• To enlarge period

(67)

Bo Friis Nielsen – 17/6-2001 C04245 10

Shuffling generators Shuffling generators

• To enlarge period

• Improve randomness

(68)

Shuffling generators Shuffling generators

• To enlarge period

• Improve randomness

• But not well understood

(69)

Bo Friis Nielsen – 17/6-2001 C04245 10

Shuffling generators Shuffling generators

• To enlarge period

• Improve randomness

• But not well understood

• LCGs widespread use,

(70)

Shuffling generators Shuffling generators

• To enlarge period

• Improve randomness

• But not well understood

• LCGs widespread use,generally to be recommended

(71)

Bo Friis Nielsen – 17/6-2001 C04245 11

Testing random number generators

Testing random number generators

(72)

Testing random number generators Testing random number generators

• Test for distribution type

(73)

Bo Friis Nielsen – 17/6-2001 C04245 11

Testing random number generators Testing random number generators

• Test for distribution type Visual tests/plots

(74)

Testing random number generators Testing random number generators

• Test for distribution type Visual tests/plots

χ2 test

(75)

Bo Friis Nielsen – 17/6-2001 C04245 11

Testing random number generators Testing random number generators

• Test for distribution type Visual tests/plots

χ2 test

Kolmogorov Smirnov test

(76)

Testing random number generators Testing random number generators

• Test for distribution type Visual tests/plots

χ2 test

Kolmogorov Smirnov test

• Test for independence

(77)

Bo Friis Nielsen – 17/6-2001 C04245 11

Testing random number generators Testing random number generators

• Test for distribution type Visual tests/plots

χ2 test

Kolmogorov Smirnov test

• Test for independence Visual tests/plots

(78)

Testing random number generators Testing random number generators

• Test for distribution type Visual tests/plots

χ2 test

Kolmogorov Smirnov test

• Test for independence Visual tests/plots Run test up/down

(79)

Bo Friis Nielsen – 17/6-2001 C04245 11

Testing random number generators Testing random number generators

• Test for distribution type Visual tests/plots

χ2 test

Kolmogorov Smirnov test

• Test for independence Visual tests/plots Run test up/down

Run test length of runs

(80)

Testing random number generators Testing random number generators

• Test for distribution type Visual tests/plots

χ2 test

Kolmogorov Smirnov test

• Test for independence Visual tests/plots Run test up/down

Run test length of runs

• Test of correlation coefficients

(81)

Bo Friis Nielsen – 17/6-2001 C04245 12

Test for distribution type χ

2

test

Test for distribution type χ

2

test

(82)

Test for distribution type χ

2

test Test for distribution type χ

2

test

The general form of the test statistic is

T

(83)

Bo Friis Nielsen – 17/6-2001 C04245 12

Test for distribution type χ

2

test Test for distribution type χ

2

test

The general form of the test statistic is

T =

nclasses

X

i=1

(84)

Test for distribution type χ

2

test Test for distribution type χ

2

test

The general form of the test statistic is

T =

nclasses

X

i=1

(nobserved,i

(85)

Bo Friis Nielsen – 17/6-2001 C04245 12

Test for distribution type χ

2

test Test for distribution type χ

2

test

The general form of the test statistic is

T =

nclasses

X

i=1

(nobserved,i − nexpected,i

(86)

Test for distribution type χ

2

test Test for distribution type χ

2

test

The general form of the test statistic is

T =

nclasses

X

i=1

(nobserved,i − nexpected,i)2

(87)

Bo Friis Nielsen – 17/6-2001 C04245 12

Test for distribution type χ

2

test Test for distribution type χ

2

test

The general form of the test statistic is

T =

nclasses

X

i=1

(nobserved,i − nexpected,i)2 nexpected,i

(88)

Test for distribution type χ

2

test Test for distribution type χ

2

test

The general form of the test statistic is

T =

nclasses

X

i=1

(nobserved,i − nexpected,i)2 nexpected,i

• The test statistic is to be evaluated with a χ2 distribution with df degrees of freedom.

(89)

Bo Friis Nielsen – 17/6-2001 C04245 12

Test for distribution type χ

2

test Test for distribution type χ

2

test

The general form of the test statistic is

T =

nclasses

X

i=1

(nobserved,i − nexpected,i)2 nexpected,i

• The test statistic is to be evaluated with a χ2 distribution with df degrees of freedom. df is generally

nclasses − 1 − m

(90)

Test for distribution type χ

2

test Test for distribution type χ

2

test

The general form of the test statistic is

T =

nclasses

X

i=1

(nobserved,i − nexpected,i)2 nexpected,i

• The test statistic is to be evaluated with a χ2 distribution with df degrees of freedom. df is generally

nclasses − 1 − m where m is the number of estimated parameters.

(91)

Bo Friis Nielsen – 17/6-2001 C04245 13

Test for distribution type Kolmogorov Smirnov test

Test for distribution type Kolmogorov

Smirnov test

(92)

Test for distribution type Kolmogorov Smirnov test

Test for distribution type Kolmogorov Smirnov test

• Compare empirical distribution function Fn(x)

(93)

Bo Friis Nielsen – 17/6-2001 C04245 13

Test for distribution type Kolmogorov Smirnov test

Test for distribution type Kolmogorov Smirnov test

• Compare empirical distribution function Fn(x) with hypothesized distribution F(x).

(94)

Test for distribution type Kolmogorov Smirnov test

Test for distribution type Kolmogorov Smirnov test

• Compare empirical distribution function Fn(x) with hypothesized distribution F(x).

• For known parameters the test statistic does not depend on F(x)

(95)

Bo Friis Nielsen – 17/6-2001 C04245 13

Test for distribution type Kolmogorov Smirnov test

Test for distribution type Kolmogorov Smirnov test

• Compare empirical distribution function Fn(x) with hypothesized distribution F(x).

• For known parameters the test statistic does not depend on F(x)

• No grouping considerations needed

(96)

Empirical distribution

Empirical distribution

(97)

Bo Friis Nielsen – 17/6-2001 04245 14

Empirical distribution Empirical distribution

20 N(0, 1) variates (sorted): -2.20, -1.68, -1.43, -0.77, -0.76, -0.12, 0.30, 0.39, 0.41, 0.44, 0.44, 0.71, 0.85, 0.87, 1.15, 1.37, 1.41, 1.81, 2.65, 3.69

(98)

Empirical distribution Empirical distribution

20 N(0, 1) variates (sorted): -2.20, -1.68, -1.43, -0.77, -0.76, -0.12, 0.30, 0.39, 0.41, 0.44, 0.44, 0.71, 0.85, 0.87, 1.15, 1.37, 1.41, 1.81, 2.65, 3.69

(99)

Bo Friis Nielsen – 17/6-2001 04245 14

Empirical distribution Empirical distribution

20 N(0, 1) variates (sorted): -2.20, -1.68, -1.43, -0.77, -0.76, -0.12, 0.30, 0.39, 0.41, 0.44, 0.44, 0.71, 0.85, 0.87, 1.15, 1.37, 1.41, 1.81, 2.65, 3.69

Dn = sup

x {|Fn(x) − F(x)|}

(100)

Test statistic and Significance levels Test statistic and Significance levels

Level of significance (1 α)

Case Adjusted test statistic 0.850 0.900 0.950 0.975 0.990

All parameters known

n + 0.12 + 0.11 n

Dn 1.138 1.224 1.358 1.480 1.628 N( ¯X(n), S2(n))

n 0.01 + 0.85 n

Dn 0.775 0.819 0.895 0.955 1.035 exp( ¯X(n))

n + 0.26 + 0.5

n

Dn 0.2n

0.926 0.990 1.094 1.190 1.308

(101)

Bo Friis Nielsen – 17/6-2001 04245 16

Test for correlation - Visual tests

Test for correlation - Visual tests

(102)

Test for correlation - Visual tests Test for correlation - Visual tests

• Plot of Ui+1 versus Ui

(103)

Bo Friis Nielsen – 17/6-2001 04245 16

Test for correlation - Visual tests Test for correlation - Visual tests

• Plot of Ui+1 versus Ui

0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1

0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1

Random numbers U_i against U_{i+1}, X_{i+1} = (5 X_i + 1)(mod 16)

’ranplot.lst’

(104)

Test for correlation - Visual tests Test for correlation - Visual tests

• Plot of Ui+1 versus Ui

0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1

0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1

Random numbers U_i against U_{i+1}, X_{i+1} = (5 X_i + 1)(mod 16)

’ranplot.lst’

0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1

0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1

Random numbers U_i against U_{i+1}, X_{i+1} = (129 X_i + 26461)(mod 65536)

’ranplot2.lst’

(105)

Bo Friis Nielsen – 17/6-2001 C04245 17

Run test above/below Run test above/below

• The run test given in Conradsen, can be used by e.g.

comparing with the median.

(106)

Run test above/below Run test above/below

• The run test given in Conradsen, can be used by e.g.

comparing with the median.

Run test UP/DOWN Run test UP/DOWN

• A test specifically designed for testin grandom number generators is the UP/DOWN run test, see e.g. Donald E.

Knuth, The Art of Computer Programming Volume 2, 1998, pp. 66-.

(107)

Bo Friis Nielsen – 17/6-2001 C04245 17

Run test above/below Run test above/below

• The run test given in Conradsen, can be used by e.g.

comparing with the median.

Run test UP/DOWN Run test UP/DOWN

• A test specifically designed for testin grandom number generators is the UP/DOWN run test, see e.g. Donald E.

Knuth, The Art of Computer Programming Volume 2, 1998, pp. 66-.

• The sequence:

0.54,0.67,0.13,0.89,0.33,0.45,0.90,0.01,0.45,0.76,0.82,0.24, 0.17 has runs of length 2,2,3,4,1,?

(108)

The observed number of runs of length 1,5 and ≥6 are given in the vector R.~

(109)

Bo Friis Nielsen – 17/6-2001 C04245 18

The observed number of runs of length 1,5 and ≥6 are given in the vector R.~

• The test statistic is calculated by:

(110)

The observed number of runs of length 1,5 and ≥6 are given in the vector R.~

• The test statistic is calculated by:

Z = 1

n − 6(R~ − n ~B)0A(R~ − n ~B)

A =

4529.4 9044

.9 13568 18091 22615 27892 9044.9 18097 27139 36187 45234 55789 13568 27139 40721 54281 67852 83685 18091 36187 54281 72414 90470 111580 22615 45234 67852 90470 113262 139476 27892 55789 83685 111580 139476 172860

B~ =

1 6 5 24 11 120

19 720

29 5040

1 840

(111)

Bo Friis Nielsen – 17/6-2001 C04245 18

The observed number of runs of length 1,5 and ≥6 are given in the vector R.~

• The test statistic is calculated by:

Z = 1

n − 6(R~ − n ~B)0A(R~ − n ~B)

A =

4529.4 9044

.9 13568 18091 22615 27892 9044.9 18097 27139 36187 45234 55789 13568 27139 40721 54281 67852 83685 18091 36187 54281 72414 90470 111580 22615 45234 67852 90470 113262 139476 27892 55789 83685 111580 139476 172860

B~ =

1 6 5 24 11 120

19 720

29 5040

1 840

• The test statistic is compared with a χ2(6) distribution.

(112)

The observed number of runs of length 1,5 and ≥6 are given in the vector R.~

• The test statistic is calculated by:

Z = 1

n − 6(R~ − n ~B)0A(R~ − n ~B)

A =

4529.4 9044

.9 13568 18091 22615 27892 9044.9 18097 27139 36187 45234 55789 13568 27139 40721 54281 67852 83685 18091 36187 54281 72414 90470 111580 22615 45234 67852 90470 113262 139476 27892 55789 83685 111580 139476 172860

B~ =

1 6 5 24 11 120

19 720

29 5040

1 840

• The test statistic is compared with a χ2(6) distribution.

(113)

Bo Friis Nielsen – 17/6-2001 C04245 19

Correlation coefficients

Correlation coefficients

(114)

Correlation coefficients Correlation coefficients

• the estimated correlation

(115)

Bo Friis Nielsen – 17/6-2001 C04245 19

Correlation coefficients Correlation coefficients

• the estimated correlation

ch = 1 n − h

nh

X

i=1

UiUi+h ∈ N

0.25, 7 144n

(116)

Exercise 1

Exercise 1

(117)

Bo Friis Nielsen – 17/6-2001 C04245 20

Exercise 1 Exercise 1

• Write a program generating 10.000 (pseudo-) random

numbers and present these numbers in a histogramme (e.g.

10 classes).

(118)

Exercise 1 Exercise 1

• Write a program generating 10.000 (pseudo-) random

numbers and present these numbers in a histogramme (e.g.

10 classes).

First implement the LCG yourself by experimenting with different values of “a”, “b” and “c”.

(119)

Bo Friis Nielsen – 17/6-2001 C04245 20

Exercise 1 Exercise 1

• Write a program generating 10.000 (pseudo-) random

numbers and present these numbers in a histogramme (e.g.

10 classes).

First implement the LCG yourself by experimenting with different values of “a”, “b” and “c”.

Evaluate the quality of the generators by several statistical tests.

(120)

Exercise 1 Exercise 1

• Write a program generating 10.000 (pseudo-) random

numbers and present these numbers in a histogramme (e.g.

10 classes).

First implement the LCG yourself by experimenting with different values of “a”, “b” and “c”.

Evaluate the quality of the generators by several statistical tests.

Then apply a system available generator (e.g. drand48() C, and C++) and perform various statistical tests for this also.

(121)

Bo Friis Nielsen – 17/6-2001 C04245 20

Exercise 1 Exercise 1

• Write a program generating 10.000 (pseudo-) random

numbers and present these numbers in a histogramme (e.g.

10 classes).

First implement the LCG yourself by experimenting with different values of “a”, “b” and “c”.

Evaluate the quality of the generators by several statistical tests.

Then apply a system available generator (e.g. drand48() C, and C++) and perform various statistical tests for this also. As a minimum you should perform a χ2 test and an UP/DOWN run test. Optional supplementary tests are histograms and Ui, Ui+1 plots, test for zero correlation and up/down runtest.

Referencer

RELATEREDE DOKUMENTER

Discrete models for concurrency (transition graph models) suffer a severe problem if the number of processors and/or the length of programs grows: The number of states (and the

Discrete models for concurrency (transition graph models) suffer a severe problem if the number of processors and/or the length of programs grows: The number of states (and the

Discrete models for concurrency (transition graph models) suffer a severe problem if the number of processors and/or the length of programs grows: The number of states (and the

Silverman 2001) in order to sustain the interview rather as a discussion. Th us, I hoped to create a more relaxed atmosphere where the politicians especially would be more

Th e ecological model RHYHABSIM was applied on three streams within the River Kornerup catchment in order to assess how stream discharge aff ects habitat for brown trout, which

Abstract: Th e aim of the present article is to review the diff erent conceptualisations of the relation between scientifi c knowledge and everyday life from a fairly practical

Th e Food and Agricultural Organisation (FAO) has identifi ed three types of sustainability in the context of technical cooperation. A) Institutional sustainabil- ity where

maripaludis Mic1c10, ToF-SIMS and EDS images indicated that in the column incubated coupon the corrosion layer does not contain carbon (Figs. 6B and 9 B) whereas the corrosion