Download pptx - Nonparametric Statistics

Transcript
Page 1: Nonparametric Statistics

Nonparametric Statistics

Page 2: Nonparametric Statistics

บทนำ�• ในบทนเร�กล�วถงเทคนคท�งสถตเมอขอมลเปน

แบบจดอนดบ (Rank Data) ซงขอมลเชนนไม ส�ม�รถใหค�เฉลย (Mean) เปนตวแทนขอมลได

ดงนนกรณทลกษณะของกลมประช�กรทไมมParameter (Non parametric) โดยทดสอบว�กลม

ประช�กร 2 กลมอยในตำ�แหนงทแตกต�งกนหรอ ไม เพอแทนทก�รทดสอบว�ค�เฉลยของกลม

ประช�กรทงสองกลมแตกต�งกนหรอไม

Page 3: Nonparametric Statistics

• วธ Nonparametric ส�ม�รถใชแทนวธparametric ในขอมลเชงปรม�ณกได กรณทประช�กรมก�รกระจ�ยแบบไมปกต

• In nonparametric tests we hypothesize on the population locations (not necessarily their means).

Two populations - same location Two populations - different locations

Page 4: Nonparametric Statistics

ก�รตงสมมตฐ�นH0 : ประช�กรทงสองกลมอยในพนทเดยวกนH1 : พนทประช�กรกลมท 1 แตกต�งจ�กประช�กร

กลมท 2H1 : พนทประช�กรกลมท 1 อยท�งขว�ของ

ประช�กรกลมท 2H1: พนทประช�กรกลมท 1 อยท�งซ�ยของ

ประช�กรกลมท 2

Page 5: Nonparametric Statistics

16.2 Wilcoxon Rank Sum Test for Independent Samples

• คณลกษณะของปญห�จะเกยวของกบสงต�งๆตอไปน– วตถประสงคของปญห�ใชเพอก�รเปรยบเทยบประช�กรสองกลม– เปนขอมลแบบจดอนดบ หรอขอมลเชงปรม�ณทมก�รกระจ�ยแบบไมปกต–กลมตวอย�งเปนอสระตอกน

Page 6: Nonparametric Statistics

• ตวอย�งท 1

– จ�กตวอย�งทแสดงข�งล�ง ทระดบนยสำ�คญ 5% กลม ประช�กรกลมท 1 จะอยท�งซ�ยของกลมประช�กรกลม

ท 2 ใชหรอไม– Sample 1: 22, 23, 20; Sample 2: 18, 27, 26;– สมมตฐ�นคอ:

H0: The two population locations are the same.H1: The location of population 1 is to the left of the

location of population 2.

Page 7: Nonparametric Statistics

วธก�รทดสอบSample1 Rank Sample2 Rank

222320

342

182726

165

T1 = 9 T2 = 12

ขนท1 จดอนอบตวเลขทงหก เลขทมค�นอยทสดใหเปน อนดบหนง ม�กทสดใหเปนอนดบสดท�ย

กรณทตวเลขซำ�กนใหจดอนดบโดยใชวธค�เฉลย เชน18,20,20,25 อนดบคอ 1, 2.5, 2.5, 4 ต�มลำ�ดบ

Page 8: Nonparametric Statistics

• ขนท 2 คำ�นวณผลรวมของอนดบในแตละตวอย�ง ในกลมท 1 (T1) ผลรวมเท�กบ 9 และกลมท 2(T2)

ผลรวมเท�กบ 12 (ทงนผลรวมในทงสองกลม ตองเท�กบค�ผลรวมของอนดบทงหก

T1+T2=21)• สรปกลมท 1 มผลรวมนอยกว�กลมท 2 แตท

ระดบนยสำ�คญ 0.05 ไมอ�จสรปไดว� กลมท 1 นอยกว�กลมท 2

• ทเปนเชนนเพร�ะค�คว�มน�จะเปนท T1< 9 เท�กบ7/20 (0.35 หรอ 35%) ขณะท P(T< 6) = 0.05 ดง

นนถ�สมมตฐ�นเบองตนถกตงไวทนยสำ�คญ 5%

Page 9: Nonparametric Statistics

– If the two populations have the same location (the null hypothesis is true), the value of the statistic T should not be too small.

– If the T value is small, the null hypothesis should be rejected in favor of the alternative hypothesis.

– Since P(T<6) = .05, and T = 9, there is insufficient evidence to argue that population 1 is located to the left of population 2, at 5% significance level.

Page 10: Nonparametric Statistics

1,2,3

6 7 8 9 10 11 12 13 14 15

