## Single data set
data(gse4335)
data(gse4335pheno)
#And run the following script:
#iter.crossval(gse4335, gse4335pheno[,6], gse4335pheno[,5])
## To observe the frequency of the CYB5D1 gene selection, run the following script:
#iter.crossval(gse4335, gse4335pheno[,6], gse4335pheno[,5], gn.nb =1, gn.nb.display = 1)
## Merged data set
data(gse4335)
data(gse4335pheno)
data(gse1992)
data(gse1992pheno)
common.gene = intersect(colnames(gse4335), colnames(gse1992))
data = rbind(gse4335[,common.gene], gse1992[,common.gene])
surv = c(gse4335pheno[,6],gse1992pheno[,19])
censor = c(gse4335pheno[,5],gse1992pheno[,18])
#And run the following script:
#iter.crossval(data, surv,censor, zscore=1)
## The function is currently defined as
function(data,surv,censor,ngroup=10,plot.roc=0,method="none",zscore=0,gn.nb=100,gn.nb.display=0){
require(survival)
require(survivalROC)
res = NULL
file.name=deparse(substitute(data))
if (plot.roc)
init.plot(file.name)
data =data[!is.na(surv),]
censor= censor[!is.na(surv)]
surv= surv[!is.na(surv)]
cat ("Iteration\tAUC\tHR(CI)\t\tP-val\n")
for (i in 1:ngroup){
new.lst = cross.val.surv(data, surv, censor,ngroup, i, method, zscore,
gn.nb,gn.nb.display,plot.roc,p.list)
res = rbind (res, new.lst)
}
if(ngroup != length(surv)){
cat ("Avg AUC+/-SD\tHR(CI)\n")
if (plot.roc)
legend (0.55,0.1, legend = paste("AUC+/-SD =", sprintf("%.2f",
as.numeric(mean(res[,1],na.rm = T))), "+/-", sprintf("%.2f",
sd (res[,1],na.rm = T)), sep = " "),bty = "n")
cat (sprintf("%.2f",as.numeric(mean(res[,1], na.rm = T))), "+/-",
sprintf("%.2f",sd (res[,1],na.rm = T)), "\t", gm(res[,2]),
"(", sprintf("%.2f",ci.gm(res[,2])[1]), "-", sprintf("%.2f",
ci.gm(res[,2])[2]), ")\n", sep = "")
}
}
Run the code above in your browser using DataLab