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 denote the median of a
population (.5 quantile) and suppose we wish to test

Let denote the proportion of the population less than or equal to . If is the population median, then , but if the population median is greater than , then . So this median test is equivalent to a test of a population proportion:

The sample proportion for this test is the proportion of the sample that are less than or equal to . 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
, let denote the sign of , and let denote the rank of
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 is the
median, then the ranks of the absolute deviations corresponding to observations above
(signs = 1) should be comparable to the ranks of the absolute deviations for observations below
(signs = -1). Therefore, in that case

should be around 0. If is not the median, then

This test also can be used for paired samples in which case and is replaced by the pair
differences. Consider the paired data,

http://www.utdallas.edu/~ammann/stat3355scripts/anorexia.txt

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("http://www.utdallas.edu/~ammann/stat3355scripts/anorexia.txt", 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,

Trt.ndx = Anorexia$Treat == "CBT" PrewtCBT = Anorexia$Prewt[Trt.ndx] PostwtCBT = Anorexia$Postwt[Trt.ndx] CBT.signedR = wilcox.test(PrewtCBT,PostwtCBT,paired=TRUE,conf.int=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,conf.int=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"] wilcox.test(x,y)Now compare weight gains for these two groups.

WtGain = Anorexia$Postwt - Anorexia$Prewt x = WtGain[Anorexia$Treat == "Cont"] y = WtGain[Anorexia$Treat == "CBT"] wilcox.test(x,y)What about

z = WtGain[Anorexia$Treat == "FT"] wilcox.test(x,z)

2015-04-20