# PRcurve {G1DBN}

PR curves computation
Package:
G1DBN
Version:
3.1.1

### 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

```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.

### Values

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).

DBNScoreStep1, DBNScoreStep2, ROCcurve.

### Examples

```library(G1DBN)
## generate the validation matrix
## number of genes
p <- 20
## the network - adjacency Matrix

## 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)

## 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)

alpha1=0.6
S2<-DBNScoreStep2(S1=out\$S1ls,data=Xn,alpha1=alpha1)

alpha1=0.4
S2<-DBNScoreStep2(S1=out\$S1ls,data=Xn,alpha1=alpha1)

alpha1=0.2
S2<-DBNScoreStep2(S1=out\$S1ls,data=Xn,alpha1=alpha1)

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))```

### Author(s)

Lebre Sophie (http://icube-bfo.unistra.fr/en/index.php/Sophie_Lebre), Chiquet Julien (http://stat.genopole.cnrs.fr/~jchiquet).

Documentation reproduced from package G1DBN, version 3.1.1. License: GPL (>= 2)