# Obtain Levene residuals

### Description

Obtain absolute or squared Levene residuals for each CpG given a series of methylation arrays

### Usage

1 |

### Arguments

`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, |

### Details

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.

### Value

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.

### Author(s)

Belinda Phipson

### References

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.

### See Also

`varFit`

### Examples

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)
``` |

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker. Vote for new features on Trello.