Ucla Stat 110B
Total Page:16
File Type:pdf, Size:1020Kb
UCLA STAT 110B Why Use Applied Statistics for Engineering Nonparametric Statistics? and the Sciences zParametric tests are based upon assumptions that may include the following: zInstructor: Ivo Dinov, The data have the same variance, regardless of the treatments or Asst. Prof. In Statistics and Neurology conditions in the experiment. The data are normally distributed for each of the treatments or zTeaching Assistants: Brian Ng, UCLA Statistics conditions in the experiment. University of California, Los Angeles, Spring 2003 zWhat happens when we are not sure that these http://www.stat.ucla.edu/~dinov/courses_students.html assumptions have been satisfied? Stat 110B, UCLA, Ivo Dinov Slide 1 Slide 2 Stat 110B, UCLA, Ivo Dinov The Wilcoxon Rank Sum Test How Do Nonparametric Tests Compare with the Usual z, t, and F Tests? z Suppose we wish to test the hypothesis that two distributions have the same center. z Studies have shown that when the usual z We select two independent random samples from each assumptions are satisfied, nonparametric tests are population. Designate each of the observations from about 95% efficient when compared to their population 1 as an “A” and each of the observations parametric equivalents. from population 2 as a “B”. z When normality and common variance are not z If H0 is true, and the two samples have been drawn satisfied, the nonparametric procedures can be from the same population, when we rank the values in much more efficient than their parametric both samples from small to large, the A’s and B’s equivalents. should be randomly mixed in the rankings. Slide 3 Stat 110B, UCLA, Ivo Dinov Slide 4 Stat 110B, UCLA, Ivo Dinov What happens when H0 is true? What happens if H0 is not true? •Suppose we had 5 measurements from • If the observations come from two different population 1 and 6 measurements from populations, perhaps with population 1 lying population 2. to the left of population 2, the ranking of the observations might take the following ordering. •If they were drawn from the same population, the rankings might be like this. AAABABABBB ABABBABABBA •In this case if we summed the ranks of the A In this case the sum of the ranks of the B measurements and the ranks of the B observations would be larger than that for the measurements, the sums would be similar. A observations. Slide 5 Stat 110B, UCLA, Ivo Dinov Slide 6 Stat 110B, UCLA, Ivo Dinov 1 The Wilcoxon Rank Sum Test How to Implement Wilcoxon’s Rank Test H : the two population distributions are the same H00: the two population distributions are the same •Rank the combined sample from smallest to HHa:: thethe twotwo populationspopulations areare inin somesome wayway differentdifferent largest. a *. •Let T1 represent the sum of the ranks of the z The test statistic is the smaller of T1 and T1 first sample (A’s). z Reject H if the test statistic is less than the critical •Then, * defined below, is the sum of the 0 T 1 value found in Table 7(a). ranks that the A’s would have had if the observations were ranked from large to small. z Table 7(a) is indexed by letting population 1 be the one associated with the smaller sample size n1, and * T1 = n 1 (n 1+ n 2 +1) − T 1 population 2 as the one associated with n2, the larger sample size. Slide 7 Stat 110B, UCLA, Ivo Dinov Slide 8 Stat 110B, UCLA, Ivo Dinov Example The Bee Problem The wing stroke frequencies of two Can you conclude that the distributions of wing strokes differ for these two species? α = .05. speciesIfIf severalseveral of measurements measurementsbees were arearerecorded tied,tied, for a sample of n1 each gets the average of the ranks = 4each from gets species the average 1 ofand the nranks= 6 from species 2. SpeciesRejectReject 1 Species HH0 2.. DataDataCalculate providesprovides T sufficientsufficient= 7 + 8 + 9 +10 = 34 they would have gotten, if they2 0 1 they would have gotten, if they 235 evidence(10) 180 (3.5) indicating a difference in Canwere you not tied!conclude (See x = that 180) the distributions of wing evidence indicating a difference* in were not tied! (See x = 180) 225 the(9) distributions169 (1) of wing Tstroke1 = n 1(n1 + n2 +1) −T1 strokes differ for these two species? Use α = .05. the distributions of wing stroke H : the two species are the same 190 frequencies.(8)frequencies.180 (3.5) = 4(4 + 6 +1) − 34 =10 Species 1 Species 2 H00: the two species are the same H : the two species are in some way different 188 (7) 185 (6) 235 180 Ha : the two species are in some way different (10) (3.5) a 178 (2) 1. The test statistic is T = 10. 225 169 1. The sample with the smaller sample (9) (1) 182 (5) size is called sample 1. 190 (8) 180 (3.5) 2. The critical value of T from 188 (7) 185 (6) 2. We rank the 10 observations from Table 7(b) for a two-tailed test 178 (2) smallest to largest, shown in with α/2 = .025 is T = 12; H0 is 182 (5) parentheses in the table. rejected if T ≤ 12. Slide 9 Stat 110B, UCLA, Ivo Dinov Slide 10 Stat 110B, UCLA, Ivo Dinov Minitab Output Large Sample Approximation: Wilcoxon Rank Sum Test * Recall T1 = 34;T1 = 10. When n1 and n2 are large (greater than 10 is large Mann-Whitney Test and CI: Species1, Species2 enough), a normal approximation can be used to Species1 N = 4 Median = 207.50 approximate the critical values in Table 7. Species2 N = 6 Median = 180.00 * * Point estimate for ETA1-ETA2 is 30.50 1. Calculate T1 and T1 . Let T = min(T1,T1 ). 95.7 Percent CI for ETA1-ETA2 is (5.99,56.01) * W = 34.0 T1 = n 1 (n 1+ n 2 +1) − T 1 Test of ETA1 = ETA2 vs ETA1 not = ETA2 is significant T − µT at 0.0142 2. The statistic z = has an approximate The test is significant at 0.0139 (adjusted for ties) σT T1 = sum of the ranks MinitabMinitab calls calls thethe procedureprocedure thethe Mann-WhitneyMann-Whitney UU z distribution with of sample 1 (A’s). Test,Test, equivalentequivalent to to thethe WilcoxonWilcoxon Rank Rank SumSum Test.Test. n1(n1 + n2 +1) 2 n1n2 (n1 + n2 +1) The test statistic is W = T = 34 and has p-value µT = and σT = The test statistic is W = T11 = 34 and has p-value = .0142. Do not reject H for α = .05. 2 12 = .0142. Do not reject H00 for α = .05. Slide 11 Stat 110B, UCLA, Ivo Dinov Slide 12 Stat 110B, UCLA, Ivo Dinov 2 Some Notes The Sign Test •When should you use the Wilcoxon Rank Sum zThe sign test is a fairly simple test instead of the two-sample t test for procedure that can be used to compare two independent samples? populations when the samples consist of 9when the responses can only be ranked and paired observations. not quantified (e.g., ordinal qualitative data) zIt can be used 9when the F test or the Rule of Thumb shows a 9when the assumptions required for the paired- problem with equality of variances difference test are not valid or 9when a normality plot shows a violation of 9 when the responses can only be ranked as “one the normality assumption better than the other”, but cannot be quantified. Slide 13 Stat 110B, UCLA, Ivo Dinov Slide 14 Stat 110B, UCLA, Ivo Dinov The Sign Test The Sign Test 99ForFor eacheach pair,pair, measuremeasure whetherwhether thethe firstfirst H : the two populations are identical versus response—say,response—say, A—exceedsA—exceeds thethe secondsecond H00: the two populations are identical versus H : one or two-tailed alternative response—say,response—say, B.B. Haa: one or two-tailed alternative is equivalent to 99TheThe testtest statisticstatistic isis xx,, thethe numbernumber ofof timestimes thatthat is equivalent to A exceeds B in the n pairs of observations. H : p = P(A exceeds B) = .5 versus A exceeds B in the n pairs of observations. H00: p = P(A exceeds B) = .5 versus 9Only pairs without ties are included in the test. H : p (≠, <, or >) .5 9Only pairs without ties are included in the test. Haa: p (≠, <, or >) .5 99CriticalCritical valuesvalues forfor thethe rejectionrejection regionregion oror exactexact TestTest statistic:statistic: xx== numbernumber ofof plusplus signssigns pp-values-values cancan bebe foundfound usingusing thethe cumulativecumulative RejectionRejection regionregion,, pp-values-valuesfrom from Bin(n=size,Bin(n=size, p).p). binomialbinomial distributiondistribution (SOCR(SOCR resourceresource online).online). Slide 15 Stat 110B, UCLA, Ivo Dinov Slide 16 Stat 110B, UCLA, Ivo Dinov Example The Gourmet Chefs Meal 1 2 3 4 5 6 7 8 Two gourmet chefs each tasted and rated Chef A 6 4 7 8 2 4 9 7 eight different meals from 1 to 10. Does it appear Chef B 8 5 4 7 3 7 9 8 that one of the chefs tends to give higher ratings Sign - - + + pp-value-value- - =.454=.4540 is-is tootoo large large toto rejectreject HH0. ThereThere isis insufficientinsufficient than the other? Use α = .01. H : p = .5 0 H00: p = .5 evidenceevidence toto indicateindicate that that oneone H : p ≠ .5 with n = 7 (omit the tied pair) Meal 1 2 3 4 5 6 7 8 Haa: p ≠ .5 with n = 7 (omitchef chefthe tied tendstends pair) toto raterate one one mealmeal Chef A 6 4 7 8 2 4 9 7 TestTest Statistic:Statistic: x x== numbernumber ofof higher plushigherplus signssigns thanthan = =the the 22 other.