next up previous
Next: Inference for Regression Up: Statistical Decisions Previous: Chi-square test for independence

Nonparametric tests

Although the central limit theorem is a powerful tool that allows us to make decisions and obtain estimates with large sample sizes, it does not tell us how large the sample must be for the hypothesis tests and confidence intervals to be valid. Also there may be situations in which normality is difficult to assess due to relatively small sample sizes, or you are not willing to make that assumption. Alternative methods have been developed for such cases that are referred to as non-parametric tests. These tests make minimal assumptions about the population distributions and generally rely on the ranks of the data. As a result, they are applicable where t-tests are not, but they tend to be less powerful than t-tests if the populations are approximately normal.

One-sample test for location. The mean and median are both measures of location, or middle, of a population. We have seen how a one-sample t-test can be used to test hypotheses about the mean of a population. The non-parametric analogue is the median test. Let $q_{.5}$ denote the median of a population (.5 quantile) and suppose we wish to test

H_0:&\ q_{.5} \le m_0\\
H_1:&\ q_{.5} > m_0,

Let $\pi$ denote the proportion of the population less than or equal to $m_0$. If $m_0$ is the population median, then $\pi = .5$, but if the population median is greater than $m_0$, then $\pi < .5$. So this median test is equivalent to a test of a population proportion:

H_0:&\ \pi \ge 0.5\\
H_1:&\ \pi < 0.5,

The sample proportion for this test is the proportion of the sample that are less than or equal to $m_0$. However, since tests for population proportions generally require very large sample sizes, the median test is not used much in practice.

Signed Rank Test
A more powerful non-parametric test that requires the assumption of symmetry for the population distribution was proposed by Frank Wilcoxon, a chemist with a strong intuition about statistics. His test is referred to as the signed rank test. Not that for symmetric populations the mean and median are the same. Let $Y_i = \vert X_i - m_0\vert$, let $S_i$ denote the sign of $X_i - m_0$, and let $R_i$ denote the rank of $Y_i$ in the sample, where the smallest observation receives rank 1 and the largest receives rank n. Ties are given the average of the ranks they would have received if they had been different. If $m_0$ is the median, then the ranks of the absolute deviations corresponding to observations above $m_0$ (signs = 1) should be comparable to the ranks of the absolute deviations for observations below $m_0$ (signs = -1). Therefore, in that case

W = \left\vert \sum_{i=1}^n S_iR_i \right\vert

should be around 0. If $m_0$ is not the median, then W should be large. Wilcoxon was able to derive the sampling distribution of W under the null hypothesis. This test is implemented in R using the wilcox.test function.

This test also can be used for paired samples in which case $m_0 = 0$ and $X_i$ is replaced by the pair differences. Consider the paired data,
Suppose we wish to test the null hypothesis that the medians of Prewt and Postwt are the same for patients who received the control treatment, Cont. A t-test requires the assumption of normality, but the signed rank test only requires symmetry. These tests are performed as follows.

Anorexia = read.table("",
   header=TRUE, row.names=1)
Trt.ndx = Anorexia$Treat == "Cont"
Prewt = Anorexia$Prewt[Trt.ndx]
Postwt = Anorexia$Postwt[Trt.ndx]
PrePost.signedR = wilcox.test(Prewt,Postwt,paired=TRUE)
# for comparison
PrePost.ttest = t.test(Prewt,Postwt,paired=TRUE)
We can make this comparison for each of the experimental treatments, CBT and FT.
Trt.ndx = Anorexia$Treat == "CBT"
PrewtCBT = Anorexia$Prewt[Trt.ndx]
PostwtCBT = Anorexia$Postwt[Trt.ndx]
CBT.signedR = wilcox.test(PrewtCBT,PostwtCBT,paired=TRUE,
# for comparison
CBT.ttest = t.test(PrewtCBT,PostwtCBT,paired=TRUE)
Trt.ndx = Anorexia$Treat == "FT"
PrewtFT = Anorexia$Prewt[Trt.ndx]
PostwtFT = Anorexia$Postwt[Trt.ndx]
FT.signedR = wilcox.test(PrewtFT,PostwtFT,paired=TRUE,
# for comparison
FT.ttest = t.test(PrewtFT,PostwtFT,paired=TRUE)

Wilcoxon Rank Sum Test
There also is an analogue to the two-sample t-test for independent samples, discovered independently by Wilcoxon, Mann and Whitney, the rank sum test. For this test the ranks of the combined samples are obtained. Under the null hypothesis that the middles of the two populations are the same, the ranks from sample 1 should be comparable to the ranks from sample 2. The test statistic is the sum of the ranks from sample 1. This test also is implemented in R with the wilcox.test function. Suppose for example we wish to compare the pretreatment weights for Cont patients to the pretreatment weights of patients who received treatment CBT.

x = Anorexia[Anorexia$Treat == "Cont","Prewt"]
y = Anorexia[Anorexia$Treat == "CBT","Prewt"]
Now compare weight gains for these two groups.
WtGain = Anorexia$Postwt - Anorexia$Prewt
x = WtGain[Anorexia$Treat == "Cont"]
y = WtGain[Anorexia$Treat == "CBT"]
What about FT?
z = WtGain[Anorexia$Treat == "FT"]

next up previous
Next: Inference for Regression Up: Statistical Decisions Previous: Chi-square test for independence
Larry Ammann