compute_size_factors {scry} | R Documentation

## Compute size factors

### Description

Computes a size factor for each observation (column) of a count data matrix based on an approximate multinomial model.

### Usage

    compute_size_factors(m, fam = c("binomial", "poisson"))

### Arguments

`m` | a matrix or sparse `Matrix` of integer count values.
`fam` | a string specifying the model type to be used for calculating size factors. Must be either 'binomial' or 'poisson'.

### Details

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.

### Value

A vector of size factors with length equal to the number of columns of `m`.

### Examples

    ncells <- 100
    u <- matrix(rpois(20000, 5), ncol=ncells)
    compute_size_factors(u)

[Package scry version 1.0.1 Index]