# Krisztina Boda PhD Department of Medical Informatics, University of Szeged - PowerPoint PPT Presentation

1 / 32

Biostatistics, statistical software VII. Non-parametric tests: Wilcoxon’s signed rank test, Mann-Whitney U-test, Kruskal-Wallis test, Spearman’ rank correlation. Krisztina Boda PhD Department of Medical Informatics, University of Szeged. Parametric tests.

I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.

Krisztina Boda PhD Department of Medical Informatics, University of Szeged

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

#### Presentation Transcript

Biostatistics, statistical software VII.Non-parametric tests: Wilcoxon’s signed rank test, Mann-Whitney U-test, Kruskal-Wallis test, Spearman’ rank correlation.

Krisztina Boda PhD

Department of Medical Informatics, University of Szeged

### Parametric tests

• Parameter: a parameter is a number characterizing an aspect of a population (such as the mean of some variable for the population), or that characterizes a theoretical distribution shape.

• Usually, population parameters cannot be known exactly; in many cases we make assumptions about them.

INTERREG

• Parameters of the normal distribution: , 

• Parameter of the binomial distribution: n, p

• Parameter of the Poisson distribution: 

INTERREG

### Normal distributions N(, )

N(0,1)

N(1,1)

, :parameters (a parameter is a number that describes the distribution)

N(0,2)

INTERREG

### Binomial distributions

• 1. Each trial results in one of two possible, mutually exclusive outcome. (success, failure)

• 2. The probability of a success, p, remains constant from trial to trial

• 3. The trials are independent.

• We are interested in being able to compute the probability of k successes in n trials.

• The binomial distribution is useful for describing distributions of binomial events, such as the number of males and females in a random sample of companies, or the number of defective components in samples of 20 units taken from a production process. The binomial distribution is defined as:

• p is the probability that the respective event will occur

• q is equal to 1-p

• n is the maximum number of independent trials.

INTERREG

### Example

• Suppose that it is known that 30% of a certain population are immune to some disease. If a random sample of size n=10 is selected from this population, what is the probability that it will contain exactly k=4 immune persons?

INTERREG

INTERREG

### Poisson distribution

• The Poisson distribution is also sometimes referred to as the distribution of rare events. Examples of Poisson distributed variables are number of accidents per person, number of sweepstakes won per person, or the number of catastrophic defects found in a production process.

• If n tends to infinity, but at the same time np= is kept constant the binomial distribution approaches a fixed distribution

INTERREG

• Example. In a certain disease the number of new occurrences in a month is 3 in average. Assuming that the number of new occurrences follows a Poisson distribution, what is the probability that

• Nobody becomes ill (0.0498)

• There are exactly 2 new occurrences (0.224)

INTERREG

### Parametric tests

• The null hypothesis contains a parameter of a distribution. The assumptions of the tests are that the samples are drawn from a normally distributed population.

• One sample t-test: H0: =c,

• Two sample t-test: H0: 1=2,assumptions: 1=2

INTERREG

### Nonparametric tests

• We do not need to make specific assumptions about the distribution of data.

• They can be used when

• The distribution is not normal

• The shape of the distribution is not evident

• Data are measured on an ordinal scale (low-normal-high, passed – acceptable – good – very good)

INTERREG

### Ranking data

• Nonparametric tests can't use the estimations of population parameters. They use ranks instead. Instead of the original sample data we have to use its rank.

• To show the ranking procedure suppose we have the following sample of measurements: 199, 126, 81, 68, 112, 112.

• Sort the data in ascending order: 68, 81,112,112,126,199

• Give ranks from 1 to n: 1, 2, 3, 4, 5, 6

• Cases 5 and 6 are equal, they are assigned a rank of 3.5, the average rank of 3 and 4. We say that case 5 and 6 are tied.

• Ranks corrected for ties: 1, 2, 3.5, 3.5, 5, 6

INTERREG

Case Data Rank Ranks corrected for ties

4 68 1 1

3 81 2 2

5 112 3 3.5

6 112 4 3.5

2 126 5 5

1 199 6 6

The sum of all ranks must be

Using this formula we can check our computations.

Now the sum of ranks is 21, and 6(7)/2=21.

INTERREG

### Nonparametric tests for paired data(nonparametric alternatives of paired t-test)

• Sign test

• Wilcoxon’s matched pairs test

• Null hypothesis: the paired samples are drawn from the same population

INTERREG

Example: 13 students were measured in reading speed and comprehension at a course ending and after 1 month. Suppose we have reason to believe that the two distributions of reading scores are not normal.

Number of positive signs: 6

Number of negative signs: 5

Cases with no change are omitted

Student Score Score Difference Sign

at course after

ending 1 month

150 52-2 -

248 51-3 -

346 460

450 491 +

562 502 +

680 7010 +

723 212 +

830 33-3 -

945 46-1 -

1053 530

1149 481 +

1251 483 +

1346 48-2 -

INTERREG

### Table of the sign test

• The table contains the acceptance region for given sample size and 

INTERREG

### Decision based on table

• If the distributions of the two variables are the same (If the null hypothesis is true), the numbers of positive and negative differences should be similar.

