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

From: <lpagie_at_xs4all.nl>
Date: Wed, 11 Feb 2009 16:10:09 +0100 (CET)

Full_Name: Ludo Pagie
Version: 2.8.1
OS: linux
Submission from: (NULL) (

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. 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 Received on Wed 11 Feb 2009 - 14:19:20 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 - 20: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