count_vector {sparselink}R Documentation

Metrics for sign detection

Description

Calculates sensitivity, specificity and precision for ternary data (with -1 for negative effect, 0 for no effect, 1 for positive effect).

Usage

count_vector(truth, estim)

count_matrix(truth, estim)

Arguments

truth

(i) vector of length p or (ii) n \times p matrix with entries in -1, 0, 1

estim

(i) vector of length p or (ii) p \times n matrix with entries -1, 0, 1

Value

Returns a vector of length 3 (with names "sensitivity", "specificity" and "precision") or a matrix with 3 rows (with names "sensitivity", "specificity" and "precision") and n columns.

Examples

#--- vector ---
p <- 20
truth <- sample(x=c(-1,0,1),size=p,replace=TRUE)
estim <- sample(x=c(-1,0,1),size=p,replace=TRUE)
table(truth,estim)
count_vector(truth,estim)

#--- matrix ---
p <- 20
n <- 5
truth <- matrix(sample(x=c(-1,0,1),size=n*p,replace=TRUE),nrow=p,ncol=n)
estim <- matrix(sample(x=c(-1,0,1),size=n*p,replace=TRUE),nrow=p,ncol=n)
count_matrix(truth,estim)


[Package sparselink version 1.0.0 Index]