PRcurve: PR curves computation

Description Usage Arguments Value Author(s) See Also Examples

Description

Given a score matrix and a validation matrix, this function allows to compute the corresponding Precision-Recall (PR) curve by returning a list with the respective x coordinates (recall) and y coordinates (precision) of the PR curve. The recall is equal to the sensitivity, that is the number of true positive out of the number of true edges to de detected. The precision is the Positive Predictive Value, that is the number of true positive edges out of the number of selected edges. The score matrix has been computed from a network inference algorithm (e.g. DBNScoreStep1 or DBNScoreStep2, Shrinkage, Lasso, ...).

Usage

1
PRcurve(score,validMat,dec=FALSE)

Arguments

score

matrix with r rows (=target genes) and d columns (=predictor genes) containing the scores resulting from an estimation procedure (e.g. DBNScoreStep1 or DBNScoreStep2, Shrinkage, Lasso, ...).

validMat

An optional matrix specifying the validated edges (1 if an edge is validated, 0 otherwise).

dec

boolean, FALSE if the smallest score points out the most significant edge, default=FALSE.

Value

A list with out$recall and out$precision containing respctively the recall values (x coordinates of the PR curve) and the precision values (y coordinates).

Author(s)

Lebre Sophie (http://icube-bfo.unistra.fr/en/index.php/Sophie_Lebre),

Chiquet Julien (http://stat.genopole.cnrs.fr/~jchiquet).

See Also

DBNScoreStep1, DBNScoreStep2, ROCcurve.

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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
library(G1DBN)
## generate the validation matrix
## number of genes
p <- 20
## the network - adjacency Matrix
MyNet <- SimulNetworkAdjMatrix(p,0.05,c(-1,0.5,0.5,1))

## generate the time series 
## initializing the B vector
B <- runif(p,-1,1)
## initializing the variance of the noise
sigmaEps <- runif(p,0.05,0.5)
## initializing the process Xt
X0 <- B + rnorm(p,0,sigmaEps*10)
## number of time points
n <- 20


## the AR(1) times series process
Xn <- SimulGeneExpressionAR1(MyNet$A,B,X0,sigmaEps,n)


## compute score S1 
out<-DBNScoreStep1(Xn)
pr1<-PRcurve(score=out$S1ls,validMat=abs(MyNet$AdjMatrix)>0,dec=FALSE)

## compute score S2 from S1 
## depending on the generated data, the threshold alpha1 has to be chosen differently.
alpha1=0.8
S2<-DBNScoreStep2(S1=out$S1ls,data=Xn,alpha1=alpha1)
pr2_0.8<-PRcurve(score=S2,validMat=abs(MyNet$AdjMatrix)>0,dec=FALSE)

alpha1=0.6
S2<-DBNScoreStep2(S1=out$S1ls,data=Xn,alpha1=alpha1)
pr2_0.6<-PRcurve(score=S2,validMat=abs(MyNet$AdjMatrix)>0,dec=FALSE)

alpha1=0.4
S2<-DBNScoreStep2(S1=out$S1ls,data=Xn,alpha1=alpha1)
pr2_0.4<-PRcurve(score=S2,validMat=abs(MyNet$AdjMatrix)>0,dec=FALSE)

alpha1=0.2
S2<-DBNScoreStep2(S1=out$S1ls,data=Xn,alpha1=alpha1)
pr2_0.2<-PRcurve(score=S2,validMat=abs(MyNet$AdjMatrix)>0,dec=FALSE)

plot(pr1$recall,pr1$precision,type="l",main="PR curves after both Step1 and Step2",
     ylab="PPV", xlab="Sensitivity",lwd=2, xlim=c(0,1),ylim=c(0,1),lty=2)
lines(pr2_0.8$recall,pr2_0.8$precision, col=3,lwd=2)
lines(pr2_0.6$recall,pr2_0.6$precision, col=4,lwd=2)
lines(pr2_0.4$recall,pr2_0.4$precision, col=5,lwd=2)
lines(pr2_0.2$recall,pr2_0.2$precision, col=6,lwd=2)
lines(0:1,c(0,0),lty=3)
lines(0:1,c(1,1),lty=3)
lines(c(0,0),0:1,lty=3)
lines(c(1,1),0:1,lty=3)

leg=c("Step 1", "Step 2 (alpha1=0.8)", "Step 2 (alpha1=0.6)",
      "Step 2 (alpha1=0.4)", "Step 2 (alpha1=0.2)")
legend(0,0.265, leg, lty=c(2,1,1,1,1), col=c(1,3,4,5,6),lwd=array(2,5))

Example output

Loading required package: MASS
Loading required package: igraph

Attaching package: 'igraph'

The following objects are masked from 'package:stats':

    decompose, spectrum

The following object is masked from 'package:base':

    union

Treating 20 vertices:
10% 20% 30% 40% 50% 60% 70% 80% 90% 100% 
10 % 20 % 30 % 40 % 50 % 60 % 70 % 80 % 90 % 100 % 
10 % 20 % 30 % 40 % 50 % 60 % 70 % 80 % 90 % 
10 % 20 % 30 % 40 % 50 % 60 % 70 % 80 % 90 % 
10 % 20 % 30 % 40 % 50 % 60 % 70 % 80 % 90 % 
10 % 20 % 30 % 40 % 50 % 60 % 70 % 80 % 90 % 100 % 110 % 

G1DBN documentation built on May 2, 2019, 3:41 p.m.

Related to PRcurve in G1DBN...