# None of the values in my data are within the confidence interval

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)

wilcox.test(treated,untreated,conf.int=TRUE)


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
-83.5


Can anyone help me solving or understanding this issue?

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

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.