inmoose.edgepy.nbinomDeviance

inmoose.edgepy.nbinomDeviance(y, mean, dispersion=0, weights=None)

Residual deviances for row-wise negative binomial GLMs.

This function computes the total residual deviance for each row of y, i.e. weighted row sums of the unit deviances.

Care is taken to ensure accurate computation in limiting cases when the dispersion is near zero of mean * dispersion is very large.

See also

nbinomUnitDeviance

Parameters:
  • y (array_like) – matrix containing the negative binomial counts, with rows for genes and columns for libraries. A vector will be treated as a matrix with one row.

  • mean (array_like) – matrix of expected values, of same shape as y. A vector will be treated as a matrix with one row.

  • dispersion (array_like) – vector or matrix of negative binomial dispersions, as in glmFit. Can be a scalar, a vector of length equal to the number of rows in y, or a matrix of same shape as y.

  • weights (array_like, optional) – vector or matrix of non-negative weights, as in glmFit. Can be a scalar, a vector of length equal to the number of columns in y, or a matrix of same shape as y.

Returns:

vector of length equal to the number of rows in y

Return type:

ndarray