nonparametric statistical techniques
Embed Size (px)
DESCRIPTION
Nonparametric Statistical Techniques. Chapter 17. 17.1 Introduction. The statistical techniques introduced in this chapter deal with ordinal data. We test to determine whether the population locations differ.  PowerPoint PPT PresentationTRANSCRIPT

Nonparametric StatisticalTechniquesChapter 17

17.1 IntroductionThe statistical techniques introduced in this chapter deal with ordinal data.We test to determine whether the population locations differ. In testing the locations we will not refer to any parameter, thus the procedures name.

17.1 IntroductionWhen comparing two populations the hypotheses generally are:H0: The population locations are the sameH1: (i) The locations differ, or (ii) Population 1 is located to the right (left) of population 2 The random variable X1 is generally larger (smaller) than X2.

17.2 Wilcoxon Rank Sum TestThe problem characteristics of this test are:The problem objective is to compare two populations.The data are either ordinal or interval (but not normal).The samples are independent.

Wilcoxon Rank Sum Test ExampleExample 17.1Based on the two samples shown below, can we infer at 5% significance level that the location of population 1 is to the left of the location of population 2? Sample 1: 22, 23, 20; Sample 2: 18, 27, 26; The hypotheses are: H0: The two population locations are the same.H1: The location of population 1 is to the left of the location of population 2.

Graphical DemonstrationWhy use the sum of ranks to test locations? If the locations of the two populations are about the same, (the null hypothesis is true)we would expect the ranks to be evenly spread between the samples.In this case the sum of ranks for the two samples will be close to one another.Two hypothetical populations and their corresponding samples are presented, the GREEN population and the PURPLE population.PopulationsLet us rank the observations of the two samples together

Graphical DemonstrationWhy use the sum of ranks to test locations? Allow the GREEN population to shift to the left of the PURPLE population.

Graphical DemonstrationWhy use the sum of ranks to test locations? The green sample is expected to shift to the left too.As a result, several observations exchange location.What happens to the sum of ranks? Click.

Graphical DemonstrationWhy use the sum of ranks to test locations? 671345810111292The green sum decreases , and the purple sum increases.Changing the relative location of two populations affect the sum of ranks of the two samples combined.

