Objective
Understand when and how to use nonparametric
tests
Know when and how to calculate and interpret a
wide variety of nonparametric procedures
Understand which nonparametric tests may be
used in place of parametric tests
when various test assumptions are violated
Introduction
Statistical methods that require specific
distributional assumptions are called parametric
statistics.
When data do not satisfy the distributional
assumptions required by parametric procedures,
other statistical methods are needed
Hypothesis Testing Procedures
Hypothesis
test
Non
Parametri
c
Parametri
c
Z-test
T-test
ANOVA
Wilcoxon
Rank test
MannWhitney
test
KruskalWallis
Spearman
Rank
Friedman
What are Nonparametric Statistics?
Nonparametric statistics are a special form of
statistics which help statisticians when a problem is
occurring in applying parametric statistics.
In order to understand nonparametric statistics, it is
first necessary to know what parametric statistics
are.
What are Parametric Statistics?
In applied statistics, when we refer to a distribution
we often make certain assumptions about it that
enable us to work with it.
One thing that helps us with this is the Central Limit
Theorem (CLT), which allows us to assume that many
sampling distributions are approximately normal.
The CLT tells us that for any distribution with a mean
and variance, the sampling distribution for all
samples of a given sample size is approximately
normally distributed.
?
What is different about Nonparametric Statistics
Sometimes statisticians use what is called “ordinal” data.
This data is obtained by taking the raw data and giving
each sample a rank.
These ranks are then used to create test statistics.
In nonparametric statistics, one deals with the median
rather than the mean.
Since a mean can be easily influenced by outliers or
skewness, and we are not assuming normality, a mean no
longer makes sense.
The median is another judge of location, which makes
more sense in a nonparametric test.
The median is considered the center of a distribution.
Advantages of Nonparametric Tests
Applied to very small samples and the distribution of parameter
unknown
Used with all measurement scales
Much easier to compute
Very quick as they require less calculation
Make fewer assumptions
Results may be as exact as parametric procedures
Probability obtained from most nonparametric tests are exact
probabilities
Disadvantages of Nonparametric Tests
May waste information
Disregard the actual scale of measurement and
substitute either ranks or relative magnitude
Application of some of the nonparametric tests may
be wasteful for the data that can be handled by
parametric methods
Difficult to compute for large samples
Tables of critical values are not widely available
Assessing Normality
Many statistical techniques assume that the data is
normally distributed (symmetrical or bell-shaped)
Normality can be assessed:
Plot the cumulative percentage against cumulative
frequency on probability paper (P-P Plot).
Normal quantile-quantile plot (Q-Q Plot)
Histogram.
T-test for significant skewness or kurtosis.
Goodness of fit test:
Kolmogorov-Smirnov test.
Shapiro-Wilks test.
D’Agostino’s test
Procedures Non parametric test
The procedures for the nonparametric tests are the
same as it is for a parametric test:
1.
Specify the null and alternative hypotheses
2. Set the level of significance
3. Select a random sample of observations
4. Calculate a test statistic
5. Based on the value of the test statistic, either reject
or do not reject H0
The Sign Test
The sign test is one of the oldest tests used in statistics.
When the assumption of the t test is not valid for testing
the Ho that a population mean is equal to some particular
value or the Ho that the mean of a population of
differences between pairs of measurements is equal to
zero, we use the sign test.
Focuses on the median rather than the mean as a measure
of central tendency
It gets its name from the plus and minus signs used in the
calculation rather than the numerical values
The measurements are taken on a continues scale
The test statistic includes the observed number of the plus
signs or the observed number of the minus signs
The Sign Test
Tests One Population Median
Corresponds to t-Test for 1 Mean Small Sample
Test Statistic: # Sample Values Above (or Below)
Median
Can Use Normal Approximation If n > 20
The sign test is a nonparametric test that can be used
with a single group using the median rather than the
mean.
For example, we can ask:
“Did children of 2 years in a given community have the
same median level of energy intake as the 1280 kcal,
expected daily energy intake”?
The logic behind the sign test is as follows:
If the median energy intake in the population of 2-year-
old children is 1280, the probability is 0.50 that any
observation is less than 1280.
(The probability is also 0.50 that any observation is
greater than 1280.)
We count the number of observations less than/or
greater than 1280 and can use the binomial distribution
with π = 0.50
The measure of Central Location will be the median
The Sign Test
H0 : Population median = m0
H1 : Population median different from m0
> m0
< m0
Let X be the number of observations that exceed m0
Comment: If H0: median = m0 is true we would expect
50% of the observations to be above m0, and 50% of the
observations to be below m0,
The Sign Test: Steps
Subtract m0 from each observation to get new
observations.
Throw out any new observations that are equal to 0
Record the sign (+, -) of the non zero new observations
Count the number of positive/negative signs. The
resulting number is r. If there are no positive/negative
signs, r = 0.
Use the least frequently occurring sign as the test
statistic, and
Calculate the P-value with the help of Binomial
probability distribution
The Sign Test: Steps
Use Binomial distribution to determine the likelihood
that r or less (or r or more) of the n observations that
comprise a sample will fall in half of the observations
(n/2).
In general, if the proportion r/n is less than 0.5, the P
value that is more extreme than r will be P(X≤r) and if
the proportion r/n is greater than 0.5, the P value that is
more extreme than r will be P(X>r).
The Sign Test: Steps
Choose the level of significance α
Give conclusion:
The null hypothesis is rejected if 2X the probability of
obtaining a value equal or more extreme (less than or equal to
or greater than or equal to r, based on the value of r compared
with n/2) than r is less than α.
For two-tailed test if 2xP < α reject H0
2xP ≥ α accept H0
For one-tailed test if P < α reject H0
P ≥α accept H0
Example: Energy intake of 2 years old children
The Sign Test
H0: Population median = 1280
H1: Population median ≠1280
α= 0.05
r=2
Since r/n=2/9=0.22 is less than 0.5, the P value that
is more extreme than r=2 will be P(X≤2) .
P(X≤2) = P(X=0) + P(X=1) + P(X=2)
The Sign Test
The Sign Test: Example
P(X=0) = 9!/0!9! (0.50)0 (0.5)9-0 = 0.0019
P(X=1) = 0.0176
P(X=2) = 0.0703
P(X≤2) = 0.0019+0.0176+0.0703 = 0.0898
P = 2X0.0898 = 0.1796
Since P > α, we accept H0
Alternative way
If we take the –ve signs as r, there are seven –ve signs. Since
r/n=7/9=0.78 is greater than 0.5 the P-value that is more extreme
than r=7 will be P(X≥7).
P(X≥7)=P(X=7)+P(X=8)+P(X=9)
=0.0703+0.0176+0.0020 =0.0898
–P=2x0.0898=0.1796 implies Accept H0
Sign Test: Paired Data
When the data consists of observations in matched pairs
and the assumptions underlying the t test not met, the
sign test may be employed to test the Ho that the
difference is 0.
H0 : Population median difference = 0
H1 : Population median difference ≠ 0
One of the matched scores, say Y, is subtracted from the
other score, X.
If Y<X, the sign of the difference is +, and if Y>X, the sign
of the difference is -.
In a random sample of matched pairs, we would expect
the number of + and – to be about equal.
Sign Test: Paired Data
Oral hygiene scores of 12 subjects receiving oral
hygiene instruction (X) and 12 subjects not receiving
instruction (Y)
Wilcoxon Signed Rank Test
Another much more recently developed test that can be
used is the Wilcoxon Signed Rank test.
An American statistician, Frank Wilcoxon, who worked in
the chemical industry, developed this test in 1945.
We use this test if the population whose data values are
continuous and approximately symmetric.
It utilizes the signs as well as the magnitudes of the
differences unlike the sign test which only uses the signs of
the differences
Wilcoxon Signed Rank Test
This test is more sensitive and powerful than sign test.
Assumptions:
Sample is random
Variable is continuous
Population symmetrically distributed about its mean
Measurement scale is at least interval
Used to test a hypothesis about one population median
H0 : Population median = m0
H1 : Population median ≠ m0
Wilcoxon Signed Rank Test
Subtract m0 from each observation.
Throw out all new observations that are equal to 0 to get
n* out of n observations
Arrange the nonzero new observations in order of
increasing absolute value
Write the ranks of the absolute values of the new
observations.
If two or more observations are equal, they will be tied for
the same rank and assign to each of the tied new
observations the average of the ranks they would have if
they were not tied.
Wilcoxon Signed Rank Test
Assign to each rank the sign of the new observation to which it
corresponds.
Add all of the positive ranks (W+) and all of the negative ranks
(W-).
Then the test statistic is W = min(W+, W-)
The median class size is claimed to be 40
Sample data for 8 classes is randomly obtained
Compare each value to the hypothesized median to find
difference
Wilcoxon Signed Rank Test
Wilcoxon Signed Rank Test
Rank the absolute differences:
Wilcoxon Signed Rank Test
Wilcoxon Signed Rank Test
H0: Median = 40
H1: Median ≠ 40
Test at the α = .05 level
The Test Statistic = 9
This is a two-tailed test (α/2=0.0250) and n = 8, so find the critical
value of the test statistic given in next slid .
We reject Ho if the computed value of W is less than or equal to the
Critical value.
Since 9 > 4, we are unable to reject the Ho.
From Table K, we see that p=2(0.1250) = 0.25
Wilcoxon critical
Wilcoxon Signed Rank Test
The W test statistic approaches a normal
distribution as n increases
For large n* (n > 20), W can be approximated by
3. Mann-Whitney U Test
Used to test for differences between two independent
groups on a continuous measure
We use it if the populations are not normally distributed.
Eg. Do males and females differ in their self-esteem?
A nonparametric alternative to independent samples t test
Sometimes referred to as Wilcoxon Rank-Sum Test
Mann-Whitney U Test
In stead of comparing means of the two groups, it compares
medians
What you need: Two variables
One categorical variables with two groups (e.g., sex)
One continuous variable (e.g., Self-esteem)
The two samples can be of size n and m
We test the Ho that the two populations have equal medians
against either of the three alternatives
H0: The two populations have equal medians
H1: Median1 ≠ Median2 (two-sided)
Median1 > Median2 (one-sided)
Median1 < Median2 (one-sided)
Mann-Whitney U Test Procedures
Combine the two samples into one sample.
Underline or color the observations from the first or second
sample in order to track them.
Arrange the observations in the combined sample in order of
increasing size.
Observations are ordered according to actual values, not
absolute value.
Write the ranks of the observations: Underline the ranks
corresponding to observations from the first sample.
If two or more observations are equal, they will be tied for the
same rank. Assign to each of the tied observations the average
of the ranks they would have if they were not tied.
Mann-Whitney U Test Procedures
Separate back into two samples, each value
keeping its assigned ranking , Add all of the ranks
from the first sample (R1) and the second sample
(R2). sum the rankings for each sample
Mann-Whitney U Test Procedures
Give conclusion
For small samples
Mann-Whitney U Test Procedures
For large samples
if |Z| > Zα/2 or P < αreject Ho and
if |Z| ≤Zα/2 or P≥ α accept Ho
(For one-tailed test use Zα)
Kruskal Wallis one way ANOVA
Nonparametric alternative to One Way ANOVA
Allows you to compare the continuous measures for three or
more groups when the assumption of normality and the
assumption of equal variances violated
Scores are converted to ranks and the mean rank from each
group is compared
This is “between group” analysis
The Mann Whitney U-test is limited to the consideration of
two populations.
Kruskal Wallis one way ANOVA is a method for the
comparison of the locations (medians) from two or more
populations
Nonparametric ANOVA is not a different design but a
different method of analysis.
Kruskal Wallis one way ANOVA
The Kruskal-Wallis test is a generalization of the Mann
Whitney U-test, which is named after the two prominent
American statisticians who developed it in 1952.
The hypothesis being tested by the Kruskal Wallis statistic
is that all the medians are equal to one another, and the
alternative hypothesis is that the medians are not all equal
5. Friedman Test
Nonparametric alternative to the one way repeated measures
ANOVA
While the Kruskal-Wallis test is designed to compare k
independent groups, the Friedman test is for comparing k
dependent groups.
The groups are no longer independent when matched samples
are assigned to k comparison groups
You take same sample of participants and measure them at
three or more points in time, or under three different conditions
Parametric / Non-parametric
Parametric Tests
Non-parametric Tests
Single sample t-test
Wilcoxon-signed rank test
Paired sample t-test
Paired Wilcoxon-signed rank
2 independent samples t-test
Mann-Whitney test(Note: sometimes
called Wilcoxon Rank Sums test!)
One-way Analysis of Variance
Kruskal-Wallis
Pearson’s correlation
Spearman Rank
Repeated Measures
Friedman
Summary Non-parametric
• Non-parametric methods have fewer assumptions
than parametric tests
• So useful when these assumptions not met
• Often used when sample size is small and difficult to
tell if Normally distributed
• Non-parametric methods are a ragbag of tests
developed over time with no consistent framework