eval.ROC: Evaluate ROC and AUC

Description Usage Arguments Value Examples

View source: R/eval.ROC.R

Description

This function performs ROC analysis for network estimation based on the ROCR package.

Usage

1
eval.ROC(est.str, true.str, plot.ROC=TRUE, show.AUC=TRUE, zoom=FALSE, lightPDF=FALSE, ...)

Arguments

est.str

symmetric matrix or array of symmetric matrices of estimated network structure, with elements taking values form 0 to 1 which measures the possibility of being an edge. It should have the same dimension as true.str.

true.str

symmetric matrix or array of symmetric matrices of true structure, usually with binary elements of 1 = edge and 0 = no edge. It should have the same dimension as est.str.

plot.ROC

logical value indicating if to plot the ROC curve. Default: TRUE.

show.AUC

logical value indicating if to show AUC on the plot. Default: TRUE.

zoom

logical value indicating if to zoom-in the plot. Default: FALSE.

lightPDF

logical value indicating if to subsample points for plotting in a PDF. Default: FALSE.

...

arguments passed to plot().

Value

A list with the following components:

perf

object of performence-class.

AUC

numeric value of the AUC statistic.

xval

maximum value plotted in the x-axis.

yval

maximum value plotted in the y-axis.

Examples

 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
## Firstly, let's generate some data.
set.seed(999)
data("celltype")
mu.T <- expr[,ctab$Fastq_file_name[which(ctab$X3_letter_code=="ASM")]]
mu.N <- expr[,ctab$Fastq_file_name[which(ctab$X3_letter_code=="AEC")]]
## number of samples to simulate
n.samp <- 5
## parameters for correlation design of cell type T
rho <- c(0.9,0.8,0.7)
block.size <- c(5,10,15)
str.type <- c("interchangeable","decaying","star")
## one-step simulation
out.oneStepSim <- oneStepSim(n.samp, mu.T, mu.N, rho=rho, block.size=block.size, str.type=str.type)

## If we consider correlation network
est.str.pure <- abs(cor(t(out.oneStepSim$expr.pure.T)))
est.str.mixed <- abs(cor(t(out.oneStepSim$expr.mixed)))
## the true structure in cell type T should be
true.str <- out.oneStepSim$true.str.T

## ROC analysis
out.ROC.pure <- eval.ROC(est.str=est.str.pure, true.str=true.str, plot.ROC=TRUE, main="Pure samples")
out.ROC.pure$AUC
out.ROC.mixed <- eval.ROC(est.str=est.str.mixed, true.str=true.str, plot.ROC=TRUE, main="Mixed samples")
out.ROC.mixed$AUC

yunzhang813/simDeNet-R-Package documentation built on Dec. 24, 2019, 3:02 p.m.