Pertemuan 26 Metode Non Parametrik-2 Matakuliah : A0064 / Statistik Ekonomi

advertisement
Matakuliah
Tahun
Versi
: A0064 / Statistik Ekonomi
: 2005
: 1/1
Pertemuan 26
Metode Non Parametrik-2
1
Learning Outcomes
Pada akhir pertemuan ini, diharapkan mahasiswa
akan mampu :
• Menyimpulkan hasil pengujian hipotesis
dengan menggunakan uji peringkat
bertanda Wilcoxon dan Uji Kruskal-Wallis
2
Outline Materi
• Uji Peringkat Bertanda Wilcoxon
• Uji Kruskal-Wallis
3
COMPLETE
14-4
BUSINESS STATISTICS
5th edi tion
14-5 The Wilcoxon Signed-Ranks Test
(Paired Ranks)
The null and alternative hypotheses:
H0: The median difference between populations are 1 and 2 is zero
H1: The median difference between populations are 1 and 2 is not zero
Find the difference between the ranks for each pair, D = x1 -x2, and then rank the
absolute values of the differences.
The Wilcoxon T statistic is the smaller of the sums of the positive ranks and the sum of
the negative ranks:
T  min  (  ),  (  ) 
For small samples, a left-tailed test is used, using the values in Appendix C, Table 10.
E[T ] 
n ( n  1)
4
The large-sample test statistic:
McGraw-Hill/Irwin
T 
z
T  E[T ]
n ( n  1)( 2 n  1)
24
T
Aczel/Sounderpandian
© The McGraw-Hill Companies, Inc., 2002
COMPLETE
14-5
BUSINESS STATISTICS
5th edi tion
Example 14-6
Sold Sold
(1) (2)
(D<0)
56
48
100
85
22
44
35
28
52
77
89
10
65
90
70
33
40
70
60
70
8
40
45
7
60
70
90
10
85
61
40
26
Rank Rank
Rank
D=x1-x2 ABS(D) ABS(D)(D>0)
16
-22
40
15
14
4
-10
21
-8
7
-1
0
-20
29
30
7
McGraw-Hill/Irwin
16
22
40
15
14
4
10
21
8
7
1
*
20
29
30
7
9.0
12.0
15.0
8.0
7.0
2.0
6.0
11.0
5.0
3.5
1.0
*
10.0
13.0
14.0
3.5
9.0
0.0
15.0
8.0
7.0
2.0
0.0
11.0
0.0
3.5
0.0
*
0.0
13.0
14.0
3.5
0
12
0
0
0
0
6
0
5
0
1
*
10
0
0
0
Sum:
86
34
Aczel/Sounderpandian
T=34
n=15
P=0.05 30
P=0.025 25
P=0.01 20
P=0.005 16
H0 is not rejected (Note the
arithmetic error in the text for
store 13)
© The McGraw-Hill Companies, Inc., 2002
COMPLETE
14-6
BUSINESS STATISTICS
5th edi tion
Example 14-7
Hourly
Rank
Messages
(D<0)
151
144
123
178
105
112
140
167
177
185
129
160
110
170
198
165
109
118
155
102
164
180
139
166
82
Rank
Rank
Md0
149
149
149
149
149
149
149
149
149
149
149
149
149
149
149
149
149
149
149
149
149
149
149
149
149
McGraw-Hill/Irwin
2
-5
-26
29
-44
-37
-9
18
28
36
-20
11
-39
21
49
16
-40
-31
6
-47
15
31
-10
17
33
D=x1-x2 ABS(D) ABS(D) (D>0)
2
5
26
29
44
37
9
18
28
36
20
11
39
21
49
16
40
31
6
47
15
31
10
17
33
1.0
2.0
13.0
15.0
23.0
20.0
4.0
10.0
14.0
19.0
11.0
6.0
21.0
12.0
25.0
8.0
22.0
16.5
3.0
24.0
7.0
16.5
5.0
9.0
18.0
1.0
0.0
0.0
15.0
0.0
0.0
0.0
10.0
14.0
19.0
0.0
6.0
0.0
12.0
25.0
8.0
0.0
0.0
3.0
0.0
7.0
16.5
0.0
9.0
18.0
0.0
2.0
13.0
0.0
23.0
20.0
4.0
0.0
0.0
0.0
11.0
0.0
21.0
0.0
0.0
0.0
22.0
16.5
0.0
24.0
0.0
0.0
5.0
0.0
0.0
Sum:
163.5
161.5
E[ T ] 
n ( n  1)
(25)(25 + 1)
=
T 

