Description Usage Arguments Value Author(s) References Examples
View source: R/residuals.DGEGLM.R
This function implements the residuals
method for the edgeR function glmFit
.
1 2 |
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.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | 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.