1,2,4 1,2,5 1,2,6

1,3,4

1,3,6

1,3,5 1,4,5

1,4,6 1,5,6

2,3,4 2,3,5

2,3,6

2,4,5

2,4,6

2,5,6

3,4,5

3,4,6

3,5,6 4,5,6

T

.05

.10

.15

The distribution of T

These are the possible ranks allocated to the observations of one sample of size 3, when two samples of size 3 are drawn.

P(T <= 6) = .05T is the rank sum of a sample of size 3.

Page 11: Nonparametric Statistics

• Wilcoxon rank sum test for sample sizes > 10– The test statistic is approximately normally distributed

with the following parameters:

n1(n1 + n2 + 1) 2

E(T) =

12)1nn(nn 2121

T

Therefore,

Z =T - E(T)T

Page 12: Nonparametric Statistics

• Example 2 (using Wilcoxon rank sum test with ranked data)

– บรษทย�แหงหนงมแผนทจะนำ�เสนอย�แกปวดตวใหม(Pain killer)

– เพอทดสอบประสทธผลของย�ดงกล�ว บรษทผผลต จงไดทดลองสมเลอกกลมคนทมอ�ก�รปวดม�จำ�นวน

30 คน โดยกำ�หนดให• ม 15 คนรบย�ชนดใหมน• อก 15 คนใหรบย� aspirin

– ผเข�รวมก�รทดสอบแตละคนจะตองระบว� วลตวเลอกใดเปนตวแทนของประสทธผลของย�แตละตวไดดทสด

Page 13: Nonparametric Statistics

– ขอสรปทแสดงผลลพธของก�รทดลองดวยย�ทงสอง

The drug taken was… Painkiller Aspirinextremely effective (5) 5 1quite effective (4) 3 5somewhat effective (3) 4 3slightly effective (2) 1 4not at all effective (1) 1 2

• Solution– วตถประสงคเพอเปรยบเทยบประช�กรสองกลมทมขอมลแบบเรยงลำ�ดบ

– ตวอย�งทงสองเปนอสระตอกน– ลกษณะนเหม�ะทจะใช Wilcoxon rank sum

test

Page 14: Nonparametric Statistics

– The hypothesesH0: ขอบเขตพนทของกลมประช�กร 1 และ 2 เหมอนกนH1: ขอบเขตพนทของกลมท 1 อยท�งขว�มอของกลมท 2

– Solving by hand• To reject the null hypothesis, we need to show that

z is “large enough”.• First we rank the observations, then we run a z-test,

with rejection region of Z > Za.

Page 15: Nonparametric Statistics

– Ranking the raw data

Painkiller Rank Aspirin Rank1 2 1 22 6 1 23 12 2 63 12 2 63 12 2 63 12 2 64 19.5 3 124 19.5 3 124 19.5 3 125 27 4 19.55 27 4 19.55 27 4 19.55 27 4 19.55 27 4 19.5

มขอมลจำ�นวน 3 ตวทม ค�เท�กบ 1 ดงนนอนดบ

ของทงส�มซงควรจะเปน อนดบ 1,2,3แตเมอมค�

เท�กนจงตองห�ค�เฉลยจงมค�

เท�กบ 2 (rank =2)

Sum of ranks: T1=276.5 T2=188.5

To standardize the test statistic we need:

E(T) = n1(n1+n2+1)/2= (15)(31)/2=232.5

1.2412

)1nn(nn 2121T

83.1)T(ET

zT

ทระดบค�นยสำ�คญ0.05( 5% ) z=1.645.ดงนนจงมหลกฐ�นเพยงพอตอก�รปฏเสธสมมตฐ�นหลกและเลอกสมมตฐ�นท�งเลอก

ท 5% significance level,

ย�ชนดใหมจงมประสทธภ�พดกว�

ย�แอสไพรน

ตวเลขทไดหม�ยถงค�ระดบคว�มพง พอใจในประสทธผลของย� ซงเปนชอมล

ทไดจ�กก�รก�รทดสอบผลก�รใชย�จ�กกลมตวอย�งแตละคน

Page 16: Nonparametric Statistics
Page 17: Nonparametric Statistics
Page 18: Nonparametric Statistics
Page 19: Nonparametric Statistics

P-value< 0.05 ปฏเสธสมมตฐ�น H0

Page 20: Nonparametric Statistics

• Example 3 (Using Wilcoxon rank sum test with quantitative data)

– ผจดก�รฝ�ยบคคลของบรษทแหงหนงตองก�รเปรยบ เทยบระยะเวล�ก�รทำ�ง�น (กอนทจะล�ออก) ของพนกง�น

ทจบก�รศกษ�ด�นบรห�รธรกจ กบทไมจบบรห�รธรกจ– ตวอย�งททำ�ก�รจดเกบแบงเปนสองกลม กลมทหนงเปน

พนกง�นทจบบรห�รธรกจ 25 คน และกลมทสองคอจบส� ข�อนๆอก 20 คน

– ขอมลคอเวล�ทอยกบบรษทถกจดบนทกไวใน XM16-03

Page 21: Nonparametric Statistics

Business Non-Bus60 2511 6018 2219 245 2325 36. .. .. .

ทนยสำ�คญ 0.05 จะสรปไดหรอไมว�มคว�มแตกต�งด�นเวล�ก�รทำ�ง�นระหว�งพนกง�นทจบบรห�รฯกบพนกง�นทจบในส�ข�อนๆ

02468101214

5 20 35 50 65 More0

2

4

6

8

10

15 25 35 45 55 65 More

• Solution – The problem objective is to compare two

populations of quantitative data.– The samples are independent.– Checking the population samples, we can

observe the nonnormality of the variables Non Business graduates Business graduates

Page 22: Nonparametric Statistics

1

2

3

Page 23: Nonparametric Statistics

ผลลพธ

• P-value = 0.0105 < 0.05• ปฏเสธ Null hypothesis• ดงนนพนกง�นทจบบรห�รฯ กบจบจ�กคณะอนมผลตอระยะเวล�ก�รทำ�ง�นใน

องคกรน อย�งไรกดผลลพธทไดไมอ�จบงบอกขอสรปว�เปนเพร�ะเหตใด

Page 24: Nonparametric Statistics

• 2.1 The Sign Test

– This test is employed in the following situations.• The problem objective is to compare two populations.• The data are ranked.• The experimental design is matched pairs.

– Test statistic.• We record the sign of all the matched-pair-differences.• The number of positive signs is the test statistic.• The number of positive signs is binomially distributed.

Page 25: Nonparametric Statistics

2. Sign Test and Wilcoxon Signed Rank Sum Test for Matched Pairs

• เทคนคทนำ�เสนอไปกอนหน�คอก�รเปรยบเทยบ ระหว�งกลมประช�กรสองกลม ทเปนอสระตอกน

สำ�หรบเครองมอทจะนำ�เสนอตอไปนจะเปนก�รทดสอบสมมตฐ�นเปรยบเทยบระหว�งกลมประช�กรสองกลม

ไมเปนอสระตอกน โดยจะมคณลกษณะดงน– มวตถประสงคเพอเปรยบเทยบกลมประช�กรสองกลม– ขอมลตองเปนแบบ Rank หรอ เปนขอมลเชงปรม�ณทม

ก�รกระจ�ยแบบไมปกตเท�นน– ตวอย�งจะมคว�มเกยวของกนระหว�งกลมประช�กรสอง

กลมในลกษณะของก�รจบคกน (Matched Pairs)

Page 26: Nonparametric Statistics

Example 4

– ในก�รทดสอบว�ระหว�งรถยนตยโรป กบรถอเมรก� แบบไหน สะดวกสบ�ยม�กกว�กน โดยใชผทดสอบจำ�นวน 25 คนม�

ทดสอบรถทผลตจ�กทงสองทวป– ภ�ยหลงก�รทดสอบแตละคนตองใหคะแนนเปนระดบคว�มพง

พอใจในรถทงสองรนทตนไดทดสอบ โดยมระดบคว�มพง พอใจตงแต 1 (ride is very uncomfortable) ถง 5 (ride is

very comfortable).– Notice: The data are ranked.– สงทผทดสอบอย�กทร�บคอ รถยโรปสะดวกสบ�ยกว�รถ

อเมรก� จรงหรอไม– XM16-04

Page 27: Nonparametric Statistics

The results were:

Respondent European American1 4 52 2 13 5 44 3 25 2 16 5 37 1 38 4 29 4 2

10 2 211 3 212 4 3

Difference-111112-222011

Do these data allow us to conclude at 5% significance level that the European car is perceived to be more comfortable?

SolutionThe hypotheses are:H0: The two population locations are the same.H1: The European cars population is located to the right of the American car population

Not all the dataare shown.

There were 18 positives, 5 negatives, and 2 zeros.X = 18, n = 23.Z = [x-np]/[np(1-p)].5 = [18-.5(23)]/[.5[23}.5] =2.71

02468101214

-2 -1 0 1 2 More

Normal?

The rejection region is z > za

With a = .05 z.05 = 1.645.

Conclusion: Reject the null hypothesis.There is sufficient evidence to infer thatthe European car is perceived as more comfortable than the American car.

Page 28: Nonparametric Statistics
Page 29: Nonparametric Statistics

A B4 52 15 43 22 15 31 34 24 22 23 2. .. .

A-B-1 Positive Differences = 181 Negative Differences = 51 Zero Differences = 21 P-Value = 0.005312-222

Sign Test

Using the computer: Tools > Data Analysis Plus > Sign Test

สรป จากการทดสอบความพงพอใจของผขบ พบวา รถยโรปสะดวกสบายกวารถอเมรกา

จรง

Page 30: Nonparametric Statistics

• เทคนคนจะถกใชเมอ– วตถประสงคเพอเปรยบเทยบกลมประช�กรสองกลม– ขอมลเปนขอมลเชงปรม�ณทมก�รกระจ�ยแบบไมปกต– ตวอย�งเปนแบบ matched pairs.

• The test statistic– Build a T statistic based on the sum of differences

between paired observations. • When n <=30, reject H0 if T>TU or T<TL.• When n > 30, T is approximately normally distributed.

Use a Z-test.

2.2 Wilcoxon Signed Rank Sum Test for Matched Pairs

Page 31: Nonparametric Statistics

• Example 5– เพอทดลองแกปญห�ลดเวล�ก�รเดนท�งม�ทำ�ง�นของพนกง�น

บรษทไดทดลองใชนโยบ�ย flextime โดยใหพนกง�นเลอกเวล�ม�ทำ�ง�นไดเอง(หลกเลยงชวงเวล�ลดตด) ก�รทดสอบไดเลอกทดลอง

ใชนโยบ�ยนในวนพธ โดยใหพนกง�นจำ�นวน 32 คนเดนท�งม� ทำ�ง�นต�มเวล�เข�ง�นปกต เปรยบเทยบกบเวล�เข�ง�นทแตละคน

ไดเลอกเองต�มนโยบ�ย flextime

– ทำ�ก�รจดบนทกเวล�ทใชในก�รเดนท�งในแตละแบบ เพอทดสอบว� ระยะเวล�ทใชในแตละแบบเหมอนหรอแตกต�งกน

– The hypotheses test are• The two population locations are the same.• The two population locations are different.

The rejection region:|z| > za/2

Page 32: Nonparametric Statistics

ผลลพธNumber of Nonzero Differences = 32T+ = 367.5T- = 160.5Large Sample ApproximationTest Statistic Z = 1.935P-Value = .0529

P-value > 0.05 ยอมรบสมมตฐ�นทว�ทงสองวธใชเวล�เดนท�งม�ทำ�ง�นเท�กน

Page 33: Nonparametric Statistics

16.4 Kruskal-Wallis Test• คณลกษณะของปญห�ทเหม�ะกบเครองมอนคอ– เพอเปรยบเทยบกลมประช�กรตงแตสองกลมหรอม�กกว�– เปนขอมลแบบเรยงลำ�ดบหรอขอมลเชงปรม�ณทมก�รกระจ�ยไมปกต

– ขอมลแตละกลมเปนอสระตอกน• The hypotheses are– The location of all the k populations are the same.– At least two population locations differ.

Page 34: Nonparametric Statistics

• Example 6 The Kruskal-Wallis test– ผจดก�รร�นอ�ห�รฟ�สตฟดแหงหนงมก�รทำ�แบบสอบถ�มเพอก�ร

ประเมนคว�มพงพอใจในหวขอต�งๆ หนงในนนคอเรองคว�มรวดเรว ในก�รใหบรก�ร ทงนผจดก�รอย�กทร�บว�ในทงส�มกะ ( เปด 24 hr)

คว�มพงพอใจด�นคว�มรวดเรวของก�รใหบรก�รทลกค�ประเมน เหมอนหรอต�งกนหรอไม ผจดก�รจงสมเอ�ผลจ�กแบบสอบถ�มทให

ลกค�ตอบจ�กแตละกะม�อย�งละ 10 ชด และหยบเอ�ผลคะแนนทได จ�กคว�มพงพอใจด�นคว�มรวดเรวม�เปรยบเทยบ ( ระดบคะแนนคอ

4,3,2,1 ต�มลำ�ดบ) 4:00-mid Mid-8:00 8:00-4:004 3 34 4 13 2 34 2 23 3 13 4 33 3 43 3 22 2 43 3 1

เร�ส�ม�รถสรปไดหรอไมว�ไมมคว�มแตกต�งของระดบคว�มพงพอใจตอประเดนคว�มรวดเรวของก�รใหบรก�รในทงส�มกะat 5% significance level?

XM16-06

Page 35: Nonparametric Statistics

Result: P-value = 0.2665 >0.05แสดงว�ไมมหลกฐ�นเพยงพอทจะระบถงคว�มแตกต�งของคว�มพงพอใจในด�นคว�มรวดเรวของก�รใหบรก�รในทงส�มกะ

Page 36: Nonparametric Statistics

แบบฝกหด 1• Certain drugs differ in their side effects depending on the

gender of the patient. In a study to determine whether men or women suffer more serious side effects when taking a powerful penicillin substitute, 50 men and 50 women were given the drug. Each was asked to evaluate the level of stomach upset on a 4-point scale, where 4= extremely upset, 3= somewhat upset, 2= not too upset, 1= not upset at all. The results are stored in file XR16-09 with column 1= female’s evaluation and column2= male’s eveluation.Can we conclude at the 5% sig. level that men and women experience different levels of stomach upset from the drug?

Page 37: Nonparametric Statistics

แบบฝกหด2 XR16-22• ในภ�วะข�ดแคลนพลงง�นหนวยง�นภ�ครฐพย�ย�มห�วธก�รเพอใหผบรโภคตระหนกในปญห�นดวยก�รออกแคมเปญก�รประช�สมพนธ

ออกม� ทงนเพอใหก�รประช�สมพนธมประสทธภ�พ ภ�ครฐฯไดจดทำ�แบบสำ�รวจขนม�เพอสอบถ�มว�โดยทวไปประช�ชนกงวลกบ

ปญห�ก�รข�ดแคลนนำ�มนหรอข�ดแคลนไฟฟ�ม�กกว�กน โดยจดทำ�แบบสอบถ�ม 4 ท�งเลอกคอ 1= ไมกงวล, 2= กงวลเลกนอย, 3= คอนข�งกงวล, 4= กงวลม�ก โดยสอบถ�มตวอย�ง 150 คนเพอใหใส

ระดบคว�มกงวลในปญห�ข�ดแคลนนำ�มนกบปญห�ข�ดแคลนไฟฟ� โดยกำ�หนดให column1= ผตอบ column2= กงวลในปญห�ก�ร

ข�ดแคลนนำ�มน column3= กงวลก�รข�ดไฟฟ�• ทนยสำ�คญ 5% ส�ม�รถสรปไดหรอไมว�ผตอบกงวลเรองข�ดแคลนนำ�มนม�กกว�ข�ดแคลนไฟฟ�

Page 38: Nonparametric Statistics

แบบฝกหด 3 XR16-25• นกก�รตล�ดตองก�รทดสอบว� ตร�สนค�มผลตอคว�มรสกในรสช�ตของไอศครมหรอไม? เข�ทดลองนำ�เอ�ไอศกรมชนด

เดยวกนม�ใสในถวยไอศกรม 2 ถวย ถวยแรกระบว�เปน ไอศกรมชอดงจ�กยโรป ทมกรรมวธก�รผลตอนซบซอน สวน

ถวยสองระบว�เปนไอศกรมป�ตน ร�ค�ถก จ�กนนสมเลอกนก ชมม�ทดลอง กำ�หนดใหระดบคะแนนทใหนกชม60 คนระบเปน

10 ขน (1-10) (poor excellent) • (Column1= respondent, Column2= ตมยโรป, Column3= ตม

ป�ตน• ท 10% sig. ผชมชอบไอศครมยโรปม�กกว�ไอศครมป�ตนจรงหรอไม

Page 39: Nonparametric Statistics

แบบฝกหดท 4 (XR16-36)

อ�จ�รยสถตท�นหนงพย�ย�มคนห�คว�มแตกต�งของผลลพธในวธก�รสอนวช�สถต3 แบบใหกบนกศกษ� CAMT

ต�ง section กน โดยวธท1 : lecture วธท2: Case method วธท3 : Computer software

เมอถงปล�ยภ�คไดทำ�แบบประเมนผลใหนกศกษ�ตอบ โดย เปนแบบสอบถ�ม 7 อนดบ (1-7) (Poor Excellent) แลวสม

เลอกม� section ละ 25 คน (section 1,2,3 = column1,2,3) จ�กขอมลส�ม�รถสรปไดหรอไมว� นกศกษ�มคว�มพอใจใน

วธก�รสอนอย�งนอย 2 วธแตกต�งกน (at 5% sig)


Recommended