# Wilcoxon-Mann-Whitney critical values in R

I have noticed that when I try to find the critical values for the Mann-Whitney U using R, the values are always 1+critical value. For example, for $\alpha=.05, n = 10, m = 5$, the (two-tailed) critical value is 8, while for $\alpha=.05, n=12, m=8$, the (two-tailed) critical value is 22 (check the tables), but:

````> qwilcox(.05/2,10,5)
[1] 9
> qwilcox(.05/2,12,8)
[1] 23
````

Of course I'm not considering something, but... anyone could explain me why?

-

## 2 Answers

I think that the answer here might be that you're comparing apples and oranges.

Let $F(x)$ denote the cdf of the Mann-Whitney $U$ statistic. `qwilcox` is the quantile function $Q(\alpha)$ of $U$. By definition, it is therefore $$Q(\alpha)=\inf \{x\in \mathbb{N}: F(x)\geq \alpha\},\qquad \alpha\in(0,1).$$

Because $U$ is discrete, there is usually no $x$ such that $F(x)=\alpha$, so typically $F(Q(\alpha))>\alpha$.

Now, consider the critical value $C(\alpha)$ for the test. In this case, you want $F(C(\alpha))\leq \alpha$, since you otherwise will have a test with a type I error rate that is larger than the nominal one. This is usually considered to be undesirable; conservative tests tend to be prefered. Hence, $$C(\alpha)=\sup \{x\in \mathbb{N}: F(x)\leq \alpha\},\qquad \alpha\in(0,1).$$ Unless there is an $x$ such that $F(x)=\alpha$, we therefore have $C(\alpha)=Q(\alpha)-1$.

The reason for the discrepancy is that `qwilcox` has been designed to compute quantiles and not critical values!

-

(+1) Good, simple, concise description. :) – cardinal Jul 18 '12 at 12:31

Remember that the rank sum test statistic is discrete and so you need to use a critical value such that the tail probability is $\geq$ to the specified $\alpha$. For some sample sizes equal to alpha cannot be achieved and that is my guess as to why you need the +1.

-

4
So why is +1 needed in R and not in the usual tables? – MånsT Jul 17 '12 at 11:14

1
@this.is.not.a.nick: perhaps more importantly, $0.0236723<0.025$ whereas $0.02868937>0.025$, which means that in the former case the actual significance level will be $<0.05$ and that in the latter it will be $>0.05$. Usually people tend to prefer to err on the right side, i.e. to have a lower significance level than the nominal one (meaning that the values from the tables are preferable). – MånsT Jul 17 '12 at 11:33

1
Right to both Procrastinator and MansT. Actually the definiton of significance level requires that the tail probabilities do not sum to anything higher than alpha. I talk about this in my paper with Christine Liu on the sawtoothed behavior of the power function for exact binomial tests via the Clopper-Pearson method (see American Statistician (2002)). – Michael Chernick Jul 17 '12 at 11:56

2
– MånsT Jul 17 '12 at 12:20

2
@Michael: Agreed. In some sense, `qwilcox` does what it's supposed to do, but not what you'd expect it do to. – MånsT Jul 17 '12 at 12:42
show 6 more comments
default
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 21, "mathjax_display_tex": 2, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "github"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "english_confidence": 0.9085681438446045, "perplexity_flag": "middle"}