1-sample Wilcoxon Signed Rank Test - Central Michigan University

Transcription

1-sample Wilcoxon Signed Rank Testtest for the median of a single population.5-Step Procedure1. Set H0: M M0Ha: M M0M M0M M02. Select α3. Test statistic4. Find the p-value or the critical value/rejection region5 Draw the conclusion5.

1-sample Wilcoxon Signed Rank Test It is an analog of the 1-sample t-test from a normally distributed population, as thet-test does. But Wilcoxon test assumes the datacomes from a symmetric distribution. Wilcoxontest does not require the data to come If you cannot justify this assumption ofsymmetry,t use theth nonparametrict i 1-sample1l signitest, which does not assume a symmetricdistribution.distribution

1-sample Wilcoxon Signed Rank TestTest Statistic Calculate Di Xi - M0 , do not use the observation ifXi M0 and reduce n by 1.1 Rank Di . For same Di s the ranks are the average ofthe consecutive ranks of Di s as if they are not tiedtied. Calculate T , the sum of the ranks with positive Disand T , the sum of the ranks with negative The test statistic is smaller of T or T for Ha: M M0; T for Ha: M M0 and T for Ha: M M0 Use formula T T n(n 1)/2. Why?

1-sample Wilcoxon Signed Rank Testp-valueUse Table A.3,A 3 see the following exampleexample.

1-sample Wilcoxon Signed Rank TestExample 2.2 Drug abuse study, the median IQ ofabusers of 16 of age or olderolder. 15 of them were selectedand their IQ scores were recordedUsing TI-83TI 83 and table A.3A3Using Minitab or other statistical programs

1-sample Wilcoxon Signed Rank Test1 Open the worksheet enter the data of the sampleor the file contains the data.2 Choose Stat Nonparametrics 1-SampleWilcoxon.3 In Variables, enter the variable name for whichthe median is being tested4 Choose Test median,, and enter the value of µ0 inthe box. Click OK.

1-sample Wilcoxon Signed Rank TestExample 2.2Using Minitab or otherstatistical programs

1-sample Wilcoxon Signed Rank TestLargeg samplep approximationppwhere t is the number of tied Di s for a particular rank.

100(1- α)% Confidence Interval based on Sign Test Order the sample X1, X2, X3, ··· Xn as Y1, Y2, Y3, ··· Yn Determine k for the K Binomial(n, p 0.5) such thatP( K k ) α/2 and P( K k 1 ) α/2. Τhis will result two Cis(Yk, Yn-k 1) with the confidence level great than 100(1- α)%(Yk 1, Yn-k) withith theth confidencefidlevell l lessl thanth 100(1100(1 α)%.)%Note that (Yk, Yn-k 1) actually is [Yk 1, Yn-k] because theavailable data for constructingg the interval are discrete.

