Matakuliah Tahun : A0392 – Statistik Ekonomi : 2006 Pertemuan 11 Analisis Varians Data Nonparametrik 1 Outline Materi : Uji Kruskal Wallis Pembuatan peringkat data Statistik uji Kruskal Wallis 2 Analysis of Variance:Data Nonparametric (continued) • Kruskal-Wallis Rank Test for Differences in c Medians • Friedman Rank Test for Differences in c Medians 3 Kruskal-Wallis Rank Test • Assumptions – Independent random samples are drawn – Continuous dependent variable – Data may be ranked both within and among samples – Populations have same variability – Populations have same shape • Robust with Regard to Last 2 Conditions – Use F test in completely randomized designs and when the more stringent assumptions hold 4 Kruskal-Wallis Rank Test Procedure • Obtain Ranks – In event of tie, each of the tied values gets their average rank • Add the Ranks for Data from Each of the c Groups – Square to obtain Tj2 c T2 12 j H 3(n 1) n(n 1) j 1 n j n n1 n2 nc 5 Kruskal-Wallis Rank Test Procedure • Compute Test Statistic – c T2 12 j H 3(n 1) n(n 1) j 1 n j – n n1 n2 (continued) nc – n j # of observation in j –th sample – H may be approximated by chi-square distribution with df = c –1 when each nj >5 6 Kruskal-Wallis Rank Test Procedure • Critical Value for a Given a (continued) – Upper tail • Decision Rule 2 U – Reject H0: M1 = M2 = ••• = Mc if test statistic 2 H > U – Otherwise, do not reject H0 7 Kruskal-Wallis Rank Test: Example As production manager, you want to see if 3 filling machines have different median filling times. You assign 15 similarly trained & experienced workers, 5 per machine, to the machines. At the .05 significance level, is there a difference in median filling times? Machine1 Machine2 Machine3 25.40 26.31 24.10 23.74 25.10 23.40 21.80 23.50 22.75 21.60 20.00 22.20 19.75 20.60 20.40 8 Example Solution: Step 1 Obtaining a Ranking Raw Data Machine1 Machine2 Machine3 25.40 26.31 24.10 23.74 25.10 23.40 21.80 23.50 22.75 21.60 Ranks Machine1 Machine2 Machine3 20.00 22.20 19.75 20.60 20.40 14 15 12 11 13 65 9 6 10 8 5 38 2 7 1 4 3 17 9 Example Solution: Step 2 Test Statistic Computation 2 T c j 12 H 3(n 1) n(n 1) j 1 n j 12 652 382 17 2 3(15 1) 5 5 15(15 1) 5 11.58 10 Kruskal-Wallis Test Example Solution H0: M1 = M2 = M3 H1: Not all equal a = .05 df = c - 1 = 3 - 1 = 2 Critical Value(s): a = .05 0 5.991 Test Statistic: H = 11.58 Decision: Reject at a = .05. Conclusion: There is evidence that population medians are not all equal. 11 Kruskal-Wallis Test in PHStat • PHStat | c-Sample Tests | Kruskal-Wallis Rank Sum Test … • Example Solution in Excel Spreadsheet 12 Friedman Rank Test for Differences in c Medians • Tests the equality of more than 2 (c) population medians • Distribution-Free Test Procedure • Used to Analyze Randomized Block Experimental Designs • Use 2 Distribution to Approximate if the Number of Blocks r > 5 – df = c – 1 13 Friedman Rank Test • Assumptions – The r blocks are independent – The random variable is continuous – The data constitute at least an ordinal scale of measurement – No interaction between the r blocks and the c treatment levels – The c populations have the same variability – The c populations have the same shape 14 Friedman Rank Test: Procedure Replace the c observations by their ranks in each of the r blocks; assign average rank for ties c 12 2 Test statistic: FR R j 3r c 1 rc c 1 j 1 R.j2 is the square of the rank total for group j FR can be approximated by a chi-square distribution with (c –1) degrees of freedom The rejection region is in the right tail 15 Friedman Rank Test: Example As production manager, you want to see if 3 filling machines have different median filling times. You assign 15 workers with varied experience into 5 groups of 3 based on similarity of their experience, and assigned each group of 3 workers with similar experience to the machines. At the .05 significance level, is there a difference in median filling times? Machine1 Machine2 Machine3 25.40 26.31 24.10 23.74 25.10 23.40 21.80 23.50 22.75 21.60 20.00 22.20 19.75 20.60 20.40 16 Friedman Rank Test: Computation Table Machine 1 25.4 26.31 24.1 23.74 25.1 Timing Machine 2 Machine 3 23.4 20 21.8 22.2 23.5 19.75 22.75 20.6 21.6 20.4 Machine 1 3 3 3 3 3 R. j 15 R.2j 225 Rank Machine 2 Machine 3 2 1 1 2 2 1 2 1 2 1 9 6 81 36 c 12 2 FR R j 3r c 1 rc c 1 j 1 12 342 3 5 4 8.4 5 3 4 17 Friedman Rank Test Example Solution H0: M1 = M2 = M3 H1: Not all equal a = .05 df = c - 1 = 3 - 1 = 2 Critical Value: a = .05 0 5.991 Test Statistic: FR = 8.4 Decision: Reject at a = .05 Conclusion: There is evidence that population medians are not all equal. 18 Chapter Summary (continued) • Discussed Kruskal-Wallis Rank Test for Differences in c Medians • Illustrated Friedman Rank Test for Differences in c Medians 19