hiertest (version 1.1)

estimate.fdr: Estimate FDR

Description

Estimates False Discovery Rate (FDR) based on permutation scheme described in CHT paper (reference below).

Usage

estimate.fdr(x, y, lamlist, type = c("Fisher", "simple"), B = 100)

Arguments

x
n by p design matrix
y
binary (0 or 1) vector of length n indicating class
lamlist
a vector of cutoffs for the statistics
type
determines whether Fisher transform should be applied to interaction contrasts. Default: Fisher. See hiertest for more information.
B
number of permutations

Value

A estfdr object, which consists of
ncalled:
number of interactions called significant at each cutoff. Set to NA if 0.
null.ncalled:
total number, across all permutations, of (null) interactions rejected at each cutoff
fdr:
estimate of fdr for each cutoff in lamlist. Set to NA if no interactions are rejected at this cutoff

References

Bien, Simon, and Tibshirani (2015) Convex Hierarchical Testing of Interactions. Annals of Applied Statistics. Vol. 9, No. 1, 27-42.

See Also

hiertest

Examples

Run this code
# generate some data accoring to the backward model:
set.seed(1)
n <- 200
p <- 50
y <- rep(0:1, each=n/2)
x <- matrix(rnorm(n*p), n, p)
colnames(x) <- c(letters,LETTERS)[1:p]
# make some interactions between several pairs of variables:
R <- matrix(0.3, 5, 5)
diag(R) <- 1
x[y==1, 1:5] <- x[y==1, 1:5] %*% R
# and a main effect for variables 1 and 3:
x[y==1, 1:5] <- x[y==1, 1:5] + 0.5
testobj <- hiertest(x=x, y=y, type="Fisher")
# look at test statistics
print(testobj)
plot(testobj)
## Not run: 
# lamlist <- seq(5, 2, length=100)
# estfdr <- estimate.fdr(x, y, lamlist, type="Fisher", B=200)
# plot(estfdr)
# print(estfdr)
# # the cutoff lamlist[70] is estimated to have roughly 10% FDR:
# estfdr$fdr[70]
# # this allows us to reject this many interactions:
# nrejected <- estfdr$ncalled[70]
# # These are the interactions rejected:
# interactions.above(testobj, lamlist[70])
# ## End(Not run)

Run the code above in your browser using DataLab