scores: Scores for assessment from contingency tables.

Description Usage Arguments Value See Also Examples

View source: R/scores.R

Description

Gives scores for assessment and other values associated with contingency tables for network inference.

Usage

1
2
3
4
scores( contabs, what = c("TP", "FN", "FP", "TN", 
       "TPR", "TNR", "FPR", "FDR", "PPV", "NPV", 
       "sensitivity", "specificity", "precision", "recall", 
       "F1", "MCC", "ACC", "expected", "O/E")) 

Arguments

contabs

A data frame representing a contingency tables (confusion matrices) for a binary classification experiment. The column names should include TP (for true positive), FN (for false negative) FP (for false positive), TN (for true negative); these can be given in any order.

what

A character string specifying one or more desired output quantities from among:

"TP"

Number of edges that are correctly identified as such (true positives).

"FP"

Number of unlinked pairs that are incorrectly identified as edges (false positives).

"TN"

Number of unlinked pairs that are correctly identified as such (true negatives).

"FN"

Number of edges that are not identified as such (false negatives).

"TPR","sensitivity","recall"

True positive rate, sensitivity, or recall. TP/(# edges).

"FPR"

False positive or false alarm rate. FP/(# edges).

"TNR","specificity"

True negative rate or specificity. TN/(# unlinked pairs).

"FDR"

False discovery rate. FP/(# estimated links).

"PPV","precision"

Positive predictive value or precision. TP/(# estimated links).

"NPV"

Negative predictive value. TN/(# estimated unlinked pairs).

"F1"

F1 score, F-measure, balanced F-score. Harmonic mean of precision and recall.

"MCC"

Matthews correlation coefficient.

"ACC"

Accuracy. (TP + TN)/(# edges + # unlinked pairs).

"expected"

Expected number of links under random assortment.

"O/E"

Ratio of estimated (observed) number of edges to expected number of links under random assortment. TP/"expected".

Value

A data frame in which the variables are the desired quantities derived the specified contingency tables. The rows correspond to the rows of the contingency tables supplied as input (contabs).

See Also

contabs, roc, prc

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
data(dream4)

network <- 1

reference <- dream4gold10[[network]]
nGenes <- length(unique(c(reference[,1],reference[,2])))
nPossibleEdges <- nGenes^2
reference <- reference[reference[,3] == 1,1:2]

nTimePoints <- length(unique(dream4ts10[[network]]$time))

edges1ts10 <- networkBMA( data = dream4ts10[[network]][,-(1:2)], 
                          nTimePoints = nTimePoints, prior.prob = 0.1,
                          self = FALSE)

size <- nPossibleEdges - nGenes

contingencyTables <- contabs(network = edges1ts10, reference = reference,
                             size = size)

scores(contingencyTables, what = c("sensitivity", "specificity", "FDR"))

networkBMA documentation built on Jan. 28, 2021, 2:02 a.m.