Obtain absolute or squared Levene residuals for each CpG given a series of methylation arrays
1  getLeveneResiduals(data, design = NULL, type = NULL)

data 
object of class 
design 
the design matrix of the experiment, with rows corresponding to arrays/samples and columns to coefficients to be estimated. Defaults to the unit vector. 
type 
character string, 
This function will return absolute or squared Levene residuals given a matrix of M values and a design matrix. This can be used for graphing purposes or for downstream analysis such a gene set testing based on differential variability rather than differential methylation. If no design matrix is given, the residuals are determined by treating all samples as coming from one group.
Returns a list with three components. data
contains a matrix of absolute or squared residuals, AvgVar
is a vector of sample variances and LogVarRatio
corresponds to the columns of the design matrix and is usually the ratios of the log of the group variances.
Belinda Phipson
Phipson, B., and Oshlack, A. (2014). A method for detecting differential variability in methylation data shows CpG islands are highly variably methylated in cancers. Genome Biology, 15:465.
1 2 3 4 5 6 7 8 9 10 11  # Randomly generate data for a 2 group problem with 100 CpG sites and 5 arrays in each group
y < matrix(rnorm(1000),ncol=10)
group < factor(rep(c(1,2),each=5))
design < model.matrix(~group)
# Get absolute Levene Residuals
resid < getLeveneResiduals(y,design)
# Plot the first CpG
barplot(resid$data[1,],col=rep(c(2,4),each=5),ylab="Absolute Levene Residuals",names=group)

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.
All documentation is copyright its authors; we didn't write any of that.