Post on 19-Jul-2020
NONPARAMETRIC TESTS
Frank Wilcoxon Allen Wallis
Henry Kruskal
Andrey Kolmogorov
Charles Spearman
OVERVIEW
• Nonparametric tests
• Sign test
• Rank-Sum tests
• Rank Correlation
• Tests of Randomness
• Kolmogorov-Smirnov & Anderson-Darling Tests
INTRODUCTION
• So far all in our “standard” tests we have assumed our data follows an underlying distribution (normal distribution)
• It is sometimes difficult to verify this assumption, especially when the sample size is small
• To overcome this problem statisticians have developed a number of nonparametric tests
INTRODUCTION
• Nonparametric tests are based on the order relationships among the observations aka ranking
• Very useful for nonnormal populations and small samples sizes
• However if the normality assumption is valid for your data, the “standard” tests are more powerful.
Sign Test
• This is the nonparametric alternate to the one sample t test, the paired sample t-test, and their corresponding large sample tests
• Applicable for continuous symmetrical sample population, such that the probability of getting a sample value less than the mean and the probability of getting a sample value greater than the mean are both 0.5
• What statistic can do this ?
• So yes the sign test is based on the median
Sign Test Procedure
• Hypothesis test
• Sign: If a data value is greater than the hypothesized value it is assigned a plus (+) sign, of if is less than, we assign it a minus(-) sign. If it is equal to the hypothesized value we discard it from further analysis.
• Criterion: We may base the analysis on the number of plus signs or the number of minus signs
cesignificanat
test] tailed[one )(or ~~:
)(or ~~:
21
0
21
00
pH
pH
a
Sign Test Procedure
• Calculations:
replace the data values with their plus or minus sign.
Sum up number of plus signs (or minus), denoted S+ ( or S- ). Find P(X ≥ S+) [or P(X ≤ S-) ] from the binomial distribution
• Decision: If P(X ≥ S+) < α, [or P(X ≤ S-) < α ]then we reject H0, otherwise we fail to reject H0.
• Example
RANK-SUM TESTS
• U test
– An alternative to the two-sample t – test
– Also called the Wilcoxon test, after Frank Wilcoxon(1895 – 1965) who was a professor at Florida State University, or the Mann-Whitney test
• H test
– The nonparametric equivalent of ANOVA
– also called the Kruskal-Wallis test
– Developed in 1960 by Kruskal (University of Chicago) and Wallis (Rochester University, NY)
WILCOXON TEST
• Hypotheses:
– Null hypothesis: The two populations are identical
– Alternate Hypothesis: The populations are not identical
– test at significance level α
• Criterion: reject the null hypothesis if |Zcalc |> |Zα /2|, otherwise fail to reject(“two-tailed test”)
U-TEST STATISTIC
Procedure:
• Combine your data into one set and rank them from lowest to highest noting which population each item came from.
• If there are ties in the ranking we assign each tied value the average rankings of the tied values.
• Sum the ranking values for each sample, denote as W1 and W2 respectively
U-TEST STATISTIC
• Compute the U statistic as U1 or U2 where
• Or we may choose to base our test on U, such that U = min(U1 , U2)
• Let’s say we used U1, going through some rigorous steps (not shown here), it turns out the sampling distribution of U1 has mean and standard deviation as follows;
2
)1(or
2
)1( 2222
1111
nnWU
nnWU
U-TEST STATISTIC
• If n1 and n2 > 8, then
• If n1 and n2 are not both > 8, abandon and look for an appropriate test for your data
• If you have a lot of ties in your ranking procedure, your final test result will be approximate only.
12
)1( and
2
212121
11
nnnnnnUU
1
11
U
U
calc
UZ
H TEST OR KRUSKAL-WALLIS TEST
• This is the nonparametric equivalent of ANOVA.
• Requirements
o k treatments, each with ni sample size
o n1 + n2 + … + nK = n
o ni > 5 for all k treatments
o Otherwise this test will not work for your data
KRUSKAL-WALLIS TEST
• Hypotheses:
– Null hypothesis: The populations are identical
– Alternate Hypothesis: The populations are not identical
– test at significance level α
• Criterion: reject the null hypothesis if H > χ2
α, k-1, otherwise fail to reject(Yes, a Chi-square test)
H STATISTIC
Procedure:
• Combine your data into one set and rank them from lowest to highest noting which population each item came from.
• If there are ties in the ranking we assign each tied value the average rankings of the tied values.
H STATISTIC
• Where Ri is the sum of the ranks occupied by the ni observations in the ith treatment
)1(3)1(
12
1
2
nn
R
nnH
k
i i
i
RANK-SUM TESTS
• Example : Wilcoxon test
• Example: Kruskal-Wallis test
•
Any Questions, Comments, or Concerns ?
SPEARMANS’S RANK CORRELATION
• Analogous to Pearson’s correlation r.• Observations are replaced by their ranks. When
ties occur assign the average rank to those tied at that rank.
• Ranking is from lowest to highest• Denoted by rs
• -1 < rs < 1 . Values near 1 indicate tendency for large x, y values to be paired together, whereas -1 indicates the opposite relationship
• rs measures the strength of relationship but that the relationship may not necessarily be linear
SPEARMANS’S RANK CORRELATION
• Spearman’s correlation coefficient may be stated as follows
• If Ri is the ranking an xi value, Si the ranking of a yi value, and n is the number of bivariatepairs,
n
i
i
n
i
i
n
i
ii
s
SSRR
SSRR
r
1
2
1
2
1
)()(
))((
SPEARMANS’S RANK CORRELATION
• Alternate representations include;
and
121
2
1
2
1
2
1
nn
nS
nR
r
n
i
ii
s
121
41
2
1
2
nn
nnSR
r
n
i
ii
s
SPEARMANS’S RANK CORRELATION
• If the sample size is large, we can test if X and Y are independent using the test statistic
How do we test independence in the “regular” method?
• RESIDUALS !! wink, wink
• Examples
srnZ .
TESTS OF RANDOMNESS
KOLMOGOROV-SMIRNOV AND ANDERSON-DARLING TESTS