This vignette demonstrates DNA methylation preprocessing using the
Rtoolset::beta2M() helper.
Overview
DNA methylation data is often represented as beta values between 0
and 1, while many statistical analyses work better with M values. The
beta2M() function provides a simple way to convert beta
values to M values while handling edge cases and preserving the input
structure.
Why Convert to M Values?
M values are often preferred for modeling because they:
- are closer to a normal distribution
- have more stable variance across the range
- work better with linear modeling frameworks
Conversion Formula
The beta-to-M transformation is:
M = \log_2\left(\frac{\beta + \alpha}{1 - \beta + \alpha}\right)
where:
-
betais the methylation beta value -
alphais a small constant added for numerical stability -
Mis the transformed M value
Best Practices
- Check for extreme values before conversion
- Use the default
alphaunless you have a specific reason to change it - Record the
alphavalue used for reproducibility - Convert to M values before fitting linear models