closed testing with globaltest {ctgt} | R Documentation |
Approximated Closed Testing with Global Test
Description
To detect the significance of the set of features after correcting for multiple global tests, with family-wise error rate controlled.
Usage
actgt (y, X, xs, hyps, maxit = 0, alpha = 0.05)
Arguments
y |
The response vector (numeric vector). |
X |
The full design matrix, whose columns are named by the covariates. |
xs |
The name vector of all covariates (character vector). |
hyps |
The name vector of the covariates in the pathway of interest (character vector). |
maxit |
An optional integer to denote the maximal interations for branch and bound method. The default value 0 means the single-step shortcut without branch and bound method. Note that larger value is more time-consuming. |
alpha |
The type I error rate allowed. The default is 0.05. |
Value
Returns a list of rejection indicator and the number of iterations.
Author(s)
Ningning Xu
Maintainer: Ningning Xu <n.xu@lumc.nl; xu15263142750@gmail.com>
References
Ningning Xu, Aldo solari, Jelle Goeman, Clsoed testing with global test, with applications on metabolomics data, arXiv:2001.01541, https://arxiv.org/abs/2001.01541
Examples
#Generate the design matrix and response vector for logistic regression models
n= 100
m = 5
X = matrix(data = 0, nrow = n, ncol = m,byrow = TRUE )
for ( i in 1:n){
set.seed(1234+i)
X[i,] = as.vector(arima.sim(model = list(order = c(1, 0, 0), ar = 0.2), n = m) )
}
y = rbinom(n,1,0.6)
X[which(y==1),1:3] = X[which(y==1),1:3] + 0.8
xs = paste("x",seq(1,m,1),sep="")
colnames(X) = xs
hyps=xs[1]
#The sinle-step ctgt procedure
actgt(y = y, X = X, xs = xs, hyps = hyps, maxit = 0, alpha = 0.05)
#Result Iterations
#"unsure" "0"
# The iterative ctgt procedure with more iterations
actgt(y = y, X = X, xs = xs, hyps = hyps, maxit = 0, alpha = 0.05)
#Result Iterations
#"reject" "2"
#which means that x1 is rejected by closed testing within two more iterations of the shortcut
# For a group of feature sets
mysets = list(xs[1:5], xs[c(1,4)], xs[c(1,4,5)])
sapply(mysets, function(i) actgt(y = y, X = X, xs = xs, hyps = i, maxit = 0, alpha = 0.05))
#Result "reject" "unsure" "reject"
#Iterations "0" "0" "0"
mysets = list(xs[1:5], xs[c(1,4)], xs[c(1,4,5)])
sapply(mysets, function(i) actgt(y = y, X = X, xs = xs, hyps = i, maxit = 0, alpha = 0.05))
#Result "reject" "reject" "reject"
#Iterations "0" "2" "0"