NBumi_PearsonResiduals: Calculate Pearson Residuals

NBumiPearsonResidualsR Documentation

Calculate Pearson Residuals

Description

Uses the NBumi depth-adjusted negative binomial model to calculate Pearson Residuals as an approach to normalizing 10X/UMI tagged data.

Usage

	NBumiPearsonResiduals(counts, fits=NULL)
	NBumiPearsonResidualsApprox(counts, fits=NULL)

Arguments

counts

a numeric matrix of raw UMI counts, columns = samples/cells, rows = genes.

fits

the output from NBumiFitModel.

Details

Calculates a unique expectation for each gene expression observation based on the depth-adjusted negative binomial model (see: NBumiFitModel for details). This expection (mu) is equal to t_i*t_j/T, where t_i is the total counts for sample i, t_j is the total counts for gene j and T is the total counts.

NBumiPearsonResidualApprox Pearson residuals are approximated as: (counts - expectation) / sqrt(expectation). This assumes a Poisson-distribution of counts.

NBumiPearsonResiduals Pearson residuals are approximated as: (counts - mu) / sqrt(mu + mu^2/size). This uses a negative-binomial distribution of counts.

Value

a matrix of pearson residuals of equal dimension as your original matrix.

See Also

NBumiFitModel

Examples

	library(M3DExampleData)
	fit <- NBumiFitModel(counts);
	pearson1 <- NBumiPearsonResiduals(counts,fit)
	pearson2 <- NBumiPearsonResidualsApprox(counts,fit)

tallulandrews/M3Drop documentation built on March 6, 2024, 1:49 a.m.