inverse cell frequency using standard deviation (SD)

idf_sd(expr, features = NULL, log = FALSE, thres = 0)

Arguments

expr

a matrix, features in row and cells in column

features

vector, feature names or indexes to compute

log

logical, if to do log-transformation

thres

numeric, cell only counts when expr > threshold, default 0

Value

a vector of inverse cell frequency score for each feature

Details

$$\mathbf{IDF_i} = log(1+sd(tf_{i})*\frac{n}{n_i+1})$$ where \(tf_i\) is the term frequency of feature \(i\), see details in tf(), \(n\) is the total number of cells and \(n_i\) is the number of cells containing feature \(i\).

Examples

data <- matrix(rpois(100, 2), 10, dimnames = list(1:10))
smartid:::idf_sd(data)
#>          1          2          3          4          5          6          7 
#> 0.06542373 0.06402367 0.08921687 0.06335311 0.05517025 0.05870951 0.05250568 
#>          8          9         10 
#> 0.06333858 0.05410351 0.07647093