Download presentation
Presentation is loading. Please wait.
Published byLuke Greene Modified over 8 years ago
1
Nonparametric test based on ranks 1
2
Concept of parametric and non-parametric testing Wilcoxon’s signed rank test for paired design Wilcoxon’s rank sum test for two independent samples Kruskal-Wallis’ H test for multiple independent samples and pairwise comparison Outline 2
3
Review of Parametric Test Example: independent sample t test Assumptions: independent observations normal distribution equal variances Objective the population means (parameter of the specified distribution ) are equal or not under such assumptions. 3
4
Key features: Assume particular distribution Make inference for the parameter of the specified distribution Therefore, they are called parametric ( specific distribution based ) tests Review of Parametric Test 4
5
Non-parametric tests (distribution-free tests) When conditions of parametric testing were not met. For instance: Variables do not follow normal distribution; The distribution belongs to some type we even do not know yet ( this distribution can not be specified with a finite number of parameters) Frequency Incidence number 5
6
Scenarios suitable for non-parametric tests a. Distribution unknown (condition of parametric methods not met) b. Ordinal data :data have a ranking but no clear numerical interpretation c. Non-precise data( i. e: >80); d. A quick and brief analysis ( for pilot study ). Non-parametric tests 6
7
Key features: Distribution free--- free of particular distribution specification, not free of any assumption (independent, symmetric) Not making inference for the parameters (goodness of fit testing…) Non-parametric tests 7
8
Fewer assumptions, wider applicability However, When the assumptions of parametric tests hold, the power of non-parametric test (if it is used) will be slightly lower. In other words, a larger sample size may be required to draw a significant conclusion under the same test level. So, the appropriateness of assumption is essential (statistic diagnostic) Justification of Parametric test and Non-parametric tests 8
9
1 Wilcoxon’s signed rank test Used for two related samples or repeated measurements on a single sample alternative to the paired Student's t-test when the paired difference cannot be assumed to be normally distributed. Named for Irish-born US statistician Frank Wilcoxon (1892– 1965) who, in a single paper in 1945, proposed both it and the rank-sum test for two independent samples. It was popularised by Siegel (1956) in his influential text book on non-parametric statistics 9
10
Example 1 In order to study the difference of The Fluoride 氟化 物 concentration between the methods of electrode 电极法 and spectrophotometry 分光光度法, the concentrations of 11 paired industrial sewage were measured. The results are listed in Table 1 (According to normality test, the paired difference is not normally distributed) 1 Wilcoxon’s signed rank sum test 10
11
T + =43.5; T - =11.5 11
12
Steps: (1) Hypotheses: H 0 : The median of the difference is 0 H 1 : The median of the difference is not 0 α=0.05. (2)Difference Ranking absolute differences (omit zero, mean rank for ties 持平值 ), and give back the signs Rank sum as statistic T : any one from positive sum or negative sum (3) P-value and conclusion Under null hypotheses, T will be not far from the mean rank of n(n+1)/4 (0 vs n(n+1)/2, an extreme ), From C 9, T is within the critical range(8-47), P>0.05, H 0 is not rejected. Conclusion: we can’t infer the concentrations from two methods are different. 12
13
Total rank sum is always n(n+1)/2 The middle point is the mean rank ( 8+47)/2= n(n+1)/4=27.5 13
14
When sample size is beyond the critical value table, a Z test could be used If there is no tie If there are ties 1 Wilcoxon’s signed ranksum test 14
15
2 Wilcoxon’s rank sum test for two samples Used for independent samples when data is not normally distributed; it is not sure whether the variable follows a normal distribution. Named for Frank Wilcoxon in 1945: equal sample sizes Henry Berthold Mann(1905-2000 ), Austrian-born US mathematician and statistician; Donald Ransom Whitney in 1947: arbitrary sample sizes Also called the Mann–Whitney U test or Mann–Whitney– Wilcoxon (MWW) test. 15
16
Example 2 In order to study the difference of the lethal effect of two drugs, two groups of snails 钉螺 were separately killed by two drugs and the mortality rate of two groups was measured. (Not normally distributed) The results are listed in Table 2 2 Wilcoxon’s rank sum test for two samples 16
17
17
18
Steps (1)Hypotheses: H 0 : The distributions of two populations are the same H 1 : The two distributions are not the same α = 0.05 (2) Ranking all the observations in two samples. same way for ties Rank sum for smaller sample, T=T 1 = 71.5 (3) P-value and conclusion (C10 ) T 0.02,7,7 =34~71, T is outside the critical range, so we got P<0.02, H 0 should be rejected. Conclusion: There exists statistically significant difference between the two mortality rates. 18
19
19
20
When sample size is beyond the range of critical value table, a Z test could be used If there is no tie If there are ties 2 Wilcoxon’s rank sum test for two samples 20
21
3 Kruskal-Wallis’ H test for comparing more than 2 samples Used for testing equality of population medians among groups. Identical to one-way ANOVA with the data replaced by their ranks. Not assume a normal population, but does assume an identically-shaped and scaled distribution for each group, except for any difference in medians. Named for American mathematician and statistician William Henry Kruskal (1919–2005 ) American economist and statistician Wilson Allen Wallis (1912- 1998) in a 1952 paper. An extension of the Mann–Whitney U test to 3 or more groups. 21
22
3.1 Kruskal-Wallis’ H test for comparing more than 2 samples Example 3 478 chronic pharyngitis 慢性咽炎 patients were grouped into 3 categories, according to the treatments they received. A: treatment A; B: treatment B; C: treatment C; The efficacy are listed in Table 3. 22
23
23 R1=83182, R2=18070, R3=13229 R=mean rank * total
24
(1)Hypothesis: H 0 : The distributions of three populations are all the same H 1 : The distributions of three populations are not all the same α = 0.05 (2) Ranking all the observations in three samples (Same way for ties) Rank sums for each sample R 1 =83182, R 2 =18070, R 3 =13229 24
25
(3) Statistic H If there is no tie If there are ties t j : Number of individuals in j-th tie Example 3: 25
26
(4) P-value and conclusion Compare with critical value of H (C 11) Compare with critical value of H (C 11) ——group number =<3, and n of each group =<5 ——group number =<3, and n of each group =<5 Or k: Number of groups in example 3: from table C 8, Hc=51.41 >, we got P, we got P<0.05 Conclusion: efficacy is not all at an equal level. 26
27
3.2. multiple comparison of mean ranks Used for When the comparison among three groups results in significant difference, multiple comparison is needed to know which pairs are different. t tests for pair-wise comparison could be used 27
28
(1)Hypothesis: H 0 : this pair of two population distributions have the same locations H 1 : this pair of two population distributions have different locations, α=0.05. (2) Calculate t value: Similarly , t A,C =0.7071, t B,C =3.005 28
29
29
30
(3) P-value and conclusion, efficacy in group A has a different level from that of the other two groups. Since, The patients in group A may have better efficacy. Conclusion: treatment A may lead to a better efficacy. 30
31
The End summary 1.Concepts of parametric and non- parametric testing methods 2.Merits and limitations of nonparametric methods 3.Some nonparametric methods based on ranks 31
32
Nonparametric tests I Back to basics
33
Lecture Outline What is a nonparametric test? Rank tests, distribution free tests and nonparametric tests Which type of test to use
34
MTB > dotplot 'Male' 'Female'; SUBC> same.. :...... :: :..:::.. :..:: :....:..... :.. ---+---------+---------+---------+---------+---------+---MALE..:. : : :..: ::::::.::.:. ::.: :. :.. ---+---------+---------+---------+---------+---------+---FEMALE 0.32 0.48 0.64 0.80 0.96 1.12
35
MTB > dotplot 'Male' 'Female'; SUBC> same.. :...... :: :..:::.. :..:: :....:..... :.. ---+---------+---------+---------+---------+---------+---MALE..:. : : :..: ::::::.::.:. ::.: :. :.. ---+---------+---------+---------+---------+---------+---FEMALE 0.32 0.48 0.64 0.80 0.96 1.12 MTB > desc 'Male' 'Female’ Variable N Mean Median TrMean StDev SEMean MALE 50 0.5908 0.5600 0.5770 0.1979 0.0280 FEMALE 50 0.5180 0.4950 0.5102 0.1315 0.0186 Variable Min Max Q1 Q3 MALE 0.2900 1.1300 0.4275 0.7150 FEMALE 0.3200 0.8500 0.4100 0.6125
36
Lecture Outline What is a nonparametric test? –What is a parameter? –What are examples of non-parametric tests? Rank tests, distribution free tests and nonparametric tests Which type of test to use
37
Parameters are central to inference in GLM and ANOVA and represent assumptions about the underlying processes
38
LET K1=4.7 # Group 1 mean minus grand mean LET K2=-2.5 # Group 2 mean minus grand mean LET K3=10.4 # The grand mean LET K4=1.9 # Standard deviation of the error RANDOM 30 'Error' LET 'Y'=K3+K1*'DUM1'+K2*'DUM2'+K4*'Error'
39
LET K1=4.7 # Group 1 mean minus grand mean LET K2=-2.5 # Group 2 mean minus grand mean LET K3=10.4 # The grand mean LET K4=1.9 # Standard deviation of the error RANDOM 30 'Error' LET 'Y'=K3+K1*'DUM1'+K2*'DUM2'+K4*'Error' Fitted value = + Group 1 1 2 2 3- 1 - 2 Error has Normal Distribution with zero mean and standard deviation
40
LET K1=4.7 # Group 1 mean minus grand mean LET K2=-2.5 # Group 2 mean minus grand mean LET K3=10.4 # The grand mean LET K4=1.9 # Standard deviation of the error RANDOM 30 'Error' LET 'Y'=K3+K1*'DUM1'+K2*'DUM2'+K4*'Error' Fitted value = + Group 1 1 2 2 3- 1 - 2 Error has Normal Distribution with zero mean and standard deviation
41
Parameters are central to inference in GLM and ANOVA but represent assumptions about the underlying processes
42
Parameters are central to inference in GLM and ANOVA but represent assumptions about the underlying processes can be done without in some simple situations
43
Parameters are central to inference in GLM and ANOVA but represent assumptions about the underlying processes can be done without in some simple situations – BUT HOW?
44
RnkWtSex 10.291 20.322 30.341 4 2 5 2 60.361 7 1 80.371 9 1 100.371 110.372 120.372 130.381 140.381 150.382 160.382 170.392 180.402 190.402 200.402 210.411 220.411 230.412 240.412 250.412 260.412 270.421 280.431 290.432 300.432 310.451 320.452 330.452 340.452 350.462 360.471 370.471 380.481 390.481 400.482 410.482 420.492 430.492 440.501 450.501 460.501 470.502 480.502 490.511 500.512 510.521 520.522 530.522 540.532 550.532 560.552 570.561 580.561 590.561 600.571 610.582 620.582 630.591 640.592 650.592 660.601 670.611 680.612 690.621 700.621 710.622 720.622 730.622 740.631 750.632 760.651 770.661 780.671 790.672 800.672 810.672 820.681 830.711 840.722 850.731 860.751 870.751 880.771 890.781 900.782 910.782 920.822 930.831 940.851 950.852 960.881 970.981 980.981 991.051 1001.131
45
RnkWtSex 10.291 20.322 30.341 4 2 5 2 60.361 7 1 80.371 9 1 100.371 110.372 120.372 130.381 140.381 150.382 160.382 170.392 180.402 190.402 200.402 210.411 220.411 230.412 240.412 250.412 260.412 270.421 280.431 290.432 300.432 310.451 320.452 330.452 340.452 350.462 360.471 370.471 380.481 390.481 400.482 410.482 420.492 430.492 440.501 450.501 460.501 470.502 480.502 490.511 500.512 510.521 520.522 530.522 540.532 550.532 560.552 570.561 580.561 590.561 600.571 610.582 620.582 630.591 640.592 650.592 660.601 670.611 680.612 690.621 700.621 710.622 720.622 730.622 740.631 750.632 760.651 770.661 780.671 790.672 800.672 810.672 820.681 830.711 840.722 850.731 860.751 870.751 880.771 890.781 900.782 910.782 920.822 930.831 940.851 950.852 960.881 970.981 980.981 991.051 1001.131 Remember ties
46
1009080706050403020100 140 120 100 80 60 40 20 0 Mean Rank
47
1009080706050403020100 140 120 100 80 60 40 20 0 The ‘Male’ mean rank = 55.26 The ‘Female’ mean rank = 45.74 Mean Rank
48
MTB > mann-whitney male female
49
Mann-Whitney Test and CI: MALE, FEMALE
50
MTB > mann-whitney male female Mann-Whitney Test and CI: MALE, FEMALE MALE N = 50 Median = 0.5600 FEMALE N = 50 Median = 0.4950
51
MTB > mann-whitney male female Mann-Whitney Test and CI: MALE, FEMALE MALE N = 50 Median = 0.5600 FEMALE N = 50 Median = 0.4950 Point estimate for ETA1-ETA2 is 0.0500 95.0 Percent CI for ETA1-ETA2 is (-0.0100,0.1200)
52
MTB > mann-whitney male female Mann-Whitney Test and CI: MALE, FEMALE MALE N = 50 Median = 0.5600 FEMALE N = 50 Median = 0.4950 Point estimate for ETA1-ETA2 is 0.0500 95.0 Percent CI for ETA1-ETA2 is (-0.0100,0.1200) W = 2763.0
53
MTB > mann-whitney male female Mann-Whitney Test and CI: MALE, FEMALE MALE N = 50 Median = 0.5600 FEMALE N = 50 Median = 0.4950 Point estimate for ETA1-ETA2 is 0.0500 95.0 Percent CI for ETA1-ETA2 is (-0.0100,0.1200) W = 2763.0 Sum of ranks of 2763 corresponds to a mean rank of 2763/50 = 55.26
54
1009080706050403020100 140 120 100 80 60 40 20 0 The ‘Male’ mean rank = 55.26 The ‘Female’ mean rank = 45.74 Mean Rank
55
1009080706050403020100 140 120 100 80 60 40 20 0 The ‘Male’ mean rank = 55.26 The ‘Female’ mean rank = 45.74 Mean Rank
56
MTB > mann-whitney male female Mann-Whitney Test and CI: MALE, FEMALE MALE N = 50 Median = 0.5600 FEMALE N = 50 Median = 0.4950 Point estimate for ETA1-ETA2 is 0.0500 95.0 Percent CI for ETA1-ETA2 is (-0.0100,0.1200) W = 2763.0 Test of ETA1 = ETA2 vs ETA1 not = ETA2 is significant at 0.1016
57
MTB > mann-whitney male female Mann-Whitney Test and CI: MALE, FEMALE MALE N = 50 Median = 0.5600 FEMALE N = 50 Median = 0.4950 Point estimate for ETA1-ETA2 is 0.0500 95.0 Percent CI for ETA1-ETA2 is (-0.0100,0.1200) W = 2763.0 Test of ETA1 = ETA2 vs ETA1 not = ETA2 is significant at 0.1016 The test is significant at 0.1014 (adjusted for ties)
58
MTB > mann-whitney male female Mann-Whitney Test and CI: MALE, FEMALE MALE N = 50 Median = 0.5600 FEMALE N = 50 Median = 0.4950 Point estimate for ETA1-ETA2 is 0.0500 95.0 Percent CI for ETA1-ETA2 is (-0.0100,0.1200) W = 2763.0 Test of ETA1 = ETA2 vs ETA1 not = ETA2 is significant at 0.1016 The test is significant at 0.1014 (adjusted for ties) Cannot reject at alpha = 0.05
59
MTB > mann-whitney male female Mann-Whitney Test and CI: MALE, FEMALE MALE N = 50 Median = 0.5600 FEMALE N = 50 Median = 0.4950 Point estimate for ETA1-ETA2 is 0.0500 95.0 Percent CI for ETA1-ETA2 is (-0.0100,0.1200) W = 2763.0 Test of ETA1 = ETA2 vs ETA1 not = ETA2 is significant at 0.1016 The test is significant at 0.1014 (adjusted for ties) Cannot reject at alpha = 0.05
60
MTB > mann-whitney male female Mann-Whitney Test and CI: MALE, FEMALE MALE N = 50 Median = 0.5600 FEMALE N = 50 Median = 0.4950 Point estimate for ETA1-ETA2 is 0.0500 95.0 Percent CI for ETA1-ETA2 is (-0.0100,0.1200) W = 2763.0 Test of ETA1 = ETA2 vs ETA1 not = ETA2 is significant at 0.1016 The test is significant at 0.1014 (adjusted for ties) Cannot reject at alpha = 0.05 The null hypothesis is better expressed as “the distributions of male and female weights are the same”.
61
Parameters are central to inference in GLM and ANOVA but represent assumptions about the underlying processes can be done without in some simple situations
62
Nonparametric vs Parametric
63
Sign TestOne-sample t-test
64
Nonparametric vs Parametric Sign Test Mann-Whitney Test One-sample t-test Two-sample t-test
65
Nonparametric vs Parametric Sign Test Mann-Whitney Test Spearman Rank Test One-sample t-test Two-sample t-test Correlation/Regression
66
Nonparametric vs Parametric Sign Test Mann-Whitney Test Spearman Rank Test Kruskal-Wallis Test One-sample t-test Two-sample t-test Correlation/Regression One-way ANOVA
67
Nonparametric vs Parametric Sign Test Mann-Whitney Test Spearman Rank Test Kruskal-Wallis Test Friedman Test One-sample t-test Two-sample t-test Correlation/Regression One-way ANOVA One-way blocked ANOVA
68
Lecture Outline What is a nonparametric test? Rank tests, distribution free tests and nonparametric tests Which type of test to use
69
A rose by any other name.. Non-parametric tests lack parameters Rank tests start by ranking the data Distribution-free tests don’t assume a Normal distribution (or any other) These are mainly but not completely overlapping sets of tests (and some are scale-invariant too).
70
Lecture Outline What is a nonparametric test? Rank tests, distribution free tests and nonparametric tests Which type of test to use
71
Fewer assumptions but... still some assumptions (including independence) limited range of situations –no more than 2 x-variables –can’t mix continuous and categorical x-variables provide p-values but estimation is dodgy loss of efficiency if parametric assumptions are upheld there is a grand scheme for parametric statistics (GLM) but a lot of separate strange names for nonparametrics
72
When is there a choice? when there is a non-parametric test –fewer than two or three variables altogether and prediction is not required
73
How to choose: If the assumptions of parametric test are upheld, use it – on grounds of efficiency If not upheld, consider fixing the assumptions (e.g. by transforming the data, as in the practical) If assumptions not fixable, use nonparametric test
74
MTB > dotplot 'LogM' 'LogF'; SUBC> same...... ::: :... :::.. :..::.:....: : :. :.. +---------+---------+---------+---------+---------+-------LogM.:. :... : ::.:: : :. ::.::. ::.:. :. :.. +---------+---------+---------+---------+---------+-------LogF -1.25 -1.00 -0.75 -0.50 -0.25 0.00
75
MTB > dotplot 'LogM' 'LogF'; SUBC> same...... ::: :... :::.. :..::.:....: : :. :.. +---------+---------+---------+---------+---------+-------LogM.:. :... : ::.:: : :. ::.::. ::.:. :. :.. +---------+---------+---------+---------+---------+-------LogF -1.25 -1.00 -0.75 -0.50 -0.25 0.00 MTB > desc 'LogM' 'LogF' Variable N Mean Median TrMean StDev SEMean LogM 50 -0.5786 -0.5798 -0.5850 0.3248 0.0459 LogF 50 -0.6878 -0.7032 -0.6928 0.2453 0.0347 Variable Min Max Q1 Q3 LogM -1.2379 0.1222 -0.8499 -0.3355 LogF -1.1394 -0.1625 -0.8916 -0.4902
76
Lecture Outline What is a nonparametric test? Rank tests, distribution free tests and nonparametric tests Which type of test to use
77
Last remarks Nonparametric tests are an opportunity to revise the basic ideas of statistical inference They are sometimes useful in biology They are often used in biology
78
PROC NPAR1WAY WILCOXON ; VAR c; CLASS g; FREQ n; RUN;
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.