= 162.5
4
4
n ( n  1)( 2 n  1)
24
25( 25  1)(( 2 )( 25)  1)
24

33150
 37 .165
24
The large - sample test statistic:
z 
T  E[ T ]
T

163.5  162 .5
 0.027
37 .165
H 0 cannot be rejected
Aczel/Sounderpandian
© The McGraw-Hill Companies, Inc., 2002
COMPLETE
BUSINESS STATISTICS
14-7
5th edi tion
Example 14-7 using the Template
Note 1: You should enter
the claimed value of the
mean (median) in every
used row of the second
column of data. In this case
it is 149.
Note 2: In order for the
large sample
approximations to be
computed you will need to
change n > 25 to n >= 25 in
cells M13 and M14.
McGraw-Hill/Irwin
Aczel/Sounderpandian
© The McGraw-Hill Companies, Inc., 2002
COMPLETE
BUSINESS STATISTICS
14-8
5th edi tion
14-6 The Kruskal-Wallis Test - A Nonparametric
Alternative to One-Way ANOVA
The Kruskal-Wallis hypothesis test:
H0: All k populations have the same distribution
H1: Not all k populations have the same distribution
The Kruskal-Wallis test statistic:
12  k Rj 
H
  3(n  1)
n(n  1)  
n
j 1
j 
2
If each nj > 5, then H is approximately distributed as a 2.
McGraw-Hill/Irwin
Aczel/Sounderpandian
© The McGraw-Hill Companies, Inc., 2002
COMPLETE
14-9
BUSINESS STATISTICS
5th edi tion
Example 14-8: The Kruskal-Wallis Test
SoftwareTimeRank Group RankSum
1
45
14
1
90
1
38
10
2
56
1
56
16
3
25
1
60
17
1
47
15
1
65
18
2
30
8
2
40
11
2
28
7
2
44
13
2
25
5
2
42
12
3
22
4
3
19
3
3
15
1
3
31
9
3
27
6
3
17
2
McGraw-Hill/Irwin
2
R

k
12
j
H 
 j1   3( n  1)
n ( n  1) 
nj 
12
 902 562 252 




  3(18  1)
18(18  1)  6
6
6 
12   11861



  57
 342   6 
 12 .3625
2(2,0.005)=10.5966, so H0 is rejected.
Aczel/Sounderpandian
© The McGraw-Hill Companies, Inc., 2002
COMPLETE
BUSINESS STATISTICS
14-10
5th edi tion
Example 14-8: The Kruskal-Wallis Test
– Using the Template
McGraw-Hill/Irwin
Aczel/Sounderpandian
© The McGraw-Hill Companies, Inc., 2002
COMPLETE
BUSINESS STATISTICS
14-11
5th edi tion
Further Analysis (Pairwise Comparisons
of Average Ranks)
If the null hypothesis in the Kruskal-Wallis test is rejected, then we may wish,
in addition, compare each pair of populations to determine which are different
and which are the same.
The pairwise comparison test statistic:
D  Ri  R j
where R i is the mean of the ranks of the observations from
population i.
The critical point for the paired comparisons:
 n(n  1)  1 1 
2
C KW  (   , k 1 ) 
  

 12  ni n j 
Reject if D > C KW
McGraw-Hill/Irwin
Aczel/Sounderpandian
© The McGraw-Hill Companies, Inc., 2002
COMPLETE
14-12
BUSINESS STATISTICS
5th edi tion
Pairwise Comparisons: Example 14-8
C KW
Critical Point:
n(n  1)  1 1 
 (  2 ,k 1 ) 
 


 12  ni n j 
18(18  1)  1 1
 ( 9.21034)
  
12
 6 6
 87.49823  9.35
90
 15
