meanVarParaFit: Parametrically Fit a Mean-Variance Curve

View source: R/fitMeanVarCurve.R

meanVarParaFitR Documentation

Parametrically Fit a Mean-Variance Curve

Description

meanVarParaFit fits a mean-variance curve by applying a robust, gamma-family glm regression, taking advantage of the form: var = c1 + c2 / (2 ^ mean).

Usage

meanVarParaFit(
  x,
  y,
  weight,
  range.residual = c(1e-04, 15),
  max.iter = 50,
  init.coef = NULL,
  verbose = TRUE
)

Arguments

x

Two numeric vectors of (sample) means and sample variances, respectively.

y

Two numeric vectors of (sample) means and sample variances, respectively.

weight

An optional vector of weights to be used in the fitting procedure. It's typically used when sample variances in y are associated with different numbers of degrees of freedom.

range.residual

A length-two vector specifying the range of residuals of non-outliers.

max.iter

Maximum number of iteration times allowed during the fitting procedure.

init.coef

An optional length-two vector specifying the initial values of the coefficients.

verbose

Whether to print processing messages about iteratively fitting the mean-variance curve?

Details

meanVarParaFit iteratively detects outliers and fits a generalized linear model on non-outliers. The procedure converges as soon as the set of outlier points fixes.

See "References" for the theoretical foundation of the parametric form.

Value

A prediction function which accepts a vector of means and returns the predicted variances, with an attribute named "coefficients" attached.

References

Robinson, M.D. and G.K. Smyth, Small-sample estimation of negative binomial dispersion, with applications to SAGE data. Biostatistics, 2008. 9(2): p. 321-32.

Love, M.I., W. Huber, and S. Anders, Moderated estimation of fold change and dispersion for RNA-seq data with DESeq2. Genome Biol, 2014. 15(12): p. 550.

Tu, S., et al., MAnorm2 for quantitatively comparing groups of ChIP-seq samples. Genome Res, 2021. 31(1): p. 131-145.

See Also

meanVarLocalFit for using local regression to fit a mean-variance curve; fitMeanVarCurve for an interface to modeling the mean-variance dependence on bioCond objects; plotMeanVarCurve for plotting a mean-variance curve.


MAnorm2 documentation built on Oct. 29, 2022, 1:12 a.m.