Sie sind auf Seite 1von 5

PROBLEM SET #2

1. The sequence of numbers 0.594, 0.928, 0.515, 0.055, 0.507, 0.351, 0.262, 0.797, 0.788, 0.442,
0.097, 0.798, 0.227, 0.127, 0.474, 0.825, 0.007, 0.182, 0.929 and 0.852 has been generated. Use
the Kolmogorov-Smirnov test with = 0.05 to learn whether the hypothesis that the numbers are
uniformly distributed on the interval [0, 1] can be rejected.
H0 : Distribution is U(0 ,1)
H1 : Distribution is not U(0 ,1)
Ranked Ri
0.007
0.055
0.097
0.127
0.182
0.227
0.262
0.351
0.442
0.474
0.507
0.515
0.594
0.788
0.797
0.798
0.825
0.852
0.928
0.929

i/N
0.050
0.100
0.150
0.200
0.250
0.300
0.350
0.400
0.450
0.500
0.550
0.600
0.650
0.700
0.750
0.800
0.850
0.900
0.950
1.000

i/N - Ri
0.043
0.045
0.053
0.073
0.068
0.063
0.088
0.049
0.008
0.026
0.043
0.085
0.056
0.002
0.025
0.048
0.022
0.071

Ri (i-1)/N
0.007
0.005
0.001
0.042
0.024
0.007
0.138
0.097
0.048
0.025
0.002
0.028
-

(i = 1,..., 20); N=20

D max Ri 0.088
1i 20 20

i 1

D max Ri
0.138
1i 20
20

So, Dmax* = 0.138

Dcritical=0.264 > Dmax . So, H0 is accepted.


2. Use the chi-square test with = 0.05 to test for whether the data shown next are uniformly
distributed (n=10).
0.78
0.62
0.05
0.49
0.49
0.42
0.05
0.02
0.74
0.67

0.29
0.79
0.73
0.75
0.18
0.39
0.78
0.99
0.22
0.46

0.11
0.19
0.58
0.34
0.42
0.37
0.31
0.73
0.74
0.21

0.60
0.40
0.96
0.69
0.10
0.65
0.45
0.52
0.94
0.12

0.47
0.64
0.94
0.28
0.66
0.93
0.05
0.41
0.81
0.44

0.64
0.40
0.30
0.81
0.05
0.82
0.56
0.56
0.70
0.87

0.88
0.24
0.97
0.01
0.46
0.19
0.82
0.67
0.64
0.89

0.97
0.84
0.56
0.54
0.99
0.23
0.17
0.77
0.79
0.25

0.26
0.39
0.43
0.51
0.17
0.71
0.30
0.99
0.76
0.90

0.18
0.06
0.72
0.37
0.99
0.79
0.47
0.96
0.83
0.34

Interval
1
2
3
4
5
6
7
8
9
10

Oi
8
8
10
9
12
8
10
14
10
11
100

Ei
10
10
10
10
10
10
10
10
10
10
100

O i Ei
-2
-2
0
-1
2
-2
0
4
0
1
0

(Oi Ei)2
4
4
0
1
4
4
0
16
0
1

(Oi Ei)2/Ei
0.4
0.4
0.0
0.1
0.4
0.4
0.0
1.6
0.0
0.1
3.4

So, 02 = 3.4

20.05,9 = 16.9 > 02 . So, H0 is accepted.


3. We want to design a mixed congruential random number generator for a microcomputer with a 16bit word. What would you choose a m? Explain the reason for your selection.
Using a=25, c=14 and an initial seed of 999, generate three random numbers. Can you determine how
many random numbers will be generated before they start repeating?
Answer:
The computer works with base 2. So if we choose M = 2w-1 where w is the word size (-1 because a bit is
used to store the sign), then we may omit the mod operation and read the last (w-1) bits. So;
M = 216 -1 = 215 = 32,768.

X i 1 aX i c Mod m 25(999) 14 Mod 32768 24989 X 1 24989


The longest possible period P = m = 32,768
4. Consider the following sequence of 50 digits:
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

Can the hypothesis that the numbers are independent be rejected on the basis of the length of
runs up and down when 0.05 .
Answer: N = 50
+-+---++++-+-+++--+++----+++-+--+--+-+-+---++--++
1, 1, 1, 3, 4, 1, 1, 1, 3, 2, 3, 4, 3, 1, 1, 2, 1, 2, 1, 1, 1, 1, 1, 3, 2, 2, 2

Run Length, i

Observed Runs, Oi

14

E (Y1 )

2
50(1 3 1) (1 3 1 4) 251 20.92
4!
12

E (Y2 )

2
50(2 6 1) (8 12 2 4) 436 7.27
5!
60

E (Y3 )

2
50(9 9 1) (27 27 3 4) 903 2.51
6!
360

2(50) 1
33 . So, E(number of runs 4) = a
3

E (Y ) = 33 30.70 = 2.30
i

i 1

Run
Length,
i

Observed
Number of Runs,
Oi

Expected Number
of Runs,
E(Yi)

Oi E (Yi )2

14

20.92

2.29

13

E (Yi )

7.27
2.51

12.08

0.07

2.30
2.36

Calculated 02 2.36
Degrees of freedom = k 1 = 2 1 = 1
At = 0.05, the tabulated value of 02.05,1 3.84
Since 02 02.05,1 , do not reject the null hypothesis.

TABLE: KOLMOGOROV-SMIRNOV CRITICAL VALUES


Degrees of
Freedom (N)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
25
30
35
Over
35

D0.10
0.950
0.776
0.642
0.564
0.510
0.470
0.438
0.411
0.388
0.368
0.352
0.338
0.325
0.314
0.304
0.295
0.286
0.278
0.272
0.264
0.24
0.22
0.21

D0.05
0.975
0.842
0.708
0.624
0.565
0.521
0.486
0.457
0.432
0.410
0.391
0.375
0.361
0.349
0.338
0.328
0.318
0.309
0.301
0.294
0.27
0.24
0.23

D0.01
0.995
0.929
0.828
0.733
0.669
0.618
0.577
0.543
0.514
0.490
0.468
0.450
0.433
0.418
0.404
0.392
0.381
0.371
0.363
0.356
0.32
0.29
0.27

1.22

1.36

1.63

Das könnte Ihnen auch gefallen