bg__fit_size_to_var {M3Drop} | R Documentation

## Fit gene-specific dispersion

### Description

Fits dispersion for a specific gene for the depth-adjusted negative binomial. Functions tagged with "bg__" are not meant for direct usage and are not available in the Bioconductor release.

### Usage

    	bg__fit_size_to_var(obs, mu_vec, max_size, min_size=10^-10, convergence=0.001)

### Arguments

`obs` | observed variance corrected for library size.
`mu_vec` | expectation of depth-adjusted negative-binomial for each observation
`max_size` | maximum dispersion for genes that exhibit Poissonian expression.
`min_size` | initial dispersion estimate.
`convergence` | acceptable error on dispersion estimate.

### Details

Minimized the difference between the mean of expected variances for each observation based on the depth-adjust negative binomial(DANB) and the observed variance. The observed variance is corrected for library size by subtracting the observation specific mean as per the DANB from the observed UMI counts prior to calculating the variance. The optimization is done using an iterative method similar to Newton's method, which ends when the difference between estimates is less than "convergence" or if the estimated dispersion exceeds "max_size" or after 1000 iterations.

### Value

Estimated dispersion.

### Examples

    #	library(M3DExampleData)
    #	counts <- as.matrix(Mmus_example_list$data);
    #	counts <- counts[rowSums(counts) > 0,];
    #	fit <- NBumiFitModel(counts);
    #	coeffs <- NBumiFitDispVsMean(fit, suppress.plot=TRUE);

[Package M3Drop version 1.16.0 Index]