100(1- α)% Confidence Interval based on Sign Test If P( K k ) a/2 there is an exact 100(1- α)% CI. Most of thetime a decision has to be made either choose the narrower CI withthe confidence level less than 100(1100(1- α)% or a wider CI with theconfidence level great than 100(1- α)%. Note table A.1, a binomial probability table or TI-83 can be usedfor finding k such that P( K k ) a/2. The sample median gives a point estimation for the median.Examples

100(1- α)% Confidence Intervalbased on Wilcoxon Signed Rank Test Compute all possible µij (Xi Xj)/2, where 1 i j n. There are n(n-1)/2 n these averages symmetrically distributed aboutth median.thedi Order the µijs as Y1, Y2, Y3, ··· Ym, where m n(n-1)/2 nUse Table AA.33 to determine T such that the corresponding P(T) α/2 and P( T 1 ) α/2. Τhis will result two CIs:(YT, Ym-T 1) with the confidence level great than 100(1- α)%(YT 1, Ym-T) with the confidence level less than 100(1- α)% If P(T) a/2 there is an exact 100(1- α)% CI. Most of the time ad i i hasdecisionh tot beb maded eitherith choosehtheth narrower CI withith thethconfidence level less than 100(1- α)% or a wider CI with theconfidence level great than 100(1- α)%. The median of µijs gives a point estimation for the populationmedian.

Example 2.528.525.2 28.7 4129.132.337.739.91. Compute µijs and sort them using MinitabChoose Stat Nonparametrics Pairwise AveragesSort the µijs as the following25.20252026.0026.8026 8526.8526.9527.0027 1527.1527.6527.7527 8027.8027.9528.50285028.6028.6528 7028.7028.7528.7528 8028.8028.8028.9028 9528.9529.1029.55295530.4030.5030 5530.5530.7031.4532 2532.2532.3032.5533 1033.1033.1033.20332033.2533.3533 4033.4033.9034.2034 3034.3034.3534.5034 7534.7534.8534.90349035.0035.0536 1036.1036.6537.7038 8038.8039.3539.9040 4540.4541.0026.828.8

Example 2.52. Determine the T using Table A.3when T 8 P(8) 0.0244 0.025(α/2),when T 9 P(9) 0.0322 0.025(α/2)3. The two CIs:(YT, Ym-T 1) (Y8, Y55-8 1) (27.65, 36.10) with the confidencelevel 95.12%95 12% great than 95%(YT 1, Ym-T) (Y9, Y55-8) (27.75, 35.05) with the confidencelevel 93.56% less than 85%One can choose either one of the two, or choose the with theconfidence level as closest to 95%. That is (27.65, 36.10).Q tiQuestionsIs the result consistent with that in the text book? Explain why?pwhy?yIs the result consistent with that in the Minitab? ExplainWhat is the Wilcoxon point estimate for the median?What is the assumption for this procedure?

Example 2.5A graphic method is shown as in Figure 2.2 and is described in thedetails with 9 steps. See the textbook page 53-54.

Binomial Testtest for the proportion p of a single population.5-Step Procedure1. Set H0: p p0Ha: p p0p p0p p02. Select α3. Test statistic4. Find the p-value or the critical value/rejection region5 Draw the conclusion5.

Binomial Test Test StatisticFor random variable K Binomial(n, p0), the teststatistict ti ti k isi theth observedbd valuel off K andd theth numberb off“successes” in n trials. p-valuel isi 2 multiplyslti l theth smallerll off p(K k (K k n, p0) orp(K k n, p0) for Ha: p p0, p(K k n, p0) for Ha: p p0 and p(K k nn, p0) for Ha: p p0. For using rejectionmethod, read the textbook, page 58-59.Example

100(1- α)% Confidence Interval based on Binomial Test Use Table A.4 for 90%, 95% and 99% CIEnter n and k for the lower limit. For the upper limit:take 1-the value obtained by entering n and n-k form Table A.4ExampleQuestionsWhat pparameter is the binomial confidence interval constructed for?What is point estimator the parameter mentioned above?

1-sample Runs Test for RandomnessA test is not about parametersparameters. Is the sequence ofobservations of a binary variable such as tossing a coin seem to random? 5-Stepp Procedure1. Set H0: The sequence of observations is randomHa: The sequence of observations is not random (two side)Th sequence off observationsThebtiisi nott randomdbecauseboff tootfew runs (left, one side)The sequence of observations is not random because of toomany runs (right, one side)2. Select α3 Test statistic3.4. Find the p-value or the critical value/rejection region5. Draw the conclusion

1-sample Runs Test for RandomnessWhat are runs? For example tossing a coin 10 timesH H H H H H H H H H have just one run.H H H H H T T T T T have just two runs.runs.H T H T H T H T H T have ten runs.The test statistic r is the number of runs. The rejection regions aregiven in Table A.5 and A.6 for the rejection of two side test α 0.05for two side and α 0.025 for one side, entering n the sample size,n1 the number of heads for example, n2, the number of tails and rthe number of runs. Use Table A.5 for left side test and Table A.6for right side test.

Cox-Stuart Test for TrendTest for the trend of median of a single population.5-Step Procedure1 Set1.S t H0: NoN ttrendd iin theth datad tHa: There is an upward trend or downward trend(two side)side).There is an upward trend (right, one side).There is an upwardptrend ((left,, one side).)2. Select α3. Test statistic4. Find the p-value or the critical value/rejection region5 Draw the conclusion5.

Cox-Stuart Test for TrendTest StatisticFor given sample X1, X2, X3, ··· Xn, Let C n/2 if n is even,otherwisethi C (n 1)/2.C ( 1)/2 ThThen pairi allll (X1, X1 C) (X2, X2 C),) (Xn-C, Xn), then the test statistic k is the number of plus signof each pair (1st – 2ndd) k or the number of minus sign ofeach pair k-.for the two side alternative is the smaller of k of k-;;for the right side alternative is the k ;for the left side alternative is the k-.The p-value P(K k n*, 0.5) where n* sum of k and k-.Example 2.22

Median TestTest for the equality of the medians of two populations.5-Step Procedure1. Set H0: Mx MyHa: Mx MyMx MyMx My2. Select α3. Test statistic4. Find the p-value or the critical value/rejection region5. Draw the conclusion

