Nonparametric Tests Chapter 11. § 11.1 The Sign Test.

Post on 31-Dec-2015

239 views 1 download

transcript

Nonparametric Tests

Chapter 11

§ 11.1

The Sign Test

Larson & Farber, Elementary Statistics: Picturing the World, 3e 3

Sign Test for a Population Median

A nonparametric test is a hypothesis test that does not require any specific conditions concerning the shape of the population or the value of any population parameters.

The sign test is a nonparametric test that can be used to test a population median against a hypothesized value k.

The sign test for a population median can be left tailed, right tailed, or two tailed.

Left-tailed test:H0: median k and Ha: median < k

Right-tailed test:H0: median k and Ha: median > k

Two-tailed test:H0: median = k and Ha: median k

Larson & Farber, Elementary Statistics: Picturing the World, 3e 4

Sign Test for a Population Median

Test Statistic for the Sign TestWhen n 25, the test statistic x for the sign test is the smaller number of + or signs.

When n > 25, the test statistic for the sign test is

where x is the smaller number of + or signs and n is the sample size, i.e., the total number of + or signs.

( 0.5) 0.5

2

x nzn

To use the sign test, each entry is compared with the hypothesized median. If the entry is below the median, a sign is assigned; if above the median, a + sign is assigned.

Larson & Farber, Elementary Statistics: Picturing the World, 3e 5

Sign Test for a Population Median

1. State the claim. Identify the null and alternative hypotheses.

2. Specify the level of significance.

3. Determine the sample size n by assigning + signs and – signs to the sample data .

4. Determine the critical value. Continued.

Performing a Sign Test for a Population Median In Words In Symbols

State H0 and Ha.

Identify .

If n 25, use Table 8. If n > 25, use Table 4.

n = total number of + and – signs

Larson & Farber, Elementary Statistics: Picturing the World, 3e 6

Sign Test for a Population Median

Performing a Sign Test for a Population MedianIn Words In Symbols

If x or z is in the rejection region, reject H0. Otherwise, fail to reject H0.

5. Calculate the test statistic.

6. Make a decision to reject or fail to reject the null hypothesis.

7. Interpret the decision in the context of the original claim.

( 0.5) 0.5

2

x nzn

If n 25, use x.

If n > 25, use

Larson & Farber, Elementary Statistics: Picturing the World, 3e 7

Sign Test for a Population Median

58 62 55 55 53 52 52 59 55

55 60 56 57 61 58 63 63 55

Example:A college statistics professor claims that the median test score for his students’ last test is 58. The scores for 18 randomly selected tests are listed below. At = 0.01, can you reject the professor’s claim?

H0: median = 58 (Claim) Ha: median 58

Determine the values that are above and below the median of 58.

0 + + + + 0 + +

There are 6 + signs and 10 signs.

Continued.

Larson & Farber, Elementary Statistics: Picturing the World, 3e 8

Sign Test for a Population Median

Example continued:Since there are 6 + signs and 10 signs, n = 6 + 10 = 16.Using Table 8 with = 0.01 (two tailed) and n = 16, the critical value is 2.

Because n 25, the test statistic x is the smaller number of + signs or signs, so x = 6.

6 is greater than the critical value, so we fail to reject H0.

There is not enough evidence at the 1% level to reject the professor’s claim that the median test score is 58.

Larson & Farber, Elementary Statistics: Picturing the World, 3e 9

The Paired-Sample Sign Test

The paired-sample sign test is used to test the difference between two population medians when the populations are not normally distributed.

For the paired-sample sign test to be used, the following must be true.

1. A sample must be randomly selected from each population.

2. The samples must be dependent (paired).

The difference between corresponding data entries is found and the sign of the difference is recorded.

Larson & Farber, Elementary Statistics: Picturing the World, 3e 10

The Paired-Sample Sign Test

1. Identify the claim. State the null and alternative hypotheses.

2. Specify the level of significance.

