compute_size_factors {scry} | R Documentation |
Computes a size factor for each observation (column) of a count data matrix based on an approximate multinomial model.
compute_size_factors(m, fam = c("binomial", "poisson"))
m |
a matrix or sparse |
fam |
a string specifying the model type to be used for calculating size factors. Must be either 'binomial' or 'poisson'. |
Both fam options are approximations to a multinomial model. Size factors for binomial are simply the column sums (total counts for each sample). For Poisson, the size factors are given by the column sums after rescaling to have geometric mean of one. This improves numerical stability.
A vector of size factors with length equal to the number of columns
of m
.
ncells <- 100 u <- matrix(rpois(20000, 5), ncol=ncells) compute_size_factors(u)