Wilcoxon Rank Sum Test ExampleExample 17.1 continuedTest statistic 1. Rank all the six observations (1 for the smallest). 3. Let T = 9 be the test statistic (We arbitrarily define the test statistic as the rank sum of sample 1.

Wilcoxon Rank Sum Test RationaleExample 17.1  continuedIf T is sufficiently small then most of the smaller observations are located in population 1. Reject the null hypothesis.Question: How small is sufficiently small?We need to look at the distribution of T.

1,2,36 7 8 9 10 11 12 13 14 151,2,41,2,51,2,61,3,41,3,61,3,51,4,51,4,61,5,62,3,42,3,52,3,62,4,52,4,62,5,63,4,53,4,63,5,64,5,6T.05.10.15T is the rank sum of a sample of size 3.This sample received the ranks 3, 4, 5If H0 is true (the two populations have the same location), each ranking is equally likely, and each possible value of T has the same probability = 1/20This sample received the ranks 1, 2, 3The distribution of T under H0 for two samples of size 3

The distribution of T under H0 for two samples of size 31,2,36 7 8 9 10 11 12 13 14 151,2,41,2,51,2,61,3,41,3,61,3,51,4,51,4,61,5,62,3,42,3,52,3,62,4,52,4,62,5,63,4,53,4,63,5,64,5,6T.05.10.15 The significance level is 5%,and under H0 P(T 6) = .05.Thus, the critical value of T is 6.

Wilcoxon Rank Sum Test ExampleExample 17.1  continuedConclusionH0 is rejected if T6. Since T = 9, there is insufficient evidence to conclude that population 1 is located to the left of population 2, at the 5% significance level.

Critical values of the Wilcoxon Rank Sum Testa = .025 for two tail test, or a = .05 for one tail testUsing the table: For given two samples of sizes n1 and n2, P(TTU)= a.For a two tail test: P(T25) = .025 if n1=4 and n2=4.For a one tail test: P(T25) = .05 if n1=4 and n2=4.11 25A similar table exists for a = .05 (one tail test) and a = .10 (two tail test)TL TU TL TU TL TU TL TU
Sheet1
n2n1
345...10
46 1811 2517 33...61 89
56 2112 2818 37...64 96
.
.
.
109 3316 4424 56...79 131

Wilcoxon rank sum test for samples where n > 10The test statistic is approximately normally distributed with the following parameters: Therefore,
Z =T  E(T)sT

Wilcoxon rank sum test for samples where n > 10, ExampleA pharmaceutical company is planning to introduce a new painkiller.To determine the effectiveness of the drug, 30 people were randomly selected.15 were given the tested drug (Sample 1).15 were given aspirin (Sample 2).Each participant was asked to indicate which one of five statements best represented the effectiveness of the drug they took. Example 17.2 (using Wilcoxon rank sum test with ordinal data)

Wilcoxon test for samples where n > 10, ExampleExample 17.2 continuedSummary of the experiment results.SolutionThe objective is to compare two populations of ordinal data.The two samples are independent.Wilcoxon rank test is the appropriate technique to apply.
Sheet1
The drug taken wasPainkillerAspirin
extremely effective (5)61
quite effective (4)35
somewhat effective (3)43
slightly effective (2)14
not at all effective (1)12

Wilcoxon rank sum test for samples where n > 10, ExampleThe hypothesesH0: The locations of population 1 and 2 are the sameH1: The location of population 1 is to the right of the location of population 2.Received the new painkillerReceived AspirinSolving by handTo reject the null hypothesis, we need to show that z is large enough.First we rank the observations, Secondly, we run a ztest, with rejection region of Z > Za.

Wilcoxon rank sum test for samples where n > 10, ExampleRanking the raw dataThere are three observationswith an effectiveness score of 1.The original ranks for these observations are 1, 2 , and 3.This tie is broken by giving eachobservation the average rank of 2.Sum of ranks:T1=276.5T2=188.5
Sheet1
PainkillerRankAspirinRank
1212
2612
31226
31226
31226
31226
419.5312
419.5312
419.5312
527419.5
527419.5
527419.5
527419.5
527419.5
527527
&A
Page &P

Wilcoxon rank sum test for samples where n > 10, ExampleTo standardize the test statistic we need:E(T) = n1(n1+n2+1)/2= (15)(31)/2=232.5

Wilcoxon rank sum test for samples where n > 10, ExampleFor 5% significance level z=1.645.Since z = 1.83 > 1.645, there is sufficient evidence to reject the null hypothesis in favor of the alternative hypothesis.At 5% significance level, the new drugs is perceived as more effective than Aspirin.

Wilcoxon rank sum test for samples where n > 10, ExampleExcel solution (Xm1702)
WILCOXON1
Wilcoxon Rank Sum Test
Rank sumObservations
New276.515
Aspirin188.515
z Stat1.83
P(Z

Wilcoxon rank sum test for nonnormal interval data, ExampleThe human resource manager of a large company wanted to compare how long business and nonbusiness graduates worked for the company before quitting.Two samples of 25 business graduates and 20 nonbusiness graduates were randomly selected.The data representing their time with the company were recorded. Retaining Workers

Wilcoxon rank sum test for nonnormal interval data, ExampleCan the personnel manager conclude at 5% significance level that a difference in duration of employment exists between business and nonbusiness graduates? Retaining workers  continued
Sheet1
BusinessNonBus
6025
1160
1822
1924
523
2536
..
..
..
1716
3728
49
860
2829
2716
1122
6060
2517
560
1332
22
11
17
9
4
&A
Page &P

Wilcoxon rank sum test for nonnormal interval data, ExampleSolution The problem objective is to compare two populations of interval data.The samples are independent.The nonnormality of the two populations is apparent from the sample histograms:

Wilcoxon rank sum test for nonnormal interval data, Example Solution continuedThe Wilcoxon rank test is the correct procedure to run.H0: The two population locations are the sameH1: The location of population 1(business graduates) is different from the location of population 2 (non business graduates).

Wilcoxon rank sum test for nonnormal interval data, ExampleSolution continuedSolving by hand The rejection region is After the ranking process is completed, we have: T = Tbusiness graduates = 463. E(T) = n1(n1+n2+1)/2=575; sT=[n1n2(n1+n2+1)/12]1/2=43.8

Wilcoxon rank sum test for nonnormal interval data, ExampleExcel solution (Workers.xls)
There is a strong evidence to infer that the duration of employment is different for business and nonbusiness graduates
WILCOXON2
Wilcoxon Rank Sum Test
Rank SumObservations
Business46325
NonBus57220
z Stat2.56
P(Z

Required conditions for nonparametric testsA rejection of the null hypothesis when performing a nonparametric test can occur due to:different locationdifferent spread (variance)different shape (distribution).Since we are interested in the location, we require that the two distributions are identical, except for location.

17.3 Sign Test and Wilcoxon Signed Rank Sum TestTwo techniques for matched pairs experiment are introduced. the objective is to compare two populations.the data are either ordinal or interval (but not normal).The samples are matched by pairs.

The Sign TestThis test is employed when:The problem objective is to compare two populations, andThe data are ordinal, andThe experimental design is matched pairs.The hypotheses H0: The two population locations are the same H1: The two population locations differ or population 1 is right (left) of population 2

The Sign Test Statistic and Sampling DistributionA matched pair experiment calls for a test of matched pair differences. The test statistic and sampling distributionRecord the sign of all the matchedpairdifferences.The number of positive (or negative) differences is the test statistic.

The Sign Test  RationaleThe number of positive or negative differences is binomial, with:n = the number of nonzero differencesp = the probability that a difference is positive (negative) If the two populations have the same locations (H0 is true), it is expected that
Thus, under H0: p = 0.5Number of positive differences = Number of negative differences

The Sign Test  RationaleThe test statistic and sampling distributionThe hypotheses:H0: The two population locations are the sameH1: The two population locations are different
H0: p = .5H1: p .5

The Sign Test Statistic and Sampling DistributionThe Test continuedThe hypotheses testedH0: p = .5H1: p .5The binomial variable can be approximated by a normal variable if np and n(1p) > 5.The Z statistic becomes

The Sign Test ExampleExample 17.3 (Xm1703)In an experiment to determine which car is perceived to have the more comfortable ride, 25 people took two rides:One ride in a European model.One ride in a North American car.Each person ranked the cars on a scale of 1 (ride is very uncomfortable) to 5 (ride is very comfortable).

The Sign Test ExampleDo these data allow us to conclude at 5% significance level that the European car is perceived to be more comfortable?
Sheet1
RespondentEuropeanAmericanDifference
1451
2211
3541
4321
5211
6532
7132
8422
9422
...0
...1
...1
13211
14341
15211
16431
17211
18431
19541
20312
21422
22330
23341
24523
25231
&A
Page &P

The Sign Test ExampleSolution We compare two populations The data are ordinal A matched pair experiment
Sheet1
RespondentEuropeanAmericanDifference
1451
2211
3541
4321
5211
6532
7132
8422
9422
...0
...1
...1
13211
14341
15211
16431
17211
18431
19541
20312
21422
22330
23341
24523
25231
&A
Page &P
Sheet1
RespondentEuropeanAmericanDifference
1451
2211
3541
4321
5211
6532
7132
8422
9422
1022.
11321
12431
13211
14341
15211
16431
17211
18431
19541
20312
21422
22330
23341
24523
25231
&A
Page &P

The Sign Test ExampleSolutionThe hypotheses are:
H0: The two population location are the same. H1: The European car population is located to the right of the American car population.The test.There were 18 positive, 5 negatives, and 2 zero differences. Thus, X = 18, n = 23(!).Z = [xnp]/[np(1p)].5 = [18.5(23)]/[.5{23}.5] = 2.71The rejection region is z > za. For a = .05 we have z > 1.645. The pvalue = P(Z > 2.71) = .0034

The Sign Test ExampleUsing the computer: Tools > Data Analysis Plus > Sign TestExcel Solution (Xm1703)
SIGNTEST2
Sign Test
DifferenceEuropean  American
Positive Differences18
Negative Differences5
Zero Differences2
z Stat2.71
P(Z

The Sign Test ExampleConclusion: Since the pvalue < a we reject the null hypothesis.At 5% significance level there is sufficient evidence to infer that the European car is perceived as more comfortable than the American car.

The Sign Test ExampleChecking the required conditionsObserve the sample histograms (Xm1703)
The populations are similar in shape and spread
Chart1
1
7
6
7
4
0
Euro
European cars
Sheet1
EuropeanAmericanBin
451
212
543
324
215
53
13BinEuro
4211
4227
2236
3247
4354
21More0
34
21BinFrequency
4316
2127
4337
5444
3151
42More0
33
34
52
23
Sheet1
0
0
0
0
0
0
Frequency
American cars
0
0
0
0
0
0
Euro
European cars
Chart2
6
7
7
4
1
0
Frequency
American cars
Sheet1
EuropeanAmericanBin
451
212
543
324
215
53
13BinEuro
4211
4227
2236
3247
4354
21More0
34
21BinFrequency
4316
2127
4337
5444
3151
42More0
33
34
52
23
Sheet1
Frequency
American cars
Euro
European cars

Wilcoxon Signed Rank Sum TestThis test is used whenthe problem objective is to compare two populations,the data are interval but not normal,the samples are matched pairs.The test statistic and sampling distributionT is based on rank sum of the absolute values of the positive and negative differencesWhen n TU or T 30, T is approximately normally distributed. Use a Ztest.

Wilcoxon Signed Rank Sum Test,ExampleExample 17.4Does flextime workschedule help reduce the travel time of workers to work?A random sample of 32 workers was selected, and workers recorded their travel time before and after the program was implemented.The hypotheses test areThe two population locations are the same.The two population locations are different.

Wilcoxon Signed Rank Sum Test, ExampleExample 17.4Does flextime workschedule help reduce the travel time of workers to work?A random sample of 32 workers was selected, and workers recorded their travel time before and after the program was implemented.The hypotheses areH0: The two population locations are the same.H1: The two population locations are different.The rejection region:z > za/2

This data were sorted by the absolute valueof the differences.12345678Ties were broken by assigning the average rank to the tied observations
Sheet1
Worker8:00ArrFlextimeDifferenceABS(Diff.)Ranks
34344114.5
51615114.5This data was sorted by the absolute value
83839114.5of the differences.
121312114.5
161819114.5The ties were broken by assigning the average
231918114.5of all the ranks that belong to a certain tie, to
275150114.5all the tie members.
302019114.5
446442213
626282213
961632213
1052542213
1369712213
1553552213
1825232213
2840382213
3119212213
134313321
1168653321
1741383321
1917143321
2230333321
2448513321
2624213321
235314427
2144404427
2529334427
2926224427
3242384427
768635531
1418135531
2026215531
Sheet2
Sheet3

T is the rank sum of the positive differences. T = T+ = 367.5E(T) = n(n+1)/4 = 32(33)/4 = 264 sT = [n(n+1)(2n+1)/24].5 = 53.48The test statistic is:
Z =
T= 1.94367.5 
Sheet1
Worker8:00ArrFlextimeDiffertenceABS(Diff.)Ranks
34344114.5
51615114.5This data was sorted by the absolute value
83839114.5of the differences.
121312114.5
161819114.5The ties were broken by assigning the average
231918114.5of all the ranks that belong to a certain tie, to
275150114.5all the tie members.
302019114.5
446442213
626282213
961632213
1052542213
1369712213
1553552213
1825232213
2840382213
3119212213
134313321
1168653321
1741383321
1917143321
2230333321
2448513321
2624213321
235314427
2144404427
2529334427
2926224427
3242384427
768635531
1418135531
2026215531
Sheet2
Sheet3

Wilcoxon Signed Rank Sum Test,ExampleExcel solution (Xm1704)
Sheet1
8:00ArrFlextime
3431
3531
4344
4644
1615
2628
6863
3839
6163
5254
6865
1312
6971
1813
5355
1819
4138
2523Wilcoxon Signed Rank Sum Test
1714
2621Difference8:00Arr  Flextime
4440
3033T+367.5
1918T160.5
4851Observations (for test)32
2933z Stat1.94
2421P(Z

Wilcoxon Signed Rank Sum Test,ExampleSolution continued The rejection region for a = .05 is z > z.025 = 1.96Conclusion: Since 1.94 < 1.96, There is insufficient evidence to infer that the flextime program was effective at 5% significance level.

17.4 KruskalWallis TestThe problem characteristics for this test are:The problem objective is to compare two or more populations.The data are either ordinal or interval but not normal. The samples are independent.The hypotheses areH0: The location of all the k populations are the same.H1: At least two population locations differ.

KruskalWallis Test StatisticRank the data from 1(smallest) to n (largest).Calculate the rank sums T1, T2,Tk for all the k samples.Calculate the statistic H as follows:

Test Rationale and Rejection regionIf all the populations have the same location (H0 is true)The ranks should be evenly distributed among the k samples. The statistic H will be small.

Test Rationale and Rejection RegionSampling distributionWhen the sample sizes 5, H is approximately chisquared distributed with k1 degrees of freedom.The rejection region: Since a large value of H justifies the rejection of H0, we have:

The KruskalWallis Test ExampleExample 17.5How do customers rate three shifts with respect to speed of service in a certain restaurant?Three samples of 10 customer responsecards were randomly selected, one sample from each shift.Customer ratings were recorded.

The KruskalWallis Test ExampleCan we conclude that customers perceive the speed of service to be different among the three shifts at 5% significance level?
Sheet1
4:00midMid8:008:004:00
433
441
323
422
331
343
334
332
224
331
&A
Page &P

The KruskalWallis Test ExampleSolutionThe problem objective is to compare three populations.The data are ordinal.The hypotheses:H0: The locations of all three populations are the same.H1: At least two population locations differ.

The KruskalWallis Test ExampleSolution  continuedTest statistic:
T1 = 186.5 T2 = 156.0 T3 = 122.5n = n1 + n2 + n3 = 10+10+10 = 30Ranking
Sheet1
4:00midMid8:008:004:00
433
441
323
422
331
343
334
332
224
331
&A
Page &P

The KruskalWallis Test ExampleFor a = .05, c2a,k1 = c2.05,2 = 5.99147Solution  continuedThe critical value

The KruskalWallis Test ExampleSolution Excel (Xm1705)
WALLIS1
KruskalWallis Test
GroupRank SumObservations
4:00mid186.510
Mid8:0015610
8:004:00122.510
H Stat2.64
df2
pvalue0.2665
chisquared Critical5.9915
Sheet1
4:00midMid8:008:004:00
433
441
323
422
331
343
334
332
224
331

The KruskalWallis Test ExampleConclusion: Since H=2.64 < 5.99147, do not reject the null hypothesis. There is insufficient evidence to conclude at 5% significance level, that there is a difference in customers perception regarding service speed among the three shifts.

17.5 Friedman TestThe problem characteristics of this test are:The problem objective is to compare two or more populations.The data are either ordinal or interval but not normal. (For normal populations we use ANOVA).The data are generated from a blocked experiment (samples are not independent).The hypotheses areThe location of all the k populations are the same.At least two population locations differ.

Test Statistic and Rejection RegionThe test statistic is
The rejection region is b = the number of blocksK = the number of treatments

The Friedman Test ExampleExample 17.6Four managers evaluate applicants for a job in an accounting firm on several dimensions.Eight applicants were randomly selected, and their evaluations by the four managers recorded.Can we conclude at 5% significance level thatthere are differences inthe way managersevaluate candidates?
Sheet1
Manager
Applicant1234
12122
24232
32223
43132
53235
62234
74155
83253
&A
Page &P

The Friedman Test ExampleSolutionThe problem objective is to compare four populationsData are ordinal.This is a randomized block design experiment because each applicant (block) was ranked four times.The appropriate procedure is the Friedman test

The Friedman Test ExampleSolutionThe hypotheses areH0: The locations of all four populations are the same.H1: At least two population locations differ.The data
Sheet1
Manager
Applicant1234
12122
24232
32223
43132
53235
62234
74155
83253
&A
Page &P

The Friedman Test ExampleT1 = 21 T2 = 10 T3 = 24.5 T4 = 24.53423.52.51.522.511.5211.51113323.52.533.5431.542443.52.5How to rank, block by block.
Applicant 1:Scores: 2 1 2 2Actual ranks: 2 1 3 4Averaged ranks: 3 1 3 3
Sheet1
Manager
Applicant1234
12122
24232
32223
43132
53235
62234
74155
83253
&A
Page &P

The Friedman Test ExampleSolutionIn our problem:b = 8 (number of blocks) k = 4 (number of treatments, populations)

The Friedman Test ExampleSolutionWe have : Fr = 10.61; Let a = .05, then c2.05, 41 = 7.8147

The Friedman Test ExampleSolution Excel (Xm1706)
FRIEDMAN1
Friedman Test
GroupRank Sum
Manager121
Manager210
Manager324.5
Manager424.5
Fr Stat10.61
df3
pvalue0.0140
chisquared Critical7.8147
Sheet1
Manager1Manager2Manager3Manager4
2122
4232
2223
3132
3235
2234
4155
3253

The Friedman Test ExampleConclusion: Since Fr =10.61> 7.8147, reject the null hypothesis. There is sufficient evidence to conclude at 5% significance level, that the managers evaluations differ.