6
56
R2   9.33
6
25
R3   4.17
6
R1 
McGraw-Hill/Irwin
D1,2  15  9.33  5.67
D1,3  15  4.17  10.83 ***
D2,3  9.33  4.17  516
.
Aczel/Sounderpandian
© The McGraw-Hill Companies, Inc., 2002
COMPLETE
14-13
BUSINESS STATISTICS
5th edi tion
14-7 The Friedman Test for a
Randomized Block Design
The Friedman test is a nonparametric version of the randomized block design
ANOVA. Sometimes this design is referred to as a two-way ANOVA with one item per
cell because it is possible to view the blocks as one factor and the treatment levels as the
other factor. The test is based on ranks.
The Friedman hypothesis test:
H0: The distributions of the k treatment populations are identical
H1: Not all k distribution are identical
The Friedman test statistic:
 
2
12
 R  3n( k  1)
nk (k  1)
k
j 1
2
j
The degrees of freedom for the chi-square distribution is (k – 1).
McGraw-Hill/Irwin
Aczel/Sounderpandian
© The McGraw-Hill Companies, Inc., 2002
COMPLETE
BUSINESS STATISTICS
14-14
5th edi tion
Example 14-10 – using the Template
Note: The p-value
is small relative to
a significance level
of  = 0.05, so one
should conclude
that there is
evidence that not
all three lowbudget cruise lines
are equally
preferred by the
frequent cruiser
population
McGraw-Hill/Irwin
Aczel/Sounderpandian
© The McGraw-Hill Companies, Inc., 2002
COMPLETE
BUSINESS STATISTICS
14-15
5th edi tion
14-8 The Spearman Rank Correlation
Coefficient
The Spearman Rank Correlation Coefficient is the simple correlation coefficient
calculated from variables converted to ranks from their original values.
The Spearman Rank Correlation Coefficient (assuming no ties):
n 2
6  di
rs  1  i 21
where d = R(x ) - R(y )
i
i
i
n ( n  1)
Null and alternative hypotheses:
H 0:  s = 0
H1:  s  0
Critical values for small sample tests from Appendix C, Table 11
Large sample test statistic:
z = rs ( n  1)
McGraw-Hill/Irwin
Aczel/Sounderpandian
© The McGraw-Hill Companies, Inc., 2002
COMPLETE
14-16
BUSINESS STATISTICS
5th edi tion
Spearman Rank Correlation Coefficient:
Example 14-11
MMI S&P100
220 151
218 150
216 148
217 149
215 147
213 146
219 152
236 165
237 162
235 161
R-MMI R-S&P Diff Diffsq
7
6
1
1
5
5
0
0
3
3
0
0
4
4
0
0
2
2
0
0
1
1
0
0
6
7
-1
1
9
10
-1
1
10
9
1
1
8
8
0
0
Sum:
Table 11: =0.005
n.
..
7
-----8
0.881
9
0.833
10
0.794
11
0.818
..
.
4
n 2
6  di
(6)(4)
24

rs  1  i 21
= 1= 1= 0.9758 > 0.794 H rejected
990
0
n ( n  1)
(10)(102 - 1)
McGraw-Hill/Irwin
Aczel/Sounderpandian
© The McGraw-Hill Companies, Inc., 2002
COMPLETE
BUSINESS STATISTICS
14-17
5th edi tion
Spearman Rank Correlation Coefficient:
Example 14-11 Using the Template
Note: The pvalues in the
range J15:J17
will appear only
if the sample size
is large (n > 30)
McGraw-Hill/Irwin
Aczel/Sounderpandian
© The McGraw-Hill Companies, Inc., 2002
COMPLETE
14-18
BUSINESS STATISTICS
5th edi tion
14-9 A Chi-Square Test for
Goodness of Fit

Steps in a chi-square analysis:
 Formulate null and alternative hypotheses
 Compute frequencies of occurrence that would be expected if the
null hypothesis were true - expected cell counts
 Note actual, observed cell counts
 Use differences between expected and actual cell counts to find
chi-square statistic:
2
k
(Oi  Ei )
 
Ei
i 1
2
 Compare chi-statistic with critical values from the chi-square