Median TestTest Statistic (an approximation by standard normaldistribution when sample sizes are large enough)XZ n1 Yn2 1 1 pˆ (1 pˆ ) n1 n2 where X and Y are the numbers of observations great thanthe sample median; n1 and n2 are the sample sizes forpopulation X and Y respectively; andX Ypˆ n1 n2

Median TestThe p-value or the rejection region can be determined usingTable A.1 or TI-83.Questions How large the sample size should so that theapproximation is appropriate? Is this the same formula used to test equalq pproportionspfortwo sample in a introductory statistical course? Why statistic (approximation) can be used for twodifferent test? Explain. Read page 84 for details.

Median TestExample

Mann-Whitley’s Test (Wilcoxon)Test for the equality of the medians of two populations.5-Step Procedure1. Set H0: Mx MyHa: Mx MyMx MyMx My2. Select α3. Test statistic4. Find the rejection region5. Draw the conclusion

Mann-Whitley’s Test (Wilcoxon)Test StatisticT S n1 ( n1 1)2where S the sum of the ranks for population X in acombined ranks of observations of X and Y; n1 and n2 arethe sample sizes for population X and Y respectively. UseTable A.7 to determine the rejectionjregiong T Wα/2 or T W1-α/2 for Mx My T W1-α for Mx My T Wα for Mx MyW1-α n1 n2 - Wα

Mann-Whitley’s Test (Wilcoxon)Example

100(1-a)% C I for Mx - MyFor given sample X1, X 2 , X3 , ··· X n1 , Y1, Y2 , Y3 , ··· X n 2 Compute all possible Xi – Yj . There are n1n2 of them. Sort these differences in as ascending orderd1 , d 2 , d 3 , ··· d n1 n 2 Use Table A.7 to determine the Wα/2 th smallest d as thelower limit L and the Wα/2 th largest d as the upper pimitU. Then present the 100(1-a)% C I as L Mx - My U.Example

AssumptionsFor Median Test Independent random samples Ordinal scale with continuous variable SameSshapehoff ttwo populationsl ti Same probability of exceeding the median if the medians are thesame.For Mann-Whitley Test Independent random samples Ordinal scale with continuous variable Same shape of two populationsFor 100(1-a)%( ) C I for Mx - My: Independent random samples Ordinal scale with continuous variable Same shape of two populations

Ansari-Bradley TestTest Equality of Two Standard Deviations5-Step5St ProcedurePd1. Set H0: σx σyHa: σx σyσx σyσx σy2. Select α3. Test statistic4. Find the rejection region5. Draw the conclusion

Ansari-Bradley TestTest Statistic Sort the combine the samplesX1 , X 2 , X 3 , ··· X n1 , Y1, Y2 , Y3 , ··· Yn 2 Rank the combined samples1, 2, 3, ··· n/2, n/2 ···, 3, 2, 1 if n1 n 2 n is even.1, 2, 3, ··· ( n-1) /2, ( n 1) /2, ( n-1) /2 ···, 3, 2, 1 if n is odd. The test statistic is T the sum of the ranks form Xpopulation.Use Table A.8 to find the rejection regions T W1-α/2 or T Wα/2 for σx σy T Wα for σx σy T W1-α for σx σy

Ansari-Bradley TestExample

Moses TestTest Equality of Two Standard Deviations5-Step5St PProcedured1. Set H0: σx σyHa: σx σyσx σyσx σy2. Select α3. Test statistic4. Find the rejection region5. Draw the conclusion

Moses TestTest Statistic Randomly group X1, X 2 , X3 , ··· X n1 into m1 small groups with kobservations in each group and discard the rest observations. Do thesame forf Y1, Y2 , Y3 , ··· Yn 2 withith m2 groups2 Compute g x ( X-X ) for each group for X and compute2Yg y ( Y-YY Y ) for each group for Y.T S m1 ( m1 1) The test statistic is2where S the sum of the ranks for gx s in a combined ranks for all gx sand gys.Use Table A.7 to find the rejection regions T Wα/2 or T W1-α/2 for σx σy T W1-α1 α for σx σy T Wα for σx σyW1-α m1 m2 - Wα

