# Example taken from edgeR documentation:
# generate raw counts from NB, create list object
y <- matrix(rnbinom(50*4,size=1/0.2,mu=10),nrow=50,ncol=4)
d <- DGEList(counts=y, group=c(1,1,2,2), lib.size=colSums(y))
d <- calcNormFactors(d)
d <- estimateCommonDisp(d)
d <- estimateTagwiseDisp(d)
de.edgeR <- exactTest(d) #using edgeR CONDITIONAL exact test
topTags(de.edgeR)
de.edgeRun <- UCexactTest(d) #using edgeRun, UNCONDITIONAL exact test
topTags(de.edgeRun)
# same p-values using low-level function directly (edgeR)
p.value.edgeR <- exactTestDoubleTail(y[,1:2], y[,3:4]
,dispersion=d$tagwise.dispersion)
p.value.edgeRun <- pvalue(s1=rowSums(y[,1:2,drop=FALSE])
, s2=rowSums(y[,3:4,drop=FALSE]), phi=d$tagwise.dispersion, n1=2, n2=2)
Run the code above in your browser using DataLab