Top Banner
ONE-SAMPLE RUNS TEST FOR RANDOMNESS
26

Run test

Dec 02, 2014

Download

Documents

Rohaila Rohani
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Run test

ONE-SAMPLE RUNS TEST FOR RANDOMNESS

Page 2: Run test

LEARNING OUTCOMEAfter study this topic, student will

be able to decide whether a sequence of events, items, or symbols is the result of a random process.

Page 3: Run test

HOW DOES ONE KNOW IF THE DATA OBTAINED FROM A SAMPLE ARE TRULY RANDOM?

Procedures for investigating randomness are based on the number and nature of the runs present in the data of interest.

A run is a sequence of like events, items or symbols that is preceded and followed by an event, item or symbol of a different type, or by none at all.

We doubt the randomness of a series when there appear to be either too many or too few runs.

We can use runs test to determine the randomness.

It helps us to decide whether a sequence of events, items, or symbols is the result of a random process.

Page 4: Run test

IS THIS RANDOM?

A researcher interviewing 10 people for a survey. Let the genders be denoted by M for male and F for female. Suppose the participants were chosen as follows :

Situation 1 :M M M M M F F F F F F

Situation 2 :F M F M F M F M F M

Situation 3 :F F F M M F M M F F

Page 5: Run test

ASSUMPTIONS

The data available for analysis consist of a sequence of observations, recorded in the order of occurrence, which we can categorize into two mutually exclusive types.

We let n = the total sample sizen1 = the number of observation of one type

n2 = the number of observation of the other type

Page 6: Run test

HYPOTHESES

A. TWO-SIDED H0 : The pattern of occurrences of the two types of

observation is determined by a random process. H1 : The pattern of occurrences is not random

B. ONE-SIDED H0 : The pattern of occurrences of the two types of

observation is determined by a random process. H1 : The pattern is not random (because there are too

few runs to be attributed to chances) C. ONE-SIDED

H0 : The pattern of occurrences of the two types of

observation is determined by a random process. H1 : The pattern is not random(because there are too

many runs to be attributed to chances)

Page 7: Run test

TEST STATISTIC AND DECISION RULE

The test statistic is r , the total number of runs.

A. TWO-SIDED B. ONE-SIDED ( H1 has few

runs )

C. ONE-SIDED ( H1 has many

runs)

Reject H0 :r ≤ lower critical

value OR

r ≥ upper critical value

Reject H0 :

r ≤ lower critical value

Reject H0 :

r ≥ upper critical value

Page 8: Run test

CRITICAL VALUE

Lower critical value can be determine from Table A.5 (Wayne W. Daniel, Applied nonparametric Statistics) with n1 and n2

Upper critical value can be determine from Table A.6 (Wayne W. Daniel, Applied nonparametric Statistics) with n1 and n2

OR Both Lower and Upper critical value can be

determine from Table M (Bluman, Elementary Statistics) with n1 and n2

Page 9: Run test

EXAMPLE 1

On a commuter train, the conductor wishes to see whether the passengers enter the train at random. He observes the first 25 people, with the following sequence of males(M) and females(F).

F F F M M F F F F M F M M M F F F F M M F F F M M

Test for randomness at α = 0.05

Page 10: Run test

SOLUTION

Step 1 : State the hypotheses and identify the claimH0 : The pattern of occurrences of males and females enter the train is determine by a random process.(claim)H1 : The pattern of occurrences of males and females enter the train is not random

Step 2 : Find the numbers of runs (test statistic).FFF MM FFFF M F MMM FFFF MM FFF MMTest statistic, r = 10 n1 = the numbers of female = 15

n2 = the numbers of male = 10

Page 11: Run test

SOLUTION (CONT…)

Step 3 : Find the critical valuen1 = 15, n2 = 10

Lower critical value = 7.Upper critical value =18.

Step 4 : Make the decisionSince r = 10 which is between 7 and 18, do not reject H0.

Step 5 : Make a conclusionThere is not enough evidence to reject the claim that the pattern of occurrences of males and females enter the train is determined by a random process.

Table

Page 12: Run test

EXAMPLE 2

20 people enrolled in a drug abuse program. Test the claim that the ages of the people, according to the order in which they enroll, occur at random, at α = 0.05. The data as follows :

18, 36, 19, 22, 25, 44, 23, 27, 27, 35, 19, 43, 37, 32, 28, 43, 46, 19, 20, 22

Page 13: Run test

SOLUTION

Step 1 : State the hypotheses and identify the claimH0 : The pattern of occurrences of ages of the people enrolled in a drug abuse program is determined by a random process. (claim)H1 : The pattern of occurrences of ages of the people enrolled in a drug abuse program is not random.

