# [R] Wilcoxon nonparametric p-values

Peter Dalgaard p.dalgaard at biostat.ku.dk
Tue May 19 11:35:41 CEST 2009

```cvandy wrote:
> When I use wilcox.test, I get vastly different p-values than the problems
> from Statistics textbooks.
> For example:
> The following problem comes from "Applied Statistics and Probability for
> Engineers", 2nd Edition, by D. C. Montgomery.  Page736, problem 14.7.  The
> problem is to compare the sample data with a population median of 8.5.  The
> book answer is p = 0.25, wilcox.test answer is p = 0.573.
> I've tried several other similar problems with similar results.  I've copied
> the following directly from my workspace.

wilcox.exact (from exactRankTests) gives

> wilcox.exact(x - 8.5)

Exact Wilcoxon signed rank test

data:  x - 8.5
V = 80.5, p-value = 0.5748

so I'd suspect the textbook. One-sided p-value perhaps? or table
limitation (as in "p > .25"). If you want to dig deeper, you'll probably
have to check the computations implied by the text.

> Thanks for any help,
> CHV
>> x<-c(8.32,8.05,
>> 8.93,8.65,8.25,8.46,8.52,8.35,8.36,8.41,8.42,8.30,8.71,8.75,8.6,8.83,8.5,8.38,8.29,8.46)
>> wilcox.test(x,y=NULL,mu=8.5)
>         Wilcoxon signed rank test with continuity correction
>  data:  x
> V = 80.5, p-value = 0.573
> alternative hypothesis: true location is not equal to 8.5
>
> Warning messages:
> 1: In wilcox.test.default(x, y = NULL, mu = 8.5) :
>   cannot compute exact p-value with ties
> 2: In wilcox.test.default(x, y = NULL, mu = 8.5) :
>   cannot compute exact p-value with zeroes
> ﻿ ﻿
> Charles H Van deZande
>
>
>
>
>
>  ﻿

--
O__  ---- Peter Dalgaard             Øster Farimagsgade 5, Entr.B
c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
(*) \(*) -- University of Copenhagen   Denmark      Ph:  (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)              FAX: (+45) 35327907

```