• The null hypothesis is accepted if both numbers lie in the interval given it table for the sign test

• Number of positive signs: 6

• Number of negative signs: 5

• For n=11 and =0.05, this interval is 1-10.

• As both 5 and 6 lies in the interval 1-10, we accept the null hypothesis at 5% level.

INTERREG

Example: 13 students were measured in reading speed and comprehension at a course ending and after 1 month. Suppose we have reason to believe that the two distributions of reading scores are not normal.

Sum of ranks belonging to positive signs: R+=40.5

Sum of ranks belonging to negative signs: R-=25.5

Cases with no change are omitted

Student Score Score Difference Rank

at course after ignoring

ending 1 month signs

150 52-2 5.5

248 51-3 9

346 460

450 491 2

562 502 5.5

680 7010 11

723 212

830 33-3 9

945 46-1 2

1053 530

1149 481 2

1251 483 9

1346 48-2 5.5

INTERREG

### Table of the Wilcoxon signed rank test

• The table contains the acceptance region for given sample size and 

INTERREG

### Decision based on table

• If the distributions of the two variables are the same (If the null hypothesis is true), the sum of positive and negative ranks should be similar.

• The null hypothesis is accepted if both numbers lie in the interval given it table for the test

• Sum of ranks belonging to positive signs: R+=40.5

• Sum of ranks belonging to negative signs: R-=25.5

• For n=11 and =0.05, this interval is 10-56.

• As both rank sums are in this interval, we do not reject the null hypothesis and claim that the difference is not significant at 5% level.

INTERREG

### The case of large samples

• When the sample size is large, we can count the mean and standard deviation of the ranks and use the normal distribution to get the p-value. Computer packages use this normal approximation also in case of small sample size

INTERREG

### Nonparametric test for data in independent groups(nonparametric alternatives of two sample t-test)

• Mann-Whitney U test

• Null hypothesis: the samples are drawn from the same population

INTERREG

### Hypothetical example

• The change of body weight are compared in two groups: patients having a special diet and control patients.

• Null hypothesis: the diet is not effective, data are drawn from the same population.

• The original data are ranked and the sum of ranks in each group is computed. If the null hypothesis is true, the sum of ranks in the two groups are similar.

INTERREG

INTERREG

INTERREG

### Decision based on table

• If the distributions of the two variables are the same (If the null hypothesis is true), the sum of ranks in the two groups should be similar.

• The test statistic T is the sum of the ranks in the smaller group. The null hypothesis is accepted T lies in the interval given it table for the test

• Sum of ranks in the first group (n=10): R1=140

• Sum of ranks in the second group (n=11): R2=91

• The test statistic T is the sum of the ranks in the smaller group.

• T=140. For n1=10 and n2=11 and =0.05, this interval is 81-139.

• As T lies outside of this interval, we reject the null hypothesis and claim that the difference is significant at 5% level.

INTERREG

### An alternative test statistic

• The statistic U (due to Mann Whitney) is the number of all possible pairs of observations comprising one from each sample, say xiand yi , for which xi<yi. This if the sample sizes are n1 and n2, the U/n1n2 is the proportion of all such pairs, and so is also the estimated probability that a new observation from the first population will be less than a new observation sampled from the second population.

INTERREG

### The case of large samples

• When the sample size is large, T test statistic T has an approximately Normal distribution And we can calculate the test statistic z according to the following formula: (ns and nL are the sample sizes in the smaller and larger group respectively).

• Computer packages use this normal approximation also in case of small sample size

INTERREG

### Comparing several independent groups: the Kruskal-Wallis test

• It is also called nonparametric one-way ANOVA

• It tests whether k independent samples that are defined by a grouping variable are from the same population.

• This test assumes that there is no a priori ordering of the k populations from which the samples are drawn.

• As a result, it gives one p-value.

• If the null hypothesis is rejected, further tests are required to make pairwise comparisons. These pairwise comparisons are generally not available in standard statistical packages. Pairwise comparisons can be performed by Mann Whitney U tests and p-values can be corrected by Bonferroni correction.

INTERREG

### Comparison of several related samples: the Friedman test

• The Friedman test is the nonparametric equivalent of a one-sample repeated measures design or a two-way analysis of variance with one observation per cell.

• Friedman tests the null hypothesis that k related variables come from the same population. For each case, the k variables are ranked from 1 to k. The test statistic is based on these ranks.

• As a result, it gives one p-value.

• If the null hypothesis is rejected, further tests are required to make pairwise comparisons. These pairwise comparisons are generally not available in standard statistical packages. Pairwise comparisons can be performed by Wilxocon signed rank tests and p-values can be corrected by Bonferroni correction.

INTERREG

### Review questions and exercises

• Problems to be solved by hand-calculations

• ..\Handouts\Problems hand VII.doc

• Solutions

• ..\Handouts\Problems hand VII solutions.doc

• Problems to be solved using computer - none

INTERREG

### Useful WEB pages

• http://www-stat.stanford.edu/~naras/jsm

• http://www.ruf.rice.edu/~lane/rvls.html

• http://my.execpc.com/~helberg/statistics.html

• http://www.math.csusb.edu/faculty/stanton/m262/index.html

INTERREG