Moses TestExample 3.37 Page 133DataA: 9 11 9 13 10 8 7 12 11 9B: 12 11 13 11 11 15 15 14 15 11 14 14 13 13 9Computing Test Statistic ( X-X )91191381211 11.6395.637 13.63 ( Y-Y 1212345678

Example for Moses TestTestt EqualityTE lit off TwoT StandardSt d d DeviationsD i ti5-Step Procedure1 Set H0: σA σB1.Ha: σA σBσA σBσA σB2 α 0.052.0 053. Test statistic: T S m1 ( m1 1) 15 3 ( 3 1) 9224. Rejection region: T Wα/2 1 or T W1-α/2 14 from Table A.75. Conclusion: Do not reject H0: σA σB. There is noconvincingi i evidenceidto concludel d thath theh two formulasflwill result different standard deviations for the gravity

Chapter 4 Inference with Two Related SamplesCh4.1Sign Test for Two Related SamplesRelated Two Sample DataObservation123··· nVariable XX1, X2, X3, ··· XnVariable YY1, Y2,Y3, ··· Ynffor examplel one subjectbj two measurements likelik “beforeb fandd after”forone person with the height and weight.QQuestionUse an example to explain the difference of the two independentsamples and two related samples. How do you design your datacollection plan for the case.case Suppose you are studying the mileagedriven by male and by female, how do you collect your data if youhave case 1 with 40 identical cars, and case 2 with 40 different cars?Wh type test you wouldWhatld apply?l ?

Sign Test for Two Related Samples5-Step Procedure1. Set H0: ΜD 0Ha: ΜD 0ΜD 0ΜD 0where ΜD MX – MY the difference of the twopopulation medians2. Select α3. Test statisticjregiong4. Find the rejection5. Draw the conclusion

Sign Test for Two Related SamplesTest StatisticCompute all Xi -Yi s. Eliminate the case if Xi -Yi 0. The teststatistic k is the smaller number of positive Xi -Yi s or negative Xi -Yi s fortesting ΜD 0. the number of negative Xi -Yi s for testing ΜD 0. the number of positive Xi -Yi s for testing ΜD 0.Use Table A.1 or TI-83 to calculate the binomial probability for thep-value 2P(Κ k, p 0.5) for testing ΜD 0. P(Κ k, p 0.5) for testing ΜD 0 or ΜD 0.

Sign Test for Two Related SamplesExample

2-sample Wilcoxon Signed Rank Test5-Step Procedure1. Set H0: ΜD 0Ha: ΜD 0ΜD 0ΜD 0where ΜD MX – MY the difference of the twopopulation medians2. Select α3. Test statisticjregiong4. Find the rejection5. Draw the conclusion

2-sample Wilcoxon Signed Rank Test It is an analog of the 2-sample t-test (paireddata)) from a normally distributed population, as thet t t does.t-testdButB t WilcoxonWilt t assumes thetestth datad tcomes from a symmetric distribution. Wilcoxontest does not require the data to come If you cannot justify this assumption ofsymmetry, use theh nonparametrici 1-sample1l signitest, which does not assume a symmetricdistribution.distribution

2-sample Wilcoxon Signed Rank TestTest Statistic Calculate Di Xi - Yi , do not use the observation if Xi Yi and reduce n by 1. Rank Di . For same Di s the ranks are the average ofthe consecutive ranks of Di s as if they are not tied. Calculate T , the sum of the ranks with positive Dis andT , the sum of the ranks with negative The test statistic is smaller of T or T for Ha: ΜD 0;T for Ha: ΜD 0 and T for Ha: ΜD 0. Use formula T T n(n 1)/2.() Why?y

2-sample Wilcoxon Signed Rank Testp-valueUse Table A.3,A 3 see the following exampleexample.

2-sample Wilcoxon Signed Rank TestQuestionsp the signg test and the Wilcoxon test1. For two related samplesare actually the one sample test on the Di Xi - Yi s. Why?2. The two related sample test is testing H0: ΜD 0Ha : Μ D 0ΜD 0ΜD 0What if one wants to test whetherΜD 3ΜD 3ΜD 3ow shoulds ou d tthee hypothesisypot es s be set?How

