Description Usage Arguments Value References Examples
This function uses R package ROCR to plot ROC curves for iRafNet object.
1 | roc_curve(out, truth)
|
out |
Output from iRafNet. |
truth |
Matrix of true regulations. Rows correspond to different regulations and match rows of |
Plot ROC curve and return area under ROC curve.
Petralia, F., Wang, P., Yang, J., Tu, Z. (2015) Integrative random forest for gene regulatory network inference, Bioinformatics, 31, i197-i205.
Sing, Tobias, et al. (2005) ROCR: visualizing classifier performance in R, Bioinformatics, 21, 3940-3941.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | # --- Generate data sets
n<-20 # sample size
p<-5 # number of genes
genes.name<-paste("G",seq(1,p),sep="") # genes name
data<-matrix(rnorm(p*n),n,p) # generate expression matrix
data[,1]<-data[,2] # var 1 and 2 interact
W<-abs(matrix(rnorm(p*p),p,p)) # generate score for regulatory relationships
# --- Standardize variables to mean 0 and variance 1
data <- (apply(data, 2, function(x) { (x - mean(x)) / sd(x) } ))
# --- Run iRafNet and obtain importance score of regulatory relationships
out<-iRafNet(data,W,mtry=round(sqrt(p-1)),ntree=1000,genes.name)
# --- Matrix of true regulations
truth<-out[,seq(1,2)]
truth<-cbind(as.character(truth[,1]),as.character(truth[,2])
,as.data.frame(rep(0,,dim(out)[1])));
truth[(truth[,1]=="G2" & truth[,2]=="G1") | (truth[,1]=="G1" & truth[,2]=="G2"),3]<-1
# --- Plot ROC curve and compute AUC
auc<-roc_curve(out,truth)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.