View source: R/residuals.DGEGLM.R
residuals.DGEGLM | R Documentation |
This function implements the residuals
method for the edgeR function glmFit
.
## S3 method for class 'DGEGLM' residuals(object, type = c("deviance", "pearson"), ...)
object |
An object of class |
type |
Compute deviance or Pearson residuals. |
... |
Additional arguments to be passed to the generic function. |
A genes-by-samples numeric matrix with the negative binomial residuals for each gene and sample.
Davide Risso
McCullagh P, Nelder J (1989). Generalized Linear Models. Chapman and Hall, New York.
Venables, W. N. and Ripley, B. D. (1999). Modern Applied Statistics with S-PLUS. Third Edition. Springer.
library(edgeR) library(zebrafishRNASeq) data(zfGenes) ## run on a subset genes for time reasons ## (real analyses should be performed on all genes) genes <- rownames(zfGenes)[grep("^ENS", rownames(zfGenes))] spikes <- rownames(zfGenes)[grep("^ERCC", rownames(zfGenes))] set.seed(123) idx <- c(sample(genes, 1000), spikes) seq <- newSeqExpressionSet(as.matrix(zfGenes[idx,])) x <- as.factor(rep(c("Ctl", "Trt"), each=3)) design <- model.matrix(~x) y <- DGEList(counts=counts(seq), group=x) y <- calcNormFactors(y, method="upperquartile") y <- estimateGLMCommonDisp(y, design) y <- estimateGLMTagwiseDisp(y, design) fit <- glmFit(y, design) res <- residuals(fit, type="deviance") head(res)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.