# [R] Wilcoxon nonparametric p-values

Keith Jewell k.jewell at campden.co.uk
Tue May 19 11:55:20 CEST 2009

```I just tried it in Minitab and got
----------
Test of median = 8.500 versus median not = 8.500

N for   Wilcoxon         Estimated
N   Test  Statistic      P     Median
C1  20     19       80.5  0.573      8.460
-----------------
One tailed gave me closer to the textbook, but still not very close.
-----------
Test of median = 8.500 versus median < 8.500

N for   Wilcoxon         Estimated
N   Test  Statistic      P     Median
C1  20     19       80.5  0.287      8.460
---------------

I agree with Peter Dalgaard, the book has it wrong (for some value of
"wrong")

Regards

KJ

"Peter Dalgaard" <p.dalgaard at biostat.ku.dk> wrote in message
news:4A127D6D.1060702 at biostat.ku.dk...
> 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
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help