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

lpagie at xs4all.nl lpagie at xs4all.nl
Wed Feb 11 16:10:09 CET 2009


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.
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



More information about the R-devel mailing list