distribution (with k-1 degrees of freedom) to test the null
hypothesis
McGraw-Hill/Irwin
Aczel/Sounderpandian
© The McGraw-Hill Companies, Inc., 2002
COMPLETE
14-19
BUSINESS STATISTICS
5th edi tion
Example 14-12: Goodness-of-Fit Test for
the Multinomial Distribution
The null and alternative hypotheses:
H0: The probabilities of occurrence of events E1, E2...,Ek are given by
p1,p2,...,pk
H1: The probabilities of the k events are not as specified in the null
hypothesis
Assuming equal probabilities, p1= p2 = p3 = p4 =0.25 and n=80
Preference
Tan
Brown Maroon Black
Total
Observed
12
40
8
20
80
Expected(np)
20
20
20
20
80
(O-E)
-8
20
-12
0
0
k ( Oi  E i )
2
  
i 1
Ei
2

( 8 )
20
2

( 20 )
2

( 12 )
20
2

20
( 0)
2
20
 30.4  
2
 11.3449
( 0.01, 3)
H 0 is rejected at the 0.01 level.
McGraw-Hill/Irwin
Aczel/Sounderpandian
© The McGraw-Hill Companies, Inc., 2002
COMPLETE
BUSINESS STATISTICS
14-20
5th edi tion
Example 14-12: Goodness-of-Fit Test for
the Multinomial Distribution using the
Template
Note: the pvalue is
0.0000, so we
can reject the
null
hypothesis at
any  level.
McGraw-Hill/Irwin
Aczel/Sounderpandian
© The McGraw-Hill Companies, Inc., 2002
COMPLETE
14-21
BUSINESS STATISTICS
5th edi tion
Goodness-of-Fit for the Normal
Distribution: Example 14-13
p(z<-1)
p(-1<z<-0.44)
p(-0.44<z<0)
p(0<z<0.44)
p(0.44<z<14)
p(z>1)
= 0.1587
= 0.1713
= 0.1700
= 0.1700
= 0.1713
= 0.1587
Partitioning the Standard Normal Distribution
0.1700
0.1700
0.4
0.1713
0.1713
0.3
f(z)
1. Use the table of the standard normal
distribution to determine an appropriate
partition of the standard normal
distribution which gives ranges with
approximately equal percentages.
0.2
0.1587
0.1587
0.1
z
0.0
-5
-1
0
1
5
-0.44 0.44
2. Given z boundaries, x boundaries can be determined from the inverse standard
normal transformation: x =  + z = 125 + 40z.
3. Compare with the critical value of the 2 distribution with k-3 degrees of
freedom.
McGraw-Hill/Irwin
Aczel/Sounderpandian
© The McGraw-Hill Companies, Inc., 2002
COMPLETE
14-22
BUSINESS STATISTICS
5th edi tion
Example 14-13: Solution
i
Oi
Ei
1
2
3
4
5
6
14
20
16
19
16
15
15.87
17.13
17.00
17.00
17.13
15.87
Oi - Ei (Oi - Ei)2 (Oi - Ei)2/ Ei
-1.87
2.87
-1.00
2.00
-1.13
-0.87
3.49690
8.23691
1.00000
4.00000
1.27690
0.75690
2:
0.22035
0.48085
0.05882
0.23529
0.07454
0.04769
1.11755
2(0.10,k-3)= 6.5139 > 1.11755 H0 is not rejected at the 0.10 level
McGraw-Hill/Irwin
Aczel/Sounderpandian
© The McGraw-Hill Companies, Inc., 2002
COMPLETE
BUSINESS STATISTICS
14-23
5th edi tion
Example 14-13: Solution using the
Template
Note: p-value =
0.8002 > 0.01 H0
is not rejected at the
0.10 level
McGraw-Hill/Irwin
Aczel/Sounderpandian
© The McGraw-Hill Companies, Inc., 2002
COMPLETE
14-24
BUSINESS STATISTICS
5th edi tion
14-9 Contingency Table Analysis:
A Chi-Square Test for Independence
First Classification Category
Second
Classification
Category
1
2
3
4
5
Column
Total
McGraw-Hill/Irwin
1
O11
O21
O31
O41
O51
2
O12
O22
O32
O42
O52
3
O13
O23
O33
O43
O53
4
O14
O24
O34
O44
O54
5
O15
O25
O35
O45
O55
C1
C2
C3
C4
C5
Aczel/Sounderpandian
Row
Total
R1
R2
R3
R4
R5
n
© The McGraw-Hill Companies, Inc., 2002
COMPLETE
14-25
BUSINESS STATISTICS
5th edi tion
Contingency Table Analysis:
A Chi-Square Test for Independence
A and B are independent if:P(AUB) = P(A)P(B).
If the first and second classification categories are independent:Eij = (Ri)(Cj)/n
Null and alternative hypotheses:
H0: The two classification variables are independent of each other
H1: The two classification variables are not independent
Chi-square test statistic for independence:
2
(
O

E
)
ij
 2    ij