3. Determine the sample size n by finding the difference for each data pair. Assign a + sign for a positive difference, a – sign for a negative difference, and a 0 for no difference.

Continued.

Performing a Paired-Sample Sign Test

In Words In Symbols

State H0 and Ha.

Identify .

n = total number of + and – signs

Larson & Farber, Elementary Statistics: Picturing the World, 3e 11

The Paired-Sample Sign Test

Performing a Paired-Sample Sign Test

In Words In Symbols

If the test statistic is less than or equal to the critical value, reject H0. Otherwise, fail to reject H0.

4. Determine the critical value.

5. Find the test statistic.

6. Make a decision to reject or fail to reject the null hypothesis.

7. Interpret the decision in the context of the original claim.

x = lesser number of + and – signs

Use Table 8 in Appendix B.

Larson & Farber, Elementary Statistics: Picturing the World, 3e 12

The Paired-Sample Sign Test

Student 1 2 3 4 5 6

Score on first SAT 308 456 352 433 306 471

Score on second SAT

300 524 409 419 304 483

Sign + + +

Example:Students at a certain school are required to take the SAT twice. The table shows both verbal SAT scores for 12 students. At = 0.05, can you conclude that the scores improved the second time they took the SAT?

Continued.

Student 7 8 9 10 11 12

Score on first SAT 538 207 205 351 360 251

Score on second SAT

708 253 399 350 480 303

Sign + + + + +

There are 8 + signs and 4 signs.

Larson & Farber, Elementary Statistics: Picturing the World, 3e 13

The Paired-Sample Sign Test

Example continued:H0: The SAT scores have not improved.Ha: The SAT scores have improved. (Claim)

Since there are 8 + signs and 4 signs, n = 8 + 4 = 12.

Using Table 8 with = 0.05 (one tailed) and n = 12, the critical value is 2.

The test statistic x is the smaller number of + signs or signs, so x = 4.

4 is greater than the critical value, so we fail to reject H0.

There is not enough evidence at the 5% level to support the claim that verbal SAT scores improved.

§ 11.2

The Wilcoxon Tests

Larson & Farber, Elementary Statistics: Picturing the World, 3e 15

The Wilcoxon Signed-Rank Test

The Wilcoxon signed-rank test is a nonparametric test that can be used to determine whether two dependent samples were selected from populations having the same distribution.

1. Identify the claim. State the null and alternative hypotheses.

2. Specify the level of significance.

3. Determine the sample size n.Continued.

Performing a Wilcoxon Signed-Rank Test

In Words In Symbols

State H0 and Ha.

Identify .

Larson & Farber, Elementary Statistics: Picturing the World, 3e 16

The Wilcoxon Signed-Rank Test

4. Determine the critical value.

5. Calculate the test statistic ws.

a. Complete a table with the following headers:

b. Find the sum of the positive ranks and the sum of the negative ranks.

c. Select the smaller of absolute values of the sums. Continued.

Performing a Wilcoxon Signed-Rank Test

In Words In Symbols

Use Table 9 in Appendix B.

Headers: Sample 1, Sample 2, Difference, Absolute value, Rank, and Signed rank.

Larson & Farber, Elementary Statistics: Picturing the World, 3e 17

The Wilcoxon Signed-Rank Test

Performing a Wilcoxon Signed-Rank Test

In Words In Symbols

If ws is less than or equal to the critical value, reject H0. Otherwise, fail to reject H0.

6. Make a decision to reject or fail to reject the null hypothesis.

7. Interpret the decision in the context of the original claim.

Larson & Farber, Elementary Statistics: Picturing the World, 3e 18

The Wilcoxon Signed-Rank Test

Patient 1 2 3 4 5 6 7Headache Hours (before)

0.8

2.4

2.8

2.6

2.7

0.9 1.2

Headache Hours (after)

1.6

1.3

1.6

1.4

1.5

1.6 1.7

