poscore: Percentile of Score

Description Usage Arguments Details Value Examples

Description

Helper function that calculates percentiles of scores for batch-correction method 'pn' (percentile normalization). R-implementation of Claire Duvallet's 'percentileofscore()' for python.

Usage

1
poscore(cnt.vec, cnt, type = c("rank", "weak", "strict", "mean"))

Arguments

cnt.vec

A vector of counts that acts as reference for score calculation.

cnt

A numeric value to calculate percentile-score for.

type

One of 'rank', 'weak', 'strict' or 'mean' to determine how the score is calculated.

Details

Calculates the number of values that bigger than reference (left) and the number of values that are smaller than the reference (right). Percentiles of scores are given in the interval I:[0,100]. Depending on type of calculation, the score will be computed as follows:

rank = (right + left + ifelse(right > left, 1, 0)) * 50/n

weak = right / n*100

strict = left / n*100

mean = (right + left) * 50/n)

Value

A score for given count in relation to reference counts.

Examples

1
2
3
4
# This will return a score for the supplied vector with default evaluation
# (strict).
val.score <- poscore(cnt.vec=runif(100, min=0, max=100), cnt=42,
type="strict")

buschlab/MBECS documentation built on Jan. 21, 2022, 1:27 a.m.