100(1- α)% Confidence Interval for Two Related Samplesbased on Sign Test Calculate Di Xi - Yi , do not use the observation if Xi Yi andreduce n by 1. OrderO d ththe samplel D1, D2, ··· Dn as C1, C2, ··· Cn Determine k for the K Binomial(n, p 0.5) such thatP( K k ) α/2 and P( K k 1 ) α/2. α/2 Τhis will result two CIs(Ck, Cn-k 1) with the confidence level great than 100(1- α)%((Ck 1, Cn-k) with the confidence level less than 100(1( α)%.)Note that (Ck, Cn-k 1) actually is [Ck 1, Cn-k] because theavailable data for constructing the interval are discrete.

100(1- α)% Confidence Interval for Two Related Samplesbased on Sign Test If P( K k ) α/2 there is an exact 100(1- α)% CI. Most of thetime a decision has to be made either choose the narrower CI withtheh confidencefidlevell l lessl thanh 100(1100(1 α)%)% or a widerid CI withi h thehconfidence level great than 100(1- α)%.TI-8383 can be used Note table A.1, a binomial probability table or TIfor finding k such that P( K k ) α/2. The sample median gives a point estimation for the median.Examples

100(1- α)% Confidence Interval for Two Related Samplesbased on Wilcoxon Signed Rank Test Compute all possible µij (Di Dj)/2, where 1 i j n. There are n(n-1)/2 n these averages symmetrically distributed aboutth median.thedi Order the µijs as C1, C2, ··· Cm, where m n(n-1)/2 nUse Table AA.33 to determine T such that the corresponding P(T) α/2 and P( T 1 ) α/2. Τhis will result two CIs:(CT, Cm-T 1) with the confidence level great than 100(1- α)%(CT 1, Cm-T) with the confidence level less than 100(1- α)% If P(T) α/2 there is an exact 100(1- α)% CI. Most of the time ad i i hasdecisionh tot beb maded eitherith choosehtheth narrower CI withith thethconfidence level less than 100(1- α)% or a wider CI with theconfidence level great than 100(1- α)%. The median of µijs gives a point estimation for the populationmedian.

100(1- α)% Confidence Interval for Two Related Samplesbased on Wilcoxon SignedgRank TestExample 4.4 p159Exercise Ch4-9Ch4 9

100(1- α)% Confidence Interval for Two Related Samplesbased on Wilcoxon Signed Rank TestData �0.050.100 00 0‐0.45‐0.35‐0.25‐0.150.000.200.500 ‐0.20‐0.100.000.25MTB WInterval 99.0 'X‐Y'.Wilcoxon Signed Rank CI: X‐YConfidenceEEstimatedti t d AAchievedhi d IIntervaltlN Median Confidence Lower UpperX‐Y 15 ‐0.5099.0 ‐1.00 0.00MTB Let c18 'Ex4‐4E'‐C17MTB Walsh C18 c19.MTB Sort C19 c20;SUBC By C19.MTB print 8011.1516.70‐0.957.1011.3517.200.10 1.55 2.40 2.60 3.45 5.10 5.957.60 8.15 8.65 9.00 10.05 10.30 10.6511.50 12.00 12.55 13.40 13.85 14.70 16.2018.10 18.60 19.40 19.90 20.00 21.30 22.60MTB WInterval 95.0 C18.Wilcoxon Signed Rank CI: C18ConfidenceEstimated Achieved IntervalN Median Confidence Lower UpperC18 810.994.1 2.4 19.4MTB

Test Two Proportions for Two Related SamplesAbout the DataSuppose N subject are selected. Each subject is taught with method 1 to perform atask for using one hand and is taught with method 2 for using another hand. Theresultsl are summarizedi d as theh followingf ll iMethod 2Method 1ResultsYesNoTotalYesABA BNoCDC DT t lTotalA CB DNWhereA is the number of subjectsjcan performpthe task usingg both hands.B is the number of subjects can only perform the task taught by Method 1.C is the number of subjects can only perform the task taught by Method 2.D is the number of subjects can not perform the task taught by neither methods.

Test Two Proportions for Two Related SamplesLet P1 be the proportion of positive result taught by method 1 andlet P2 be the proportion of positive result taught by method 2.5 Step procedure1. Set H0: P1 P2Ha: P1 P2P1 P2P1 P22. Select α3. Test statistic4 Find4.Fi d theth rejectionj ti region/p-valuei /l5. Draw the conclusion

Test Two Proportions for Two Related SamplesTest Statistic is an approximation using standard normal distributionB CZ B CUse Table A.2 or TI-83 to find the rejection regions Z -Zα/2/ or Z Wα/2/ for P1 P2 Z Zα for P1 P2 Z -Zα for P1 P2Questions:Can we simply use Method 1 to teach left hand and use Method 2 toteach right hand and then test the hypothesis? Is that necessary toassign the methods to an individual randomly? Explain.What are the point estimations for P1 and P2 ?How to find the p-value for the hypothesis test?

Test Two Proportions for Two Related SamplesExample

1-sample Runs Test for Randomness What are runs? For example tossing a coin 10 times HHHHHHHHHH have just one run. H H H H H T T T T T havejusttworunshave just two runs . . . H T H T H T H T H T have ten runs. The test statistic r is the number of runs. The rejection regions are given in Table A.5 and A.6 for the rejection of two side test α 0.05