Page 14: Run test

SOLUTION (CONT…)

STEP 2 : Find the number of runs (test statistic)Find the median of the data. First, arrange the data in ascending order.

18 19 19 19 20 22 22 23 25 27 27 28 32 35 36 37 43 43 44 46

Median is (27+27)/2 = 27. Compare the original data with the median.

Then, replace each number in the original sequence with an A if it is above the median and with B if it is below the median. Eliminate any numbers that are equal to the median.8 36 19 22 25 44 23 27 27 35 19 43 37 32 28 43 46 19 20 22

B A B B B A B A B A A A A A A B B B

Test statistic, r = 9 , n1 = # of B = 9, n2 = # of A = 9

Page 15: Run test

SOLUTION (CONT…)

Step 3 : Find the critical valuen1 = 9, n2 = 9

Lower critical value = 5.Upper critical value =15.

Step 4 : Make the decisionSince r = 9 which is between 5 and 15, do not reject H0.

Step 5 : Make a conclusionThere is not enough evidence to reject the claim that the pattern of occurrences of ages of the people enrolled in a program is determined by a random process.

Table

Page 16: Run test

EXAMPLE 3 (PG65)

Table in next page shows the departures from normal of daily temperatures recorded at Atlanta, Georgia, during November 1974*. We wish to know whether we may conclude that the pattern of departures above and below normal is the result of a nonrandom process.Departures from normal of daily temperatures recorded at Atlanta, Georgia, during November, 1974.

*Local Climatological Data, U.S. Department of Commerce, National Oceanci and Atmospheric Administration, Environmental Data Service, National Climatic Center, Federal Buliding, Asheville, Notrh Caronlina, November 1974.

Page 17: Run test

DATA

Day 1 2 3 4 5 6 7 8 9 10

11

12

13

14

15

Departure from normal

12

13

12

11

5 2 -1 2 -1 3 2 -6 -7 -7 -12

Day 16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

Departure from normal

-9 6 7 10

6 1 1 3 7 -2 -6 -6 -5 -2 -1

Page 18: Run test

SOLUTION

Step 1 : State the hypotheses and identify the claimH0 : The pattern of occurrences of negative and positive departures from normal is determined by a random process.H1 : The pattern of occurrences of negative and positive departures from normal is not random.( claim )

Step 2 : Find the numbers of runs (test statistic).Replace the positive departures with A and the negative departures with B. So, the new data as follows :AAAAAA B A B AA BBBBB AAAAAAAA BBBBBBTest statistic, r = 8, n1 = # of A = 17, n2 = # of B =13

Page 19: Run test

SOLUTION (CONT…)

Step 3 : Find the critical valuen1 = 17, n2 = 13

Lower critical value = 10.Upper critical value = 22.

Step 4 : Make the decisionSince r = 8 is less than lower critical value, reject H0.

Step 5 : Make a conclusionThere is enough evidence to support the claim that the pattern of occurrences of positive and negative departures from normal is not random.

Table

Page 20: Run test

LARGE SAMPLE APPROXIMATION

Use when either n1 or n2 is greater than 20. Compare the computed z with Table A.2.

1

22

12

212

21

212121

21

21

nnnn

nnnnnn

nnnn

r

z

Page 21: Run test

EXAMPLE 4

On a commuter train, the conductor wishes to see whether the passengers enter the train at random. He observes the first 30 people, with the following sequence of males (M) and females (F).

FFFF MM FFFF M F MM FFFFFF MM FFFFFF MM

Test for randomness at α = 0.05

Page 22: Run test

SOLUTION

Step 1 : State the hypotheses and identify the claimH0 : The pattern of occurrences of males and females enter the train is determine by a random process.(claim)H1 : The pattern of occurrences of males and females enter the train is not random

Page 23: Run test

SOLUTION (CONT…)

Step 2 : Find the numbers of runs and test value. r = 10 , n1 = 21, n2 = 9

6036.1

1921921

921)9)(21(2)9)(21(2

1921)9)(21(2

10

1

22

12

2

212

21

212121

21

21

z

z

nnnn

nnnnnn

nnnn

r

z

Page 24: Run test

SOLUTION (CONT…) Step 3 : Find the critical value

α=0.05, z = 1.96, CV = ±1.96

-1.6036

Page 25: Run test

SOLUTION (CONT…)

Step 4 : Make the decisionSince -1.6036 fall in the non-critical zone, do not reject H0.

Step 5 : Make a conclusionThere is not enough evidence to reject the claim that the pattern of occurrences of males and females is determine by a random process.

Page 26: Run test

Example 1

Example 2

Example 3

Q2

Q1

Q3