```
# NOT RUN {
data(methylKit)
# The Chisq-test will be applied when no overdispersion control is chosen.
my.diffMeth=calculateDiffMeth(methylBase.obj,covariates=NULL,
overdispersion=c("none"),
adjust=c("SLIM"))
# pool samples in each group
pooled.methylBase=pool(methylBase.obj,sample.ids=c("test","control"))
# After applying the pool() function, there is one sample in each group.
# The Fisher's exact test will be applied for differential methylation.
my.diffMeth2=calculateDiffMeth(pooled.methylBase,covariates=NULL,overdispersion=c("none"),
adjust=c("SLIM"),effect=c("wmean"),test=c("F"))
# Covariates and overdispersion control:
# generate a methylBase object with age as a covariate
covariates=data.frame(age=c(30,80,30,80))
sim.methylBase<-dataSim(replicates=4,sites=1000,treatment=c(1,1,0,0),
covariates=covariates,
sample.ids=c("test1","test2","ctrl1","ctrl2"))
# Apply overdispersion correction and include covariates
# in differential methylation calculations.
my.diffMeth3<-calculateDiffMeth(sim.methylBase,
covariates=covariates,
overdispersion="MN",test="Chisq",mc.cores=1)
# }
```

Run the code above in your browser using DataLab