User Tools

Site Tools


hcistats:wilcoxonsigned

Wilcoxon Signed-rank test

Introduction

A Wilcoxon Signed-rank test is a non-parametric version of a paired t test. The case where you want to use a Wilcoxon Signed-rank test is the same as a Mann-Whitney's U test, and the data are paired (i.e., the samples are independent).



What does Wilcoxon Signed-rank do?

Now we are looking at how a Wilcoxon Signed-rank test works. If you haven't read the Mann-Whitney's U test page, it would be good to read it before going ahead because the explanation is kind of similar.

As a Mann-Whitney's U test, a Wilcoxon Signed-rank test is that it treats the data as ordinal data. So what a Wilcoxon Signed-rank test is also to calculate the rank for each value, but calculate them based on the differences between the two groups. Let's think about some data from a 7-Likert scale question and say you have the following data.

Group A1324254162
Group B3564247632

Each column represents the paired data. You make the difference for each paired data point.

Group A1324354162
Group B3564247632
Sign--- ++--+
Abs(Diff)2240113530

Then, calculate the ranks for the differences.

Group A1324354162
Group B3564247632
Sign--- ++--+
Abs(Diff)2240113530
Rank3.53.57.001.51.55.58.05.50

And combine the sign for each rank.

Group A1324354162
Group B3564247632
Sign--- ++--+
Abs(Diff)2240113530
Rank3.53.57.001.51.55.58.05.50
Signed Rank-3.5-3.5-7.00+1.5+1.5-5.5-8.0+5.50

Now calculate the sums of the positive and negative ranks, which is called W value. The positive W is 8.5, and the negative W is 27.5. And we use the smaller W value, which is 8.5. A Wilcoxon Signed-rank test checks how likely it would be W=8.5.



Effect size

The calculation of the effect size of Wilcoxon Signed-rank test is fairly easy.

,

where N is the total number of the samples. Here is the standard value of r for small, medium, and large sizes.

small sizemedium sizelarge size
abs(r)0.10.30.5



R code example

Let's prepare the data. Create the data like the results from a 5-Likert scale question (the response is 1, 2, 3, 4, or 5), and you have two groups (Group) to compare.

GroupA <- c(1,3,2,4,3,2,1,1,3,2) GroupB <- c(3,5,6,4,2,4,7,6,3,5)

Then, do a Wilcoxon Sign-rank test.

wilcox.test(GroupA, GroupB, paired=T)

And you get the result.

Wilcoxon signed rank test with continuity correction data: GroupA and GroupB V = 1, p-value = 0.02024 alternative hypothesis: true location shift is not equal to 0 Warning messages: 1: In wilcox.test.default(GroupA, GroupB, paired = T) : cannot compute exact p-value with ties 2: In wilcox.test.default(GroupA, GroupB, paired = T) : cannot compute exact p-value with zeroes

From this result, we can see that the statistic to be used for a Wilcoxon test is 1. It is usually denoted as “W”, but in R, it is presented as “V”. However, as you can see here, the exact p value cannot be calculated because of ties. To address this, we need to use coin package.

library(coin)

Then, do another Wilcoxon test. But you have to format the data for the Wilcoxon test with coin.

wilcoxsign_test(GroupA ~ GroupB, distribution="exact")

Now you get another result.

Exact Wilcoxon-Signed-Rank Test data: y by x (neg, pos) stratified by block Z = -2.3922, p-value = 0.01562 alternative hypothesis: true mu is not equal to 0

Thus, we have a significant effect of Group. You also calculate the effect size:

2.3922 / sqrt(20) 0.5349122



How to report

You can report the results of an Wilcoxon test as follows: The medians of Group A and Group B were 2.0 and 4.5, respectively. An Wilcoxon Signed-rank test shows that there is a significant effect of Group (W = 1, Z = -2.39, p < 0.05, r = 0.53).



References

For the effect size, please see: Field, A. Discovering statistics using SPSS. (2nd edition).


Comments

Weizi Li, 2014/08/24 14:54
"Then, do another Mann-Whitney test. But you have to format the data for Mann-Whitney test with coin."

"You can report the results of Mann-Whitney's U test as follows: "

I assume in these two sentences, "Mann-Whitney" should be replaced by "Wilcoxon"?
Koji Yatani, 2014/08/28 07:01
Thank you, Weizi. Fixed.
Guest, 2014/12/15 23:19
Should the confidence interval or the Hodges-Lehmann be reported as well?
Koji Yatani, 2015/02/14 07:01
Hodges-Lehmann is not very common yet in the field of HCI. I think it is ok to omit for now. If you decide to include, it is better to briefly explain what it means.
Guest, 2015/03/10 01:53
is the Z in equation a Z statistic provided by SPSS output? If so, what if my Z value is negative and r results in negative number. For example r = -0,82
Guest, 2015/07/17 13:28
Hello, are you available to answer any comment? Just wanted to check as there isn't any answer to the last comment?
Guest2, 2016/03/09 21:05
I believe r is taken as an absolute value.
Jeremyplowl, 2017/01/25 13:10
FitoSpray — спрей для похудения -> http://fitospray-spb.ru/
---------------------
ShawnJeria, 2017/01/25 18:33
Christmas Piano
Christmas Background Music
Perfect instrumental background music for romantic and sentimental films, presenting your business, new products or your company in general with an optimistic and motivational touch.
Visit site: https://audiojungle.net/item/christmas-piano/19056234/
Twitter @esif22 https://twitter.com/esif22/status/805286803875958784
Clintonlax, 2017/01/25 23:05
Tinedol – эффективное средство от грибка стопы, неприятного запаха и зуда.
Перейти на сайт: http://tinedol.1stbest.info/

<a href=http://www.lakelandpark.co.nz/guest-book/#comment-2266>Tinedol</a>
<a href=http://rc-ogonek.ru/guestbook/comment-page-102/#comment-41629>Tinedol</a>
<a href=http://www.la-mina-motorsport.es/libro-de-visitas/>Tinedol</a>
Please enter your comment. You cannot remove your comments by yourself. So double-check before you submit.:
If you can't read the letters on the image, download this .wav file to get them read to you.
 
hcistats/wilcoxonsigned.txt · Last modified: 2014/08/28 07:01 by Koji Yatani

Page Tools