Cross Validated is a question and answer site for people interested in statistics, machine learning, data analysis, data mining, and data visualization. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have the following data vector(in fact its 2392 data points long):

> (dput(head(data, 35)))
c(0.009917216, 0.158975732, -0.008065753, -0.018648987, 0, 0.283519647, 
-0.108234184, 0, -0.151124958, -0.049062385, -0.12970766, 0, 
-0.281741056, -0.04834985, -0.025923954, 0.167527783, 0.080834965, 
0.457401398, -0.007328027, -0.026647639, 0, 0.146048389, 0.059651004, 
-0.115781325, -0.022670935, -0.025330951, -0.011990763, 0, -0.051658383, 
-0.054335988, -0.190313988, -0.031937749, -0.000498226, -0.064351546, 

Now I want to do a non parametric wilcoxon signed rank test for this data frame:

> (wilcox.test(data))

    Wilcoxon signed rank test with continuity correction

data:  data
V = 1100747, p-value = 8.992e-12
alternative hypothesis: true location is not equal to 0

As you can see V is extremely high and I think its therefore probably wrong. Any recommendations what I am doing wrong? What I personally think is, that my R input could be wrong. Any recommendations how to specify it "much more" for a Non parametric Wilcoxon Signed Rank test. I really appreciate your answer!

share|improve this question
up vote 6 down vote accepted

I see no reason whatever to suspect it's wrong.

You have a huge sample. Why couldn't the statistic be large?

In fact, your statistic is actually on the low side ...

It looks like it's using the "sum of the positive ranks" for the test statistic. It's possible to work out the expected value for n=2392 (assuming no ties/zeroes) -- it's 2392*2393/4 = 1431748

[edit: Under the null hypothesis each rank has a 50-50 chance of getting a + or - sign. The sum of $n$ ranks, $1+2+...+n$ is $n(n+1)/2$. The expected sum of the positive ranks is therefore half that, or $n(n+1)/4$.]

Let's generate some samples to check:

a <- replicate(1000,wilcox.test(rnorm(2392))$statistic)

enter image description here

Which is consistent with my calculation. Testing with small samples confirms that the statistic being used is the sum of the positive ranks (one of two common forms of the statistic).

Your statistic is quite some way down the low end. If I generate a normal sample with mean -0.2 and standard deviation 1, I get a test statistic roughly the size of yours.

It may be that you're expecting it to be using a different form of the statistic from the one it's actually using.

share|improve this answer
Thx a lot for your answer! However, I do not understand: How do you come up with this 2392*2393/4 equation? – Kare Apr 17 '14 at 5:42
Included in an edit to the answer just after the place where I said that. – Glen_b Apr 17 '14 at 10:28

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.