[R] Adjusting p values of a matrix

January Weiner january.weiner at mpiib-berlin.mpg.de
Tue Apr 5 11:57:14 CEST 2011


>        as.matrix(p.adjust(as.dist(pmat)))

Perfect! Thanks.

j.

>
>
> Benno
>
> On 4.Apr.2011, at 17:02, January Weiner wrote:
>
>> Dear all,
>>
>> I have an n x n matrix of p-values. The matrix is symmetrical, as it
>> describes the "each against each" p values of correlation
>> coefficients.
>>
>> How can I best correct the p values of the matrix? Notably, the total
>> number of the tests performed is n(n-1)/2, since I do not test the
>> correlation of each variable with itself. That means, I only want to
>> correct one half of the matrix, not including the diagonal. Therefore,
>> simply writing
>>
>> pmat <- p.adjust( pmat, method= "fdr" )
>> # where pmat is an n x n matrix
>>
>> ...doesn't cut it.
>>
>> Of course, I can turn the matrix in to a three column data frame with
>> n(n-1)/2 rows, but that is slow and not elegant.
>>
>> regards,
>> j.
>>
>> --
>> -------- Dr. January Weiner 3 --------------------------------------
>> Max Planck Institute for Infection Biology
>> Charitéplatz 1
>> D-10117 Berlin, Germany
>> Web   : www.mpiib-berlin.mpg.de
>> Tel     : +49-30-28460514
>>
>> ______________________________________________
>> R-help at 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.
>>
>
>



-- 
-------- Dr. January Weiner 3 --------------------------------------
Max Planck Institute for Infection Biology
Charitéplatz 1
D-10117 Berlin, Germany
Web   : www.mpiib-berlin.mpg.de
Tel     : +49-30-28460514



More information about the R-help mailing list