# Calculating the confidence interval of the median difference, as part of the Wilcoxon matched pairs test, or the confidence interval of the difference between medians as part of the Mann-Whitney test

Prism 6 added the capability to compute the 95% confidence interval of the median paired difference as part of the Wilcoxon matched pairs test, and the 95% CI for the difference between medians as part of the Mann-Whitney test. These are options on the second tab of the analysis dialog. (This didn't work with the Wilcoxon test in early releases of Prism 6 Mac, but was fixed in 6.0c.)

For the Wilcoxon test, the CI can only be interpreted if you assume that the distribution of differences is symmetrical.

For the Mann-Whitney test, the CI can be interpreted only if you assume that the two population distributions have the same shape even if they are shifted so the medians differ. Otherwise, the Mann-Whitney test does not compare medians.

Prism reports the difference between medians in two ways. One way is the obvious one -- it subtracts the median of one group from the median of the other group. The other way is to compute the Hodges-Lehmann estimate. Prism systematically computes the set of differences between each value in the first group and each value in the second group. The Hodges-Lehmann estimate is the median of this set of differences. Prism computes the confidence interval for the difference based on the Hodges-Lehmann method as explained on page 312-313 of Klotz.

Since the nonparametric test works with ranks, it is usually not possible to get a confidence interval with exactly 95% confidence. Prism finds a close confidence level, and reports what it is. For example, you might get a 96.2% confidence interval when you asked for a 95% interval. Prism reports the confidence level it uses, which is as close as possible to the level you requested. When reporting the confidence interval, you can either report the precise confidence level ("96.2%") or just report the confidence level you requested ("95%"). I think the latter approach is used more commonly.

Prism computes an exact confidence interval when the smaller sample has 100 or fewer values, and otherwise computes an approximate interval. With samples this large, this approximation is quite accurate.