padjustw: Adjust P-values for Multiple Comparisons

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

Description

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

Usage

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

Arguments

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. p.adjust.w(..., rep(1,length(p))) produces the same results as in p.adjust(...) (i.e. the unweighted counterpart).

Value

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.

Author(s)

Livio Finos

References

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.

See Also

p.adjust

Examples

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

someMTP documentation built on March 1, 2021, 9:06 a.m.