meanLogX | R Documentation |
Computes the arithmetic mean in linear space of log-scaled values, and returns the result in the same log scale.
meanLogX(data, ncell, ex = 2, pc = 1)
data |
A numeric vector in log scale for which the arithmetic mean in linear scale is to be calculated and returned in the same log scale. |
ncell |
The number of samples (cells assuming an scRNAseq experiment) in the data.
This is not necessarily the same as the length of |
ex |
The log base of the data. Traditionally gene expression data is represented in base 2, although some methods (ie. Seurat's normalization scheme) use the natural log. (default=2) |
pc |
The pseudocount used when converting the data to log-scale initially. (default=1) |
Generally a pseudocount of 1 is added to log-scaled values to prevent +/-Inf results. However, adding a pseudocount of 1 to the log-scaled mean prior to gene expression ratio calculations in log space skews the result quite dramatically, so instead we add a small pseudocount to avoid +/- inf results when means are zero, without the same skewing. Adding a very small (ie 1e-99) number means that means of zero get set to a large negative log-mean, when it might be more appropriate to have those values fall closer to the smallest non-zero log-mean. By using a pseudocount of 1 / number of samples in the experiment, we ensure that log(zero) is smaller than any non-zero log-mean, while still being in the same ballpark.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.