Description Usage Arguments Value Author(s) References See Also Examples

Given a set of p-values, returns p-values adjusted using one of several (weighted) methods.
It extends the method of `p.adjust{stats}`

1 | ```
p.adjust.w(p, method = c("bonferroni","holm","BHfwe","BH","BY"), n = length(p),w=NULL)
``` |

`p` |
vector of p-values (possibly with NAs) |

`method` |
correction method |

`n` |
number of comparisons, must be at least length(p); only set this (to non-default) when you know what you are doing! |

`w` |
weigths to be used. |

A vector of corrected p-values (same length as p) having two attributes: `attributes(...)$w`

is the vecotr of used weights and `attributes(...)$method`

is the method used.

Livio Finos

Benjamini, Hochberg (1997). Multiple hypotheses testing with weights. Scand. J. Statist. 24, 407-418.

Finos, Salmaso (2007). FDR- and FWE-controlling methods using data-driven weights. Journal of Statistical Planning and Inference, 137,12, 3859-3870.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | ```
set.seed(13)
y <- matrix(rnorm(5000),5,1000) #create toy data
y[,1:100] <- y[,1:100]+3 #create toy data
p <- apply(y,2,function(y) t.test(y)$p.value) #compute p-values
M2 <- apply(y^2,2,mean) #compute ordering criterion
fdr <- p.adjust(p,method="BH") #(unweighted) procedure, fdr control
sum(fdr<.05)
fdr.w <- p.adjust.w(p,method="BH",w=M2) #weighted procedure, weighted fdr control
sum(fdr.w<.05)
fwer <- p.adjust(p,method="holm") #(unweighted) procedure, fwer control
sum(fwer<.05)
fwer.w <- p.adjust.w(p,method="BHfwe",w=M2) #weighted procedure, weighted fwer (=fwer) control
sum(fwer.w<.05)
plot(M2,-log10(p))
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.