diagplot.roc {metaseqR} | R Documentation

## Create basic ROC curves

### Description

This function creates basic ROC curves using a matrix of p-values (such a matrix can be derived for example from the result table of `metaseqr` by subsetting the table to get the p-values from several algorithms) given a ground truth vector for differential expression and a significance level.

### Usage

        diagplot.roc(truth, p, sig = 0.05, x = "fpr",
            y = "tpr", output = "x11", path = NULL,
            draw = TRUE, ...)

### Arguments

`truth` | the ground truth differential expression vector. It should contain only zero and non-zero elements, with zero denoting non-differentially expressed genes and non-zero, differentially expressed genes. Such a vector can be obtained for example by using the `make.sim.data.sd` function, which creates simulated RNA-Seq read counts based on real data.
`p` | a p-value matrix whose rows correspond to each element in the `truth` vector. If the matrix has a `colnames` attribute, a legend will be added to the plot using these names, else a set of column names will be auto-generated. `p` can also be a list or a data frame.
`sig` | a significance level (0 < `sig` <=1).
`x` | what to plot on x-axis, can be one of `"fpr"`, `"fnr"`, `"tpr"`, `"tnr"` for False Positive Rate, False Negative Rate, True Positive Rate and True Negative Rate respectively.
`y` | what to plot on y-axis, same as `x` above.
`output` | one or more R plotting device to direct the plot result to. Supported mechanisms: `"x11"` (default), `"png"`, `"jpg"`, `"bmp"`, `"pdf"` or `"ps"`.
`path` | the path to create output files.
`draw` | boolean to determine whether to plot the curves or just return the calculated values (in cases where the user wants the output for later averaging for example). Defaults to `TRUE` (make plots).
`...` | further arguments to be passed to plot devices, such as parameter from `par`.

### Value

A named list with two members. The first member is a list containing the ROC statistics: `TP` (True Postives), `FP` (False Positives), `FN` (False Negatives), `TN` (True Negatives), `FPR` (False Positive Rate), `FNR` (False Negative Rate), `TPR` (True Positive Rate), `TNR` (True Negative Rate), `AUC` (Area Under the Curve). The second is the path to the created figure graphic.

### Author(s)

Panagiotis Moulos

### Examples

    p1 <- 0.001*matrix(runif(300),100,3)
    p2 <- matrix(runif(300),100,3)
    p <- rbind(p1,p2)
    rownames(p) <- paste("gene",1:200,sep="_")
    colnames(p) <- paste("method",1:3,sep="_")
    truth <- c(rep(1,40),rep(-1,40),rep(0,20),rep(1,10),
        rep(2,10),rep(0,80))
    names(truth) <- rownames(p)
    roc.obj <- diagplot.roc(truth,p)

[Package metaseqR version 1.24.0 Index]