Description Usage Arguments Details Value Examples
These functions provide an uniform interface to three existing methods: SVA, RUV, LEAPP The wrapper functions transform the data into desired forms and call the corresponding functions in the package sva, ruv, leapp
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | sva.wrapper(
formula,
X.data = NULL,
Y,
r,
sva.method = c("irw", "two-step"),
B = 5
)
ruv.wrapper(
formula,
X.data = NULL,
Y,
r,
nc,
lambda = 1,
ruv.method = c("RUV2", "RUV4", "RUVinv")
)
leapp.wrapper(
formula,
X.data = NULL,
Y,
r,
search.tuning = F,
ipod.method = c("hard", "soft")
)
|
formula |
a formula indicating the known covariates including both primary variables and nuisance variables, which are seperated by |
X.data |
the data frame used for |
Y |
outcome, n*p matrix |
r |
number of latent factors, can be estimated using the function |
sva.method |
parameter for |
B |
parameter for |
nc |
parameter for ruv functions: position of the negative controls |
lambda |
parameter for |
ruv.method |
either using |
search.tuning |
logical parameter for |
ipod.method |
parameter for |
The beta.p.values
returned is a length p
vector, each for the overall effects of all the primary variables.
Only 1 variable of interest is allowed for leapp.wrapper
. The method can be slow.
All functions return beta.p.value
which are the p-values after adjustment.
For the other returned objects, refer to cate for their meaning.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | ## this is the simulation example in Wang et al. (2015).
n <- 100
p <- 1000
r <- 2
set.seed(1)
data <- gen.sim.data(n = n, p = p, r = r,
alpha = rep(1 / sqrt(r), r),
beta.strength = 3 * sqrt(1 + 1) / sqrt(n),
Gamma.strength = c(seq(3, 1, length = r)) * sqrt(p),
Sigma = 1 / rgamma(p, 3, rate = 2),
beta.nonzero.frac = 0.05)
X.data <- data.frame(X1 = data$X1)
sva.results <- sva.wrapper(~ X1 | 1, X.data, data$Y,
r = r, sva.method = "irw")
ruv.results <- ruv.wrapper(~ X1 | 1, X.data, data$Y, r = r,
nc = sample(data$beta.zero.pos, 30), ruv.method = "RUV4")
leapp.results <- leapp.wrapper(~ X1 | 1, X.data, data$Y, r = r)
cate.results <- cate(~ X1 | 1, X.data, data$Y, r = r)
## p-values after adjustment
par(mfrow = c(2, 2))
hist(sva.results$beta.p.value)
hist(ruv.results$beta.p.value)
hist(leapp.results$beta.p.value)
hist(cate.results$beta.p.value)
## type I error
mean(sva.results$beta.p.value[data$beta.zero.pos] < 0.05)
## power
mean(sva.results$beta.p.value[data$beta.nonzero.pos] < 0.05)
## false discovery proportion for sva
discoveries.sva <- which(p.adjust(sva.results$beta.p.value, "BH") < 0.2)
fdp.sva <- length(setdiff(discoveries.sva, data$beta.nonzero.pos)) / max(length(discoveries.sva), 1)
fdp.sva
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.