# 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