Quantcast

Wilcoxon test p value with one decimal place

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Wilcoxon test p value with one decimal place

Jun Shen-3
Dear list,

Let's say I have data

 a=c(37.961,38.214,57.68)
 b=c(77.56,61.875,67.683)

wilcox.test(a,b)

the wilcoxon test only gives me a p value with one decimal place. Is this
normal? Thanks.

Jun

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Wilcoxon test p value with one decimal place

Bert Gunter
On Thu, Feb 16, 2012 at 10:15 AM, Jun Shen <[hidden email]> wrote:

> Dear list,
>
> Let's say I have data
>
>  a=c(37.961,38.214,57.68)
>  b=c(77.56,61.875,67.683)
>
> wilcox.test(a,b)
>
> the wilcoxon test only gives me a p value with one decimal place. Is this
> normal?

No, it's discrete  :-)

(Actually, that's the answer. Read up on the Mann-Whitney test to see why).

-- Bert

Thanks.

>
> Jun
>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> [hidden email] 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.



--

Bert Gunter
Genentech Nonclinical Biostatistics

Internal Contact Info:
Phone: 467-7374
Website:
http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Wilcoxon test p value with one decimal place

ted.harding-3
On 16-Feb-2012 Bert Gunter wrote:

> On Thu, Feb 16, 2012 at 10:15 AM, Jun Shen <[hidden email]> wrote:
>> Dear list,
>>
>> Let's say I have data
>>
>> _a=c(37.961,38.214,57.68)
>> _b=c(77.56,61.875,67.683)
>>
>>
>>
>> the wilcoxon test only gives me a p value with one decimal place. Is this
>> normal?
>
> No, it's discrete  :-)
>
> (Actually, that's the answer. Read up on the Mann-Whitney test to see why).
>
> -- Bert
>
> Thanks.
>> Jun

To expand on Bert's reply:

Given two sets of 3 numbers (x,y,z), (X,Y,Z) with x < y < z
and X < Y < Z, there are exactly 20 ways to merge them together
(according to possible relationships between the values in the
first and the second):

  x < y < z < X < Y < Z
  x < y < X < z < Y < Z
  x < y < X < Y < z < Z
  x < y < X < Y < Z < z
  [and so on until]
  X < Y < x < Z < y < z
  X < Y < Z < x < y < z

Your example  is the first of these so has probability 1/20.
Since the default for wilcox.test is "two.sided", the result
takes into account also arrangements which are at least as
extreme as the one given, of which the only case is the last
one in the above list, which also has probability 1/20.

Hence the 2-sided P-value is 1/20 + 1/20 = 1/10, which is
exactly 0.1, as returned by wilcox.test(). It would be possible
to display the result as 0.10000, say, but there is no point!

If you do

  wilcox.test(a,b, alternative="less")

then you will get 0.05 as P-value -- again exactly right.

Ted.

-------------------------------------------------
E-Mail: (Ted Harding) <[hidden email]>
Date: 16-Feb-2012  Time: 18:57:08
This message was sent by XFMail

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Wilcoxon test p value with one decimal place

Nordlund, Dan (DSHS/RDA)
In reply to this post by Jun Shen-3
> -----Original Message-----
> From: [hidden email] [mailto:r-help-bounces@r-
> project.org] On Behalf Of Jun Shen
> Sent: Thursday, February 16, 2012 10:16 AM
> To: R-help
> Subject: [R] Wilcoxon test p value with one decimal place
>
> Dear list,
>
> Let's say I have data
>
>  a=c(37.961,38.214,57.68)
>  b=c(77.56,61.875,67.683)
>
> wilcox.test(a,b)
>
> the wilcoxon test only gives me a p value with one decimal place. Is
> this
> normal? Thanks.
>
> Jun
>

Well, it depends on what your p-value is.  If you try

w <- wilcox.test(a,b)
print(w$p.value, digits=20)

you will see that it is a rounding / printing issue


Hope this is helpful,

Dan

Daniel J. Nordlund
Washington State Department of Social and Health Services
Planning, Performance, and Accountability
Research and Data Analysis Division
Olympia, WA 98504-5204


______________________________________________
[hidden email] 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.
Loading...