Thanks Peter, There are 8 measurements less than 8.5, so calculating the probability (binomial) of 8, or fewer, happening by chance with n = 20 and p = 0.50 gives P = 0.25-- the book answer. I've tried several problems in other textbooks and in each case I get vastly different P-values than I get with wilcox.test or wilcox.exact. However, upon further testing, I've found good agreement when the calculated P-values are small, but disagreement when P-values are large. This might mean a problem with wilcox.test and wilcox.exact when P-values are large or I might be misinterpreting something. CHV   Charles H Van deZande -------Original Message------- From: Peter Dalgaard Date: 5/19/2009 5:35:07 AM To: cvandy Cc: r-help@r-project.org Subject: Re: [R] Wilcoxon nonparametric p-values 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.dalga...@biostat.ku.dk) FAX: (+45) 35327907 [[alternative HTML version deleted]]
______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.