130 likes | 227 Views
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.
E N D
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 • 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
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
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
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)
2n1n2 (2n1n2 – n) σr = ----------------------- n²(n – 1) Runs Test (large case) Large-Sample Case:If n1 > 20 or n2> 20 the test statistic in the runs test for randomness is 2n1n2 μr = -------- + 1 n r - μr z = ------- σr where 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. Critical Values for a Runs Test for Randomness Use Table IV, the standard normal table.
Hypothesis Tests for Randomness Use Runs Test Step 0 Requirements: 1) sample is a sequence of observations recorded in order of their occurrence 2) 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 - μr z0 = ------- σr Small-Sample: r Large Sample: Small-Sample Case: r outside Critical interval Large-Sample Case: z0 < -zα/2 or z0 > zα/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. Values n = 16 n1 = 9 n2 = 7 r = 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.
2n1n2 (2n1n2 – n) σr = ----------------------- = 9.9624 n²(n – 1) Example 2 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, 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. Values n = 38 n1 = 16 n2 = 22 r = 18 2n1n2 μr = -------- + 1 = 19.5263 n r - μr z = --------- r z = -0.515 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.
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 r - μr z = --------- r We transform this into a confidence interval, PE +/- MOE.
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
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