I am doing a Wilcoxon test in R and one thing that has surprise me is that when I compute the confidence interval for the below mentioned dataset I get a 95% confidence interval of (-807,198), and non of the values for the treated and untreated groups are within that interval.

For example:

treated <- c(323,421,578,300,256,640,912,370)
untreated <- c(2388,210,380,345,1130,260,665,1157)


This is the output of the test with the 95% confidence interval

    Wilcoxon rank sum test
data:  treated and untreated
W = 25, p-value = 0.5054
alternative hypothesis: true location shift is not equal to 0
95 percent confidence interval:
   -807  198
sample estimates:
difference in location 

Can anyone help me solving or understanding this issue?

  • $\begingroup$ Notice the test is highly non-significant $\endgroup$ Dec 6, 2017 at 10:09
  • $\begingroup$ Thanks, I have notice that, but as the confidence interval is computed from the data shouldn't it cover my values? $\endgroup$
    – Praderas
    Dec 6, 2017 at 10:27
  • 1
    $\begingroup$ It's the confidence interval for the location shift, not for the distribution of your data. $\endgroup$
    – Firebug
    Dec 6, 2017 at 11:28
  • $\begingroup$ How did you compute C.I. values and difference in location ? $\endgroup$
    – user10619
    Dec 6, 2017 at 12:29

2 Answers 2


According to the help page,

conf.int    = a confidence interval for the location parameter.
estimate    = an estimate of the location parameter.

Now, the value of estimate is -83.5, i.e. the difference in location.

Thus, I deduce that the confidence interval is actually a confidence interval for the difference in location.


Adding to Ocram's answer (which is correct + 1), suppose you subtracted 500 from all the values:

t2 <- treated - 500
u2 <- untreated - 500

then did the same test:

wilcox.test(t2, u2, conf.int=TRUE)

you get the same result as with your original. What matters is the shift in location between treated and untreated, not the actual location.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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