Title: | Receiver Operating Characteristic Based Signature Identification |
---|---|
Description: | Optimal linear combination predictive signatures for maximizing the area between two Receiver Operating Characteristic (ROC) curves (treatment vs. control). |
Authors: | Xin Huang [aut, cre, cph] |
Maintainer: | Xin Huang <[email protected]> |
License: | GPL (>= 2) |
Version: | 0.1.0 |
Built: | 2024-12-04 07:07:03 UTC |
Source: | CRAN |
Empirical AUC estimate
AUC(outcome, predict)
AUC(outcome, predict)
outcome |
binary outcome (1: desired outcome; 0: otherwise) |
predict |
prediction score |
Function for AUC when input is X and Y.
a numeric value of empirical estimation of area under the ROC curves
# no run
# no run
Function to translate beta into theta, the n-sphere constrain
beta2theta(beta)
beta2theta(beta)
beta |
estimates of coefficient beta |
Function to translate beta into theta, the n-sphere constrain
a numeric vector for theta (dimension-1)
# no run
# no run
Empirical c-index estimate
C.index(yvar, score, censorvar, data)
C.index(yvar, score, censorvar, data)
yvar |
column name for observed time |
score |
column name for marker value |
censorvar |
column name for censor (1 is event, 0 is censored) |
data |
input data matrix |
Function for c-index when input is X and Y.
a numeric value of empirical estimation of c-index
# no run
# no run
internal function for generating CV fold index
cvfolds0(X, Y, idx, nfolds = 5)
cvfolds0(X, Y, idx, nfolds = 5)
X |
marker matrix for non-responders |
Y |
marker matrix for responders |
idx |
m*n by 2 matrix for row index of marker matrix, first column is row index in X; second column is for Y |
nfolds |
the cross-validation folds |
Function for generate CV fold index
a vector containing CV fold index for each row in Z
# no run
# no run
Function for simulated data generation
data.gen( n, k, prevalence = sqrt(0.5), prog.eff = 1, sig2, y.sig2, rho, rhos.bt.real, a.constent )
data.gen( n, k, prevalence = sqrt(0.5), prog.eff = 1, sig2, y.sig2, rho, rhos.bt.real, a.constent )
n |
Total sample size |
k |
Number of markers |
prevalence |
prevalence of predictive biomarkers with values above the cutoff |
prog.eff |
effect size |
sig2 |
standard deviation of each marker |
y.sig2 |
Standard Deviation of the error term in the linear component |
rho |
rho*sig2 is the entries for covariance matrix between pairs of different k markers |
rhos.bt.real |
correlation between each prognostic and predictive markers |
a.constent |
a constant is set such that there is no overall treatment effect |
Function for simulated data generation
A list of simulated clinical trial data with heterogeneous prognostic and predictive biomarkers
n <- 500 k <- 10 prevalence <- sqrt(0.5) rho<-0.2 sig2 <- 2 rhos.bt.real <- c(0, rep(0.1, (k-3)))*sig2 y.sig2 <- 1 prog.eff <- 0.5 effect.size <- 1 a.constent <- effect.size/(2*(1-prevalence)) ObsData <- data.gen(n=n, k=k, prevalence=prevalence, prog.eff=prog.eff, sig2=sig2, y.sig2=y.sig2, rho=rho, rhos.bt.real=rhos.bt.real, a.constent=a.constent)
n <- 500 k <- 10 prevalence <- sqrt(0.5) rho<-0.2 sig2 <- 2 rhos.bt.real <- c(0, rep(0.1, (k-3)))*sig2 y.sig2 <- 1 prog.eff <- 0.5 effect.size <- 1 a.constent <- effect.size/(2*(1-prevalence)) ObsData <- data.gen(n=n, k=k, prevalence=prevalence, prog.eff=prog.eff, sig2=sig2, y.sig2=y.sig2, rho=rho, rhos.bt.real=rhos.bt.real, a.constent=a.constent)
Internal function of grad_square in the GCV
grad.sub(z, beta)
grad.sub(z, beta)
z |
(m x n) x p data matrix as prepared for ROCSI |
beta |
estimates of coefficient beta |
Internal function of grad_square in the GCV
grad_square in the GCV
# no run
# no run
Internal function for HIC calculation
gradsqr(beta, Z0, index, w = 1)
gradsqr(beta, Z0, index, w = 1)
beta |
estimates of coefficient beta |
Z0 |
(m x n) x p Z matrix as prepared for ROCSI |
index |
m*n by 2 matrix for the subindex for the pair difference in Z |
w |
a vector of weights Z (can be used for inverse probability weighting for missing data, default is 1) |
Internal function for HIC calculation
gradient square for the GCV.
# no run
# no run
function for Hessian matrix of AUC
hessAUC(beta, Z, w = 1)
hessAUC(beta, Z, w = 1)
beta |
estimates of coefficient beta |
Z |
(m x n) x p data matrix as prepared for ROCSI |
w |
a vector of weights Z (can be used for inverse probability weighting for missing data, default is 1) |
function for Hessian matrix of AUC
Hessian matrix of AUC.
# no run
# no run
Internal function for hessAUC
hessAUC.sub(z, beta)
hessAUC.sub(z, beta)
z |
(m x n) x p data matrix as prepared for ROCSI |
beta |
estimates of coefficient beta |
Internal function for hessAUC
Hessian matrix components.
# no run
# no run
function for HIC calculation
HIC(beta, Z, index, w = 1)
HIC(beta, Z, index, w = 1)
beta |
estimates of coefficient beta |
Z |
matrix prepared for ROCSI |
index |
m*n by 2 matrix for the subindex for the pair difference in Z |
w |
a vector of weights Z (can be used for inverse probability weighting for missing data, default is 1) |
Function for HIC calculation
A numeric value with corresponding HIC
# no run
# no run
function for modified covariate methods based on glmnet
MClogit( dataset, yvar, xvars, trtvar, cvar = NULL, nfolds = 5, type = "binary", newx = NULL, bestsub = "lambda.1se", type.measure = "auc" )
MClogit( dataset, yvar, xvars, trtvar, cvar = NULL, nfolds = 5, type = "binary", newx = NULL, bestsub = "lambda.1se", type.measure = "auc" )
dataset |
data matrix for training dataset |
yvar |
column name for outcome |
xvars |
a string vector of column names for input markers |
trtvar |
column name for treatment (the column should contain binary code with 1 being treatment and 0 being control) |
cvar |
column name for censor (the column should contain binary code with 1 being event and 0 being censored) |
nfolds |
n fold CV used for cv.glmnet |
type |
outcome type ("binary" for binary outcome and "survival" for time-to-event outcome) |
newx |
data matrix for testing dataset X |
bestsub |
criteria for best lambda, used by glmnet |
type.measure |
type of measure used by glmnet |
function for ROCSI
A list with ROCSI output
final beta estimated from MClogit
a data.frame of testing data and its predictive signature scores (based on beta.aABC) for each subjects
ABC in testing dataset based on optimal beta
the fitted glmnet object
n <- 100 k <- 5 prevalence <- sqrt(0.5) rho<-0.2 sig2 <- 2 rhos.bt.real <- c(0, rep(0.1, (k-3)))*sig2 y.sig2 <- 1 yvar="y.binary" xvars=paste("x", c(1:k), sep="") trtvar="treatment" prog.eff <- 0.5 effect.size <- 1 a.constent <- effect.size/(2*(1-prevalence)) ObsData <- data.gen(n=n, k=k, prevalence=prevalence, prog.eff=prog.eff, sig2=sig2, y.sig2=y.sig2, rho=rho, rhos.bt.real=rhos.bt.real, a.constent=a.constent) TestData <- data.gen(n=n, k=k, prevalence=prevalence, prog.eff=prog.eff, sig2=sig2, y.sig2=y.sig2, rho=rho, rhos.bt.real=rhos.bt.real, a.constent=a.constent) bst.mod <- MClogit(dataset=ObsData$data, yvar=yvar, xvars=xvars, trtvar=trtvar, nfolds = 5, newx=TestData$data, type="binary", bestsub="lambda.1se") bst.mod$abc bst.mod$x.logit[-1,1]
n <- 100 k <- 5 prevalence <- sqrt(0.5) rho<-0.2 sig2 <- 2 rhos.bt.real <- c(0, rep(0.1, (k-3)))*sig2 y.sig2 <- 1 yvar="y.binary" xvars=paste("x", c(1:k), sep="") trtvar="treatment" prog.eff <- 0.5 effect.size <- 1 a.constent <- effect.size/(2*(1-prevalence)) ObsData <- data.gen(n=n, k=k, prevalence=prevalence, prog.eff=prog.eff, sig2=sig2, y.sig2=y.sig2, rho=rho, rhos.bt.real=rhos.bt.real, a.constent=a.constent) TestData <- data.gen(n=n, k=k, prevalence=prevalence, prog.eff=prog.eff, sig2=sig2, y.sig2=y.sig2, rho=rho, rhos.bt.real=rhos.bt.real, a.constent=a.constent) bst.mod <- MClogit(dataset=ObsData$data, yvar=yvar, xvars=xvars, trtvar=trtvar, nfolds = 5, newx=TestData$data, type="binary", bestsub="lambda.1se") bst.mod$abc bst.mod$x.logit[-1,1]
internal function for generating Z matrix (binary endpoint)
pair.diff(X, Y, A)
pair.diff(X, Y, A)
X |
marker matrix for non-responders |
Y |
marker matrix for responders |
A |
Treatment arm indicator (1 is treatment, 0 is control) |
Function for generate Z matrix for binary endpoint
A list of prepared data input for ROCSI
# no run
# no run
internal function for generating Z matrix (time-to-event endpoint)
pair.diff.surv(X, Y, A, C)
pair.diff.surv(X, Y, A, C)
X |
marker matrix |
Y |
a vector for observed time |
A |
a vector for Treatment arm indicator (1 is treatment, 0 is control) |
C |
a vector for censor (1 is event, 0 is censored) |
Function for generate Z matrix for time-to-event endpoint
A list of prepared data input for ROCSI
# no run
# no run
function for ROCSI
ROCSI( Dtrain, Dtest = NULL, yvar, xvars, trtvar, cvar = NULL, nfolds = 5, type = "binary" )
ROCSI( Dtrain, Dtest = NULL, yvar, xvars, trtvar, cvar = NULL, nfolds = 5, type = "binary" )
Dtrain |
data matrix for training dataset |
Dtest |
optional data matrix for testing dataset |
yvar |
column name for outcome |
xvars |
a string vector of column names for input markers |
trtvar |
column name for treatment (the column should contain binary code with 1 being treatment and 0 being control) |
cvar |
column name for censor (the column should contain binary code with 1 being event and 0 being censored) |
nfolds |
n fold CV used for cv.glmnet |
type |
outcome type ("binary" for binary outcome and "survival" for time-to-event outcome) |
function for ROCSI
A list with ROCSI output
final beta estimated from ROCSI based on
final beta estimated from lambda.1se based on nfold CV
optimal lambda selected by optimizing
fitted cv.glmnet model
log matrix of all lambdas and ABCs
ABC in testing dataset based on optimal beta
ABC in testing dataset based on 1se beta
a data.frame of testing data and its predictive signature scores (based on beta.aABC) for each subjects
a data.frame of testing data and its predictive signature scores (based on beta.1se) for each subjects
n <- 100 k <- 5 prevalence <- sqrt(0.5) rho<-0.2 sig2 <- 2 rhos.bt.real <- c(0, rep(0.1, (k-3)))*sig2 y.sig2 <- 1 yvar="y.binary" xvars=paste("x", c(1:k), sep="") trtvar="treatment" prog.eff <- 0.5 effect.size <- 1 a.constent <- effect.size/(2*(1-prevalence)) ObsData <- data.gen(n=n, k=k, prevalence=prevalence, prog.eff=prog.eff, sig2=sig2, y.sig2=y.sig2, rho=rho, rhos.bt.real=rhos.bt.real, a.constent=a.constent) TestData <- data.gen(n=n, k=k, prevalence=prevalence, prog.eff=prog.eff, sig2=sig2, y.sig2=y.sig2, rho=rho, rhos.bt.real=rhos.bt.real, a.constent=a.constent) bst.aabc <- ROCSI(Dtrain=ObsData$data, Dtest = TestData$data, yvar=yvar, xvars=xvars, trtvar=trtvar, cvar=NULL, nfolds=5, type="binary") bst.aabc$beta.aABC bst.aabc$log bst.aabc$abc.test bst.aabc$beta.1se bst.aabc$abc.test1se
n <- 100 k <- 5 prevalence <- sqrt(0.5) rho<-0.2 sig2 <- 2 rhos.bt.real <- c(0, rep(0.1, (k-3)))*sig2 y.sig2 <- 1 yvar="y.binary" xvars=paste("x", c(1:k), sep="") trtvar="treatment" prog.eff <- 0.5 effect.size <- 1 a.constent <- effect.size/(2*(1-prevalence)) ObsData <- data.gen(n=n, k=k, prevalence=prevalence, prog.eff=prog.eff, sig2=sig2, y.sig2=y.sig2, rho=rho, rhos.bt.real=rhos.bt.real, a.constent=a.constent) TestData <- data.gen(n=n, k=k, prevalence=prevalence, prog.eff=prog.eff, sig2=sig2, y.sig2=y.sig2, rho=rho, rhos.bt.real=rhos.bt.real, a.constent=a.constent) bst.aabc <- ROCSI(Dtrain=ObsData$data, Dtest = TestData$data, yvar=yvar, xvars=xvars, trtvar=trtvar, cvar=NULL, nfolds=5, type="binary") bst.aabc$beta.aABC bst.aabc$log bst.aabc$abc.test bst.aabc$beta.1se bst.aabc$abc.test1se
Function to translate theta into beta
theta2beta(theta)
theta2beta(theta)
theta |
n-sphere coordination |
Function to translate beta into theta, the n-sphere constrain
a numeric vector for beta (dimension+1)
# no run
# no run