nonparametric statistical techniques

of 71 /71
1 Nonparametric Statistical Techniques Chapter 17

Author: wray

Post on 04-Jan-2016

42 views

Category:

Documents

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 Presentation

TRANSCRIPT

• 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 z-test, 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 (Xm17-02)

WILCOXON1

Wilcoxon Rank Sum Test

Rank sumObservations

New276.515

Aspirin188.515

z Stat1.83

P(Z

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

• Wilcoxon rank sum test for non-normal interval data, ExampleCan the personnel manager conclude at 5% significance level that a difference in duration of employment exists between business and non-business graduates? Retaining workers - continued

Sheet1

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 non-normal interval data, ExampleSolution The problem objective is to compare two populations of interval data.The samples are independent.The non-normality of the two populations is apparent from the sample histograms:

• Wilcoxon rank sum test for non-normal 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 non-normal 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 non-normal interval data, ExampleExcel solution (Workers.xls)

There is a strong evidence to infer that the duration of employment is different for business and non-business graduates

WILCOXON2

Wilcoxon Rank Sum Test

Rank SumObservations

Non-Bus57220

z Stat-2.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 matched-pair-differences.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 non-zero 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(1-p) > 5.The Z- statistic becomes

• The Sign Test ExampleExample 17.3 (Xm17-03)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

145-1

2211

3541

4321

5211

6532

713-2

8422

9422

...0

...1

...1

13211

1434-1

15211

16431

17211

18431

19541

20312

21422

22330

2334-1

24523

2523-1

&A

Page &P

• The Sign Test ExampleSolution We compare two populations The data are ordinal A matched pair experiment

Sheet1

RespondentEuropeanAmericanDifference

145-1

2211

3541

4321

5211

6532

713-2

8422

9422

...0

...1

...1

13211

1434-1

15211

16431

17211

18431

19541

20312

21422

22330

2334-1

24523

2523-1

&A

Page &P

Sheet1

RespondentEuropeanAmericanDifference

145-1

2211

3541

4321

5211

6532

713-2

8422

9422

1022.

11321

12431

13211

1434-1

15211

16431

17211

18431

19541

20312

21422

22330

2334-1

24523

2523-1

&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 = [x-np]/[np(1-p)].5 = [18-.5(23)]/[.5{23}.5] = 2.71The rejection region is z > za. For a = .05 we have z > 1.645. The p-value = P(Z > 2.71) = .0034

• The Sign Test ExampleUsing the computer: Tools > Data Analysis Plus > Sign TestExcel Solution (Xm17-03)

SIGNTEST2

Sign Test

DifferenceEuropean - American

Positive Differences18

Negative Differences5

Zero Differences2

z Stat2.71

P(Z

• The Sign Test ExampleConclusion: Since the p-value < 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 (Xm17-03)

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 Z-test.

• Wilcoxon Signed Rank Sum Test,ExampleExample 17.4Does flextime work-schedule 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 work-schedule 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:00-ArrFlextimeDifferenceABS(Diff.)Ranks

34344-114.5

51615114.5This data was sorted by the absolute value

83839-114.5of the differences.

121312114.5

161819-114.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

62628-2213

96163-2213

105254-2213

136971-2213

155355-2213

1825232213

2840382213

311921-2213

134313321

1168653321

1741383321

1917143321

223033-3321

244851-3321

2624213321

235314427

2144404427

252933-4427

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:00-ArrFlextimeDiffertenceABS(Diff.)Ranks

34344-114.5

51615114.5This data was sorted by the absolute value

83839-114.5of the differences.

121312114.5

161819-114.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

62628-2213

96163-2213

105254-2213

136971-2213

155355-2213

1825232213

2840382213

311921-2213

134313321

1168653321

1741383321

1917143321

223033-3321

244851-3321

2624213321

235314427

2144404427

252933-4427

2926224427

3242384427

768635531

1418135531

2026215531

Sheet2

Sheet3

• Wilcoxon Signed Rank Sum Test,ExampleExcel solution (Xm17-04)

Sheet1

8:00-ArrFlextime

3431

3531

4344

4644

1615

2628

6863

3839

6163

5254

6865

1312

6971

1813

5355

1819

4138

2523Wilcoxon Signed Rank Sum Test

1714

2621Difference8:00-Arr - Flextime

4440

3033T+367.5

1918T-160.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 Kruskal-Wallis 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.

• Kruskal-Wallis 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 chi-squared distributed with k-1 degrees of freedom.The rejection region: Since a large value of H justifies the rejection of H0, we have:

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

• The Kruskal-Wallis Test ExampleCan we conclude that customers perceive the speed of service to be different among the three shifts at 5% significance level?

Sheet1

4:00-midMid-8:008:00-4:00

433

441

323

422

331

343

334

332

224

331

&A

Page &P

• The Kruskal-Wallis 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 Kruskal-Wallis Test ExampleSolution - continuedTest statistic:

T1 = 186.5 T2 = 156.0 T3 = 122.5n = n1 + n2 + n3 = 10+10+10 = 30Ranking

Sheet1

4:00-midMid-8:008:00-4:00

433

441

323

422

331

343

334

332

224

331

&A

Page &P

• The Kruskal-Wallis Test ExampleFor a = .05, c2a,k-1 = c2.05,2 = 5.99147Solution - continuedThe critical value

• The Kruskal-Wallis Test ExampleSolution Excel (Xm17-05)

WALLIS1

Kruskal-Wallis Test

GroupRank SumObservations

4:00-mid186.510

Mid-8:0015610

8:00-4:00122.510

H Stat2.64

df2

p-value0.2665

chi-squared Critical5.9915

Sheet1

4:00-midMid-8:008:00-4:00

433

441

323

422

331

343

334

332

224

331

• The Kruskal-Wallis 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, 4-1 = 7.8147

• The Friedman Test ExampleSolution Excel (Xm17-06)

FRIEDMAN1

Friedman Test

GroupRank Sum

Manager121

Manager210

Manager324.5

Manager424.5

Fr Stat10.61

df3

p-value0.0140

chi-squared 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.