Eij
i 1 j 1
r
c
Degrees of freedom: df=(r-1)(c-1)
Expected cell count:
McGraw-Hill/Irwin
Ri C j
Eij 
n
Aczel/Sounderpandian
© The McGraw-Hill Companies, Inc., 2002
COMPLETE
14-26
BUSINESS STATISTICS
5th edi tion
Contingency Table Analysis:
Example 14-14
2(0.01,(2-1)(2-1))=6.63490
Industry Type
Profit
ij
11
12
21
22
Service Nonservice
(Expected) (Expected) Total
42
18
60
(Expected)
(60*48/100)=28.8
(60*52/100)=31.2
Loss
6
34
(Expected)
(40*48/100)=19.2
(40*52/100)=20.8
Total
48
52
O
42
18
6
34
E
28.8
31.2
19.2
20.8
O-E
13.2
-13.2
-13.2
13.2
(O-E)2 (O-E)2/E
174.24
6.0500
174.24
5.5846
174.24
9.0750
174.24
8.3769
 2:
McGraw-Hill/Irwin
29.0865
H0 is rejected at the
0.01 level and
it is concluded that the
two variables
are not independent.
40
100
2
Yates corrected  for a 2x2 table:
2
Oij  Eij  0.5
2
  
Eij
Aczel/Sounderpandian


© The McGraw-Hill Companies, Inc., 2002
COMPLETE
BUSINESS STATISTICS
14-27
5th edi tion
Contingency Table Analysis: Example
14-14 using the Template
Note: When
the
contingency
table is a
2x2, one
should use
the Yates
correction.
Since p-value = 0.000, H0 is rejected at the 0.01 level and it is concluded that the two
variables are not independent.
McGraw-Hill/Irwin
Aczel/Sounderpandian
© The McGraw-Hill Companies, Inc., 2002
COMPLETE
14-28
BUSINESS STATISTICS
5th edi tion
14-11 Chi-Square Test for Equality
of Proportions
Tests of equality of proportions across several populations are also called tests
of homogeneity.
In general, when we compare c populations (or r populations if they are arranged as rows
rather than columns in the table), then the Null and alternative hypotheses:
H0: p1 = p2 = p3 = … = pc
H1: Not all pi, I = 1, 2, …, c, are equal
Chi-square test statistic for equal proportions:
2
(
O

E
)
ij
 2    ij
Eij
i 1 j 1
r
c
Degrees of freedom: df = (r-1)(c-1)
Expected cell count:
McGraw-Hill/Irwin
Ri C j
Eij 
n
Aczel/Sounderpandian
© The McGraw-Hill Companies, Inc., 2002
COMPLETE
BUSINESS STATISTICS
14-29
5th edi tion
14-11 Chi-Square Test for Equality
of Proportions - Extension
The Median Test
Here, the Null and alternative hypotheses are:
H0: The c populations have the same median
H1: Not all c populations have the same median
McGraw-Hill/Irwin
Aczel/Sounderpandian
© The McGraw-Hill Companies, Inc., 2002
COMPLETE
BUSINESS STATISTICS
14-30
5th edi tion
Chi-Square Test for the Median:
Example 14-16 Using the Template
Note: The template
was used to help
compute the test
statistic and the pvalue for the median
test. First you must
manually compute the
number of values that
are above the grand
median and the
number that is less
than or equal to the
grand median. Use
these values in the
template. See Table
14-16 in the text.
Since the p-value = 0.6703 is very large there is no evidence to reject the null hypothesis.
McGraw-Hill/Irwin
Aczel/Sounderpandian
© The McGraw-Hill Companies, Inc., 2002
Penutup
• Metode Non parametrik pada hakekatnya
merupakan suatu uji hipotesis yang
membahas masalah ukuran skala ordinal
dan nominal, uji ini tidak memerlukan
asumsi terhadap populasi yang akan diuji
(uji bebas distribusi)
31
Download