# Simple examples with random data here
# Real data examples in the Vignette
# Random data: covariates A,B,C are correlated with Y
set.seed(1)
Y <- rnorm(20)
X <- matrix(rnorm(200), 20, 10)
X[,1:3] <- X[,1:3] + Y
colnames(X) <- LETTERS[1:10]
# Some subsets of interest
my.sets1 <- list(abc = LETTERS[1:3], cde = LETTERS[3:5],
fgh = LETTERS[6:8], hij = LETTERS[8:10])
res <- gt(Y, X, subsets = my.sets1)
# Simple multiple testing
p.adjust(res)
p.adjust(res, "BH")
# A whole structure of sets
my.sets2 <- as.list(LETTERS[1:10])
names(my.sets2) <- letters[1:10]
my.sets3 <- list(all = LETTERS[1:10])
my.sets <- c(my.sets2,my.sets1,my.sets3)
# Do the focus level procedure
# Choose a focus level by hand
my.focus <- c("abc","cde","fgh","hij")
# Or automated
my.focus <- findFocus(my.sets, maxsize = 8)
resF <- focusLevel(res, sets = my.sets, focus = my.focus)
leafNodes(resF, alpha = .1)
# Compare
p.adjust(resF, "holm")
# Focus level with a custom test
Ftest <- function(set) anova(lm(Y~X[,set]))[["Pr(>F)"]][1]
focusLevel(Ftest, sets=my.sets, focus=my.focus)
# analyze data using inheritance procedure
res <- gt(Y, X, subsets = list(colnames(X)))
# define clusters on the covariates X
hcl=hclust(dist(t(X)))
# Do inheritance procedure
resI=inheritance(res, sets = hcl)
resI
leafNodes(resI, alpha = .1)
# inheritance procedure with a custom test
inheritance(Ftest, sets = hcl, Shaffer=TRUE)
Run the code above in your browser using DataLab