lesson 15 - 2

13
Lesson 15 - 2 Runs Test for Randomness

Upload: abel-charles

Post on 31-Dec-2015

22 views

Category:

Documents


0 download

DESCRIPTION

Lesson 15 - 2. Runs Test for Randomness. Objectives. Perform a runs test for randomness Runs tests are used to test whether it is reasonable to conclude data occur randomly , not whether the data are collected randomly. Vocabulary. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Lesson 15 - 2

Lesson 15 - 2

Runs Test for Randomness

Page 2: Lesson 15 - 2

Objectives

• Perform a runs test for randomness

• Runs tests are used to test whether it is reasonable to conclude data occur randomly, not whether the data are collected randomly.

Page 3: Lesson 15 - 2

Vocabulary

• Runs test for randomness – used to test claims that data have been obtained or occur randomly

• Run – sequence of similar events, items, or symbols that is followed by an event, item, or symbol that is mutually exclusive from the first event, item, or symbol

• Length – number of events, items, or symbols in a run

Page 4: Lesson 15 - 2

Runs Test for Randomness

● Assume that we have a set of data, and we wish to know whether it is random, or not

● Some examples A researcher takes a systematic sample, choosing

every 10th person who passes by … and wants to check whether the gender of these people is random

A professor makes up a true/false test … and wants to check that the sequence of answers is random

Page 5: Lesson 15 - 2

Runs, Hits and Errors

• A run is a sequence of similar events– In flipping coins, the number of “heads” in a row– In a series of patients, the number of “female

patients” in a row– In a series of experiments, the number of

“measured value was more than 17.1” in a row

• It is unlikely that the number of runs is too small or too large

• This forms the basis of the runs test

Page 6: Lesson 15 - 2

Runs Test (small case)

• Small-Sample Case: If n1 ≤20 and n2 ≤ 20, the test statistic in the runs test for randomness is r, the number of runs.

• Critical Values for a Runs Test for Randomness: Use Table IX (critical value at α = 0.05)

Page 7: Lesson 15 - 2

Critical Values for a Runs Test for RandomnessUse Table IV, the standard normal table.

Large-Sample Case: If n1 > 20 or n2 > 20 the test statistic in the runs test for randomness is

r - μrz = ------- σr

where

2n1n2μr = -------- + 1 n

2n1n2 (2n1n2 – n) σr = ----------------------- n²(n – 1)

Let n represent the sample size of which there are two mutually exclusive types.Let n1 represent the number of observations of the first type.Let n2 represent the number of observations of the second type.Let r represent the number of runs.

Runs Test (large case)

Page 8: Lesson 15 - 2

Hypothesis Tests for Randomness Use Runs TestStep 0 Requirements:

1) sample is a sequence of observations recorded in order of their occurrence2) observations have two mutually exclusive categories.

Step 1 Hypotheses: H0: The sequence of data is random. H1: The sequence of data is not random.

Step 2 Level of Significance: (level of significance determines the critical value) Large-sample case: Determine a level of significance, based on the

seriousness of making a Type I error. Small-sample case: we must use the level of significance, α = 0.05.

Step 3 Compute Test Statistic:

Step 4 Critical Value Comparison: Reject H0 if

Step 5 Conclusion: Reject or Fail to Reject

r - μrz0 = ------- σr

Small-Sample: r Large Sample:

Small-Sample Case: r outside Critical intervalLarge-Sample Case: z0 < -zα/2 or z0 > zα/2

Page 9: Lesson 15 - 2

Example 1

The following sequence was observed when flipping a coin:

H, T, T, H, H, T, H, H, H, T, H, T, T, T, H, H

The coin was flipped 16 times with 9 heads and 7 tails. There were 9 runs observed.

Valuesn = 16n1 = 9n2 = 7r = 9

Critical values from table IX (9,7) = 4, 14

Since 4 < r = 9 < 14, then we Fail to reject and conclude that we don’t have enough evidence to say that it is not random.

Page 10: Lesson 15 - 2

Example 2The following sequence was observed when flipping a coin:

H, T, T, H, H, T, H, H, H, T, H, T, T, T, H, H, H, TT, T, T, H, H, T, T, T, H, T, T, H, H, T, T, H, T, T, T, T

The coin was flipped 38 times with 16 heads and 22 tails. There were 18 runs observed.

Valuesn = 38n1 = 16n2 = 22r = 18

r - μrz = --------- r

Since z (-0.515) > -Zα/2 (-2.32) we fail to reject and conclude that we don’t have enough evidence to say its not random.

2n1n2μr = -------- + 1 = 19.5263 n

2n1n2 (2n1n2 – n) σr = ----------------------- = 9.9624 n²(n – 1)

z = -0.515

Page 11: Lesson 15 - 2

Example 3, Using Confidence Intervals

Trey flipped a coin 100 times and got 54 heads and 46 tails, so– n = 100

– n1 = 54

– n2 = 46

68501100

46542.r

944)1001(100

)10046542(465422

.r

r - μrz = --------- r

We transform this into a confidence interval, PE +/- MOE.

Page 12: Lesson 15 - 2

Using Confidence Intervals

● The z-value for α = 0.05 level of significance is 1.96

LB: 50.68 – 1.96 • 4.94 = 41.0

to

UB: 50.68 + 1.96 • 4.94 = 60.4

● We reject the null hypothesis if there are 41 or fewer runs, or if there are 61 or more

● We do not reject the null hypothesis if there are 42 to 60 runs

Page 13: Lesson 15 - 2

Summary and Homework

• Summary– The runs test is a nonparametric test for the

independence of a sequence of observations– The runs test counts the number of runs of

consecutive similar observations– The critical values for small samples are given in

tables– The critical values for large samples can be

approximated by a calculation with the normal distribution

• Homework– problems 1, 2, 5, 6, 7, 8, 15 from the CD