Example:A medical researcher want to determine whether a new drug affects the number of headache hours experienced by headache sufferers. To do so, he selects seven patients and asks each to give the number of headache hours (per day) each experiences before and after taking the drug. The results are shown in the table. At = 0.05, can the researcher conclude that the new drug affects the number of hours?

Continued.

H0: The drug does not affect the number of headache hours.Ha: The drug does affect the number of headache hours. (Claim)

This is a two-tailed signed-rank test with = 0.05 and n = 7. From Table 9, the critical value is 2.

Larson & Farber, Elementary Statistics: Picturing the World, 3e 19

The Wilcoxon Signed-Rank Test

Hours (befor

e)

Hours (after)

Difference

Absolute value

RankSigned rank

0.8 1.6 0.8 0.8 3 3

2.4 1.3 1.1 1.1 4 4

2.8 1.6 1.2 1.2 6 6

2.6 1.4 1.2 1.2 6 6

2.7 1.5 1.2 1.2 6 6

0.9 1.6 0.7 0.7 2 2

1.2 1.7 0.5 0.5 1 1

Example continued:

Continued.

The average of rank 5, 6, and 7 is used for these.

The sum of the negative ranks is 6.

The sum of the positive ranks is 22.

Larson & Farber, Elementary Statistics: Picturing the World, 3e 20

The Wilcoxon Signed-Rank Test

Example continued:

The test statistic is the smaller of the absolute value of the two sums.

|6| = 6

ws = 6 which is greater than the critical value of 2.

|22| = 22

Fail to reject H0.

There is not enough evidence at the 5% level to support the claim that the drug affects the number of headache hours.

Larson & Farber, Elementary Statistics: Picturing the World, 3e 21

The Wilcoxon Rank Sum Test

The Wilcoxon rank sum test is a nonparametric test that can be used to determine whether two independent samples were selected from populations having the same distribution.

A requirement for the Wilcoxon rank sum test is that the sample size of both samples must be at least 10.

n1 represents the size of the smaller sample and n2 represents the size of the larger sample.

When calculating the sum of the ranks R, use the ranks for the smaller of the two samples.

Larson & Farber, Elementary Statistics: Picturing the World, 3e 22

The Wilcoxon Rank Sum Test

Test Statistic for the Wilcoxon Rank Sum TestGiven two independent samples, the test statistic z for the Wilcoxon rank sum test is

where

R = sum of the ranks for the smaller sample,

and

R

R

R μz

σ

R

n n nμ 1 1 2 1

,2

R

n n n nσ 1 2 1 2 1

.12

Larson & Farber, Elementary Statistics: Picturing the World, 3e 23

The Wilcoxon Rank Sum Test

1. Identify the claim. State the null and alternative hypotheses.

2. Specify the level of significance.

3. Determine the critical value.

4. Determine the sample sizes.

Continued.

Performing a Wilcoxon Rank Sum Test

In Words In Symbols

State H0 and Ha.

Identify .

n1 n2

Use Table 4 in Appendix B.

Larson & Farber, Elementary Statistics: Picturing the World, 3e 24

The Wilcoxon Rank Sum Test

Performing a Wilcoxon Rank Sum Test

In Words In Symbols

5. Find the sum of the ranks for the smaller sample.

a. List the combined data in ascending order.

b. Rank the combined data.

c. Add the sum of the ranks for the smaller sample.

6. Calculate the test statistic.

R

R

R

R μz

σ

Continued.

Larson & Farber, Elementary Statistics: Picturing the World, 3e 25

The Wilcoxon Rank Sum Test

Performing a Wilcoxon Rank Sum Test

In Words In Symbols

If z is in the rejection region, reject H0. Otherwise, fail to reject H0.

7. Make a decision to reject or fail to reject the null hypothesis.

8. Interpret the decision in the context of the original claim.

Larson & Farber, Elementary Statistics: Picturing the World, 3e 26

The Wilcoxon Rank Sum Test

Industry Salary (in thousands of dollars)

Manufacturing

31 38 33 33 35 47 33 29 38 45

