Re: [Rd] p.adjust; n > length(p) (PR#13519)

From: Steven McKinney <smckinney_at_bccrc.ca>
Date: Wed, 11 Feb 2009 12:13:17 -0800


Hi Ludo,

Issues such as this are best posed as
questions to the list before filing a bug report. (False bug reports create extra work for volunteer R-core members.)

What is your use case for setting
n larger than length(p) (the default)?

The documentation does say
"n number of comparisons, must be at least length(p); only set this

   (to non-default) when you know what you are doing!"

Because the default
n = length(p)
is not evaluated until n is first needed in the function body ('lazy evaluation') n is by default set to length(p) after NAs
are removed in about line 8 of the function line "stopifnot(n >= length(p))" )

and I'm not finding any problems with the function, even when supplying p-values with NAs.

The documentation also states
"Note that you can set n larger than length(p) which means the unobserved p-values are assumed to be greater than all the observed p for "bonferroni" and "holm" methods and equal to 1 for the other methods."

so it is up to the user to properly interpret the function output when using a non-default setting for n. The ensuing warning is just a warning, not an error, requiring proper interpretation and understanding by the user that chooses to set n to a non-default setting.

> -----Original Message-----
> From: r-devel-bounces_at_r-project.org
[mailto:r-devel-bounces_at_r-project.org]
> On Behalf Of lpagie_at_xs4all.nl
> Sent: Wednesday, February 11, 2009 7:10 AM
> To: r-devel@stat.math.ethz.ch
> Cc: R-bugs_at_r-project.org
> Subject: [Rd] p.adjust; n > length(p) (PR#13519)
>
> Full_Name: Ludo Pagie
> Version: 2.8.1
> OS: linux
> Submission from: (NULL) (194.171.7.39)
>
>
> p.adjust in stats seems to have a bug in handling n>length(p) for (at
> least) the
> methods 'holm' and 'hochberg'.
>
> For method 'holm' the relevant code:
> i <- 1:n
> o <- order(p)
> ro <- order(o)
> pmin(1, cummax((n - i + 1) * p[o]))[ro]
>
> where p is the supplied vector of pvalues and n is the supplied number
of
> comparisons. If n>length(p) p.adjust() gives a warning:
> Warning message:
> In (n - i + 1) * p[o] :
> longer object length is not a multiple of shorter object length
>
> to me it seems that instead of 'i <- 1:n', 'i <- 1:length(p)' is
required.

This is the case if you do not specify n. Lazy evaluation yields n = length(p)

> Similar cases seem to be true for 'hochberg' and possibly other
methods.
>
> (I tried checking whether this bug has been reported but the website
broke
> on
> me. appologies if the bug is known already)
>
> Best, Ludo
>
> Netherlands Cancer Institute
> Gene Regulation (B4)
> van Steensel Group
> Plesmanlaan 121
> 1066 CX Amsterdam
> The Netherlands
>
> Tel.: ++ 20 512 7986
> Fax: ++ 20 669 1383
> email: lpagie_at_xs4all.nl
>
> ______________________________________________
> R-devel_at_r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel

Best

Steven McKinney, Ph.D.

Statistician
Molecular Oncology and Breast Cancer Program British Columbia Cancer Research Centre

email: smckinney_at_bccrc.ca
tel: 604-675-8000 x7561

BCCRC
Molecular Oncology
675 West 10th Ave, Floor 4
Vancouver B.C.
V5Z 1L3

Canada



R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Wed 11 Feb 2009 - 19:21:12 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 11 Feb 2009 - 22:30:22 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.

list of date sections of archive