Construction 31 30 27 32 28 34 30 33 26 35

Example:An industry analyst claims that there is no difference in the salaries earned by workers in the manufacturing and construction industries. A random sample of 10 manufacturing and 10 construction workers and their salaries is shown below. At = 0.10, can you reject the analyst’s claim? (Adapted from US Bureau of Labor Statistics)

Continued.

H0: There is no difference between the salaries. (Claim)

Ha: There is a difference between the salaries.

Larson & Farber, Elementary Statistics: Picturing the World, 3e 27

The Wilcoxon Rank Sum Test

Example continued:Because the test is a two-tailed test with = 0.10, the critical values are

z0 = 1.645 and z0 = 1.645.

Continued.

The rejection regions are z 1.645 and z 1.645.

To find the values of R, μR, andR, construct a table that shows the combined data in ascending order and the corresponding ranks.

Larson & Farber, Elementary Statistics: Picturing the World, 3e 28

The Wilcoxon Rank Sum Test

Ordered data

Sample

Rank

26 C 127 C 228 C 329 M 430 C 5.530 C 5.531 M 7.531 C 7.532 C 933 C 11.5

Example continued:

Continued.

Ordered data

Sample

Rank

33 M 11.533 M 11.533 M 11.534 C 1435 M 15.535 C 15.538 M 17.538 M 17.545 M 1947 M 20

Larson & Farber, Elementary Statistics: Picturing the World, 3e 29

The Wilcoxon Rank Sum Test

Example continued:

Continued.

Because the samples are the same size, n1 can be associated with either sample. If we let n1 be the sample of the construction workers, then R is the sum of the construction rankings.R = 1 + 2 + 3 + 5.5 + 5.5 + 7.5 + 9 + 11.5 + 14 + 15.5

= 74.5

Using n1 = 10 and n2 = 10, we can find μR, andR.

R

n n nμ 1 1 2 1 10 10 10 1

1052 2

R

n n n nσ 1 2 1 2 1 10 10 10 10 1

13.2312 12

Larson & Farber, Elementary Statistics: Picturing the World, 3e 30

The Wilcoxon Rank Sum Test

Example continued:

When R = 74.5, μR = 105 andR = 13.23, the test statistic is

R

R

R μz

σ 74.5 105 2.31.

13.23

Since 2.31 is less than the critical value of 1.645,H0 is rejected.

There is enough evidence at the 10% level to reject the claim that there is no difference in the salaries earned by workers in the manufacturing and construction industries.

§ 11.3

The Kruskal-Wallis Test

Larson & Farber, Elementary Statistics: Picturing the World, 3e 32

The Kruskal-Wallis TestThe Kruskal-Wallis test is a nonparametric test that can be used to determine whether three or more independent samples were selected from populations having the same distribution.

The null and alternative hypotheses for the Kruskal-Wallis test are as follows.

H0: There is no difference in the distribution of the populations.

Ha: There is a difference in the distribution of the populations.

Two conditions for using the Kruskal-Wallis test are that each sample must be randomly selected and the size of each sample must be at least 5. If these conditions are met, the test is approximated by a chi-square distribution with k – 1 degrees of freedom where k is the number of samples.

Larson & Farber, Elementary Statistics: Picturing the World, 3e 33

The Kruskal-Wallis Test

Test Statistic for the Kruskal-Wallis Test

Given three or more independent samples, the test statistic H for the Kruskal-Wallis test is

where k represent the number of samples, ni is the size of the ith sample, N is the sum of the sample sizes,

and

Ri is the sum of the ranks of the ith sample.

2 2 21 2

1 2

12 ... 3( 1)( 1)

k

k

R R RH N

n n nN N

Larson & Farber, Elementary Statistics: Picturing the World, 3e 34

The Kruskal-Wallis Test

1. Identify the claim. State the null and alternative hypotheses.

2. Specify the level of significance.

3. Identify the degrees of freedom

4. Determine the critical value and the rejection region. Continued.

Performing a Kruskal-Wallis Test

In Words In Symbols

State H0 and Ha.

Identify .

Use Table 6 in Appendix B.

d.f. = k – 1

Larson & Farber, Elementary Statistics: Picturing the World, 3e 35

The Kruskal-Wallis Test

Performing a Kruskal-Wallis Test

In Words In Symbols

5. Find the sum of the ranks for each sample.

a. List the combined data in ascending order.

b. Rank the combined data.

6. Calculate the test statistic.2 2 21 2

1 2

12( 1)

...

3( 1)

k

k

HN N

R R Rn n n

N

Continued.

Larson & Farber, Elementary Statistics: Picturing the World, 3e 36

The Kruskal-Wallis Test

Performing a Kruskal-Wallis Test

In Words In Symbols

If H is in the rejection region, reject H0. Otherwise, fail to reject H0.

7. Make a decision to reject or fail to reject the null hypothesis.

8. Interpret the decision in the context of the original claim.

Larson & Farber, Elementary Statistics: Picturing the World, 3e 37

The Kruskal-Wallis TestExample:An insurance agent want to determine whether there is a difference in the annual premiums for home insurance in three states. He randomly selects homes from each state and records the annual premium for each state as shown below. At = 0.05, can he conclude that the distributions of the annul premiums are different?

Continued.

H0: There is no difference in the premiums in the three states.Ha: There is a difference in the premiums in the three states. (Claim)

State Annual Premium (in dollars)

New Jersey 441 420 474 411 371 470

New York 753 684 869 719 1036 613 663

Pennsylvania 653 405 380 484 383 382 387

Larson & Farber, Elementary Statistics: Picturing the World, 3e 38

The Kruskal-Wallis TestExample continued:This is a right-tailed test with = 0.05 and d.f. = k – 1 = 3 – 1 = 2.From Table 6, the critical value is χ0

2 = 5.991.

Continued.

Ordered data

Sample

Rank

371 NJ 1380 PA 2382 PA 3383 PA 4387 PA 5405 PA 6411 NJ 7420 NJ 8441 NJ 9470 NJ 10

Ordered data

Sample

Rank

474 NJ 11484 PA 12613 NY 13653 PA 14663 NY 15684 NY 16719 NY 17753 NY 18869 NY 191036 NY 20

The table shows the order and rank of the data.

Larson & Farber, Elementary Statistics: Picturing the World, 3e 39

The Kruskal-Wallis TestExample continued:The sum of the ranks for each sample is as follows.

R1 = 1 + 7 + 8 + 9 + 10 + 11 = 46R2 = 13+ 15 + 16 +17 + 18 + 19 + 20 = 118R3 = 2 + 3 + 4 + 5 + 6 + 12 + 14 = 46

The test statistic is22 231 2

1 2 3

12 3( 1)( 1)

RR RH N

n n nN N

2 2 212 46 118 46 3(20 1)6 7 720(20 1)

12.55. Because 12.55 is greater than the critical value of 5.991, reject H0.

There is enough evidence at the 5% level to support the claim that the annual premiums are different in the three states.

§ 11.4Rank Correlation

Larson & Farber, Elementary Statistics: Picturing the World, 3e 41

The Spearman Rank Correlation Coefficient

The Spearman rank correlation coefficient rs is a measure of the strength of the relationship between two variables. The Spearman rank correlation coefficient is calculated using the ranks of paired sample data entries. The formula for the Spearman rank correlation coefficient is

where n is the number of paired data entries,

and

d is the difference between the ranks of a paired data entry.

2

261( 1)s

drn n

Larson & Farber, Elementary Statistics: Picturing the World, 3e 42

The Spearman Rank Correlation Coefficient

The values of rs range from 1 to 1, inclusive. If the ranks of corresponding data pairs are identical, rs is equal to +1. If the ranks are in “reverse” order, rs is equal to 1. If there is no relationship, rs is equal to 0.

The null and alternative hypotheses for this test are as follows.

H0: ρs = 0 (There is no correlation between the variables.)

Ha: ρs 0 (There is a significant correlation between the variables.)

To determine whether the correlation between variables is significant, you can perform a hypothesis test for the population correlation coefficient ρs.

Larson & Farber, Elementary Statistics: Picturing the World, 3e 43

The Spearman Rank Correlation Coefficient

1. State the null and alternative hypotheses.

2. Specify the level of significance.

3. Determine the critical value.

Continued.

Testing the Significance of the Correlation Coefficient In Words In Symbols

State H0 and Ha.

Identify .

Use Table 10 in Appendix B.

Larson & Farber, Elementary Statistics: Picturing the World, 3e 44

The Spearman Rank Correlation Coefficient

Testing the Significance of the Correlation CoefficientIn Words In Symbols

4. Find the test statistic.

5. Make a decision to reject or fail to reject the null hypothesis.

6. Interpret the decision in the context of the original claim.

2

261

1sdr

n n

If is greater than the critical value, reject H0. Otherwise, fail to reject H0.

sr

Larson & Farber, Elementary Statistics: Picturing the World, 3e 45

The Spearman Rank Correlation Coefficient

Example:A Consumer Report article claims that the price of a portable CD player is related to its quality. To test this claim, you randomly select 11 portable CD players and determine the overall score and price of each. The overall score represents the error correction, locate speed, battery life, and headphone quality of a CD player. The results are in the table below. At = 0.01, can you conclude that there is a correlation between the overall score and the price? (Adapted from Consumer Reports)

Continued.

Overall Score

Price (in dollars)

82 15078 10068 12067 14061 14560 100

Overall Score

Price (in dollars)

60 15058 8057 20055 8049 75

Larson & Farber, Elementary Statistics: Picturing the World, 3e 46

The Spearman Rank Correlation Coefficient

Example continued:

Continued.

H0: ρs = 0 (There is no correlation between score and price.)

Ha: ρs 0 (There is significant correlation between score and price.) (Claim)

Overall Score

Rank Price (in dollars)

Rank d d2

82 11 150 9.5 1.5 2.2578 10 100 4.5 5.5 30.2

568 9 120 6 3 967 8 140 7 1 161 7 145 8 -1 160 5.5 100 4.5 1 160 5.5 150 9.5 -4 1658 4 80 2.5 1.5 2.2557 3 200 11 -8 6455 2 80 2.5 -0.5 0.2549 1 75 1 0 0

2 127d

Larson & Farber, Elementary Statistics: Picturing the World, 3e 47

The Spearman Rank Correlation Coefficient

Example continued:

From Table 10 with = 0.01 and n = 11, the critical value is 0.818.

When n = 11 and ∑d 2 = 127, the test statistic is

2

261

1sdr

n n

26(127)1

11 11 1

0.423.

Because 0.423 < 0.818, we fail to reject H0.

At the 1% level, there is not enough evidence to conclude that there is a significant correlation between the overall score of a CD player and its price.

§ 11.5

The Runs Test

Larson & Farber, Elementary Statistics: Picturing the World, 3e 49

The Runs Test for Randomness

A run is a sequence of data having the same characteristic. Each run is preceded by and followed by data with a different characteristic or by no data at all. The number of data in a run is called the length of the run.

Example:The gender of babies born in a hospital in one month was recorded in order of birth, where F represents a female and M represents a male. Determine the number of runs and the length of each run. F F F M M F F M F M M M F F F M M M M

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

There are 8 runs.

Length of runs: 3 2 2 1 1 3 3 4

Larson & Farber, Elementary Statistics: Picturing the World, 3e 50

The Runs Test for Randomness

The runs test for randomness is a nonparametric test that can be used to determine whether a sequence of sample data is random.

Test Statistic for the Runs TestWhen n1 20 and n2 20, the test statistic for the runs test is G, the number of runs.

When n1 > 20 or n2 > 20, the test statistic for the runs test is

where

G

G

G μz

σ

G Gn n n n n n n nμ σ

n n n n n n1 2 1 2 1 2 1 2

21 2 1 2 1 2

2 2 (2 ) +1 and .( ) ( 1)

Larson & Farber, Elementary Statistics: Picturing the World, 3e 51

The Runs Test for Randomness

1. Identify the claim. State the null and alternative hypotheses.

2. Specify the level of significance. (Use = 0.05 for the runs test.)

3. Determine the number of data that have each characteristic and the number of runs.

4. Determine the critical value.Continued.

Performing a Runs Test for Randomness

In Words In Symbols

State H0 and Ha.

Identify .

Determine n1, n2, and G.

If n1 20 and n2 20, use Table 12. If n1 > 20 or n2 > 20, use Table 4.

Larson & Farber, Elementary Statistics: Picturing the World, 3e 52

The Runs Test for Randomness

Performing a Runs Test for Randomness

In Words In Symbols

5. Calculate the test statistic.

6. Make a decision to reject or fail to reject the null hypothesis.

7. Interpret the decision in the context of the original claim.

If G the lower critical value, or if G the upper critical value, reject H0. Otherwise, fail to reject H0.

.G

G

G μz

σ

If n1 20 and n2 20, use G.If n1 > 20 or n2 > 20, use

Larson & Farber, Elementary Statistics: Picturing the World, 3e 53

The Runs Test for Randomness

Example:An English professor at Smithville College is usually late for class. Students in his morning class record whether he is late (L) or on time (T ) for class each day. The results are shown below. At = 0.05, can you conclude that the sequence is not random?

T T L T T L T T L T T L T T L T T L T T T T T TL T T L T T L T T L T T L T L T T L T T T T T LT T T T T L T T T L

Continued.

H0: The sequence of arrivals is random. Ha: The sequence of arrivals is not random. (Claim)

n1 = the number of Ts = 42

T T L T T L T T L T T L T T L T T L T T T T T TL T T L T T L T T L T T L T L T T L T T T T T LT T T T T L T T T L

Because n1 > 20, use Table 4 to find the critical values of z0 = 1.96 and z0 = 1.96.

n2 = the number of Ls = 16G = the number runs = 32

Larson & Farber, Elementary Statistics: Picturing the World, 3e 54

The Runs Test for Randomness

Example continued:

G

G

G μz

σ

G

n n n n n nσn n n n

1 2 1 2 1 22

1 2 1 2

2 (2 )( ) ( 1)

1 2

1 2

21G

n nμ

n n

Find the test statistic by first calculating μG and G.

32 24.1724 2.613.0023

2(42)(16) 1 24.172442 16

22(42)(16)[2(42)(16) 42 16) 3.002

(42 16) (42 16 1)

Because 2.61 > 1.96, reject H0.

At the 5% level, there is enough evidence to support the claim that the sequence of arrivals is not random.

Larson & Farber, Elementary Statistics: Picturing the World, 3e 55

The Runs Test for Randomness

Example:Students in the English professor’s afternoon class also record whether he is late (L) or on time (T ) for class each day. The results are shown below. At = 0.05, can you conclude that this sequence is not random?

T T L T L L L L L T T T L L LL L L L T L T L L L T L L L

Continued.

H0: The sequence of arrivals is random. Ha: The sequence of arrivals is not random. (Claim)

n1 = the number of Ts = 9 n2 = the number of Ls = 20

G = the number runs = 12

T T L T L L L L L T T T L L LL L L L T L T L L L T L L L

Larson & Farber, Elementary Statistics: Picturing the World, 3e 56

The Runs Test for Randomness

Example continued:

The test statistic is the number of runs G = 12.

At the 5% level, there is not enough evidence to support the claim that the sequence of arrivals is not random.

Because 12 is between the critical values of 8 and 18, we fail to reject H0.

Because n1 20 and n2 20, use Table 12 to find the lower critical value 8 and the upper critical value 18.