| Type: | Package | 
| Title: | Epigenome-Wide Mediation Analysis Study | 
| Version: | 0.2.3 | 
| Date: | 2025-09-05 | 
| Author: | Xiuquan Nie [aut, cph, cre], Mengyi Wang [ctb, rev] | 
| Maintainer: | Xiuquan Nie <niexiuquan1995@foxmail.com> | 
| Depends: | R (≥ 4.1.0) | 
| Imports: | mediation, parallel, multilevel, ggplot2, qqman, lavaan, minfi, IlluminaHumanMethylationEPICanno.ilm10b4.hg19, IlluminaHumanMethylation450kanno.ilmn12.hg19 | 
| Description: | DNA methylation is essential for human, and environment can change the DNA methylation and affect body status. Epigenome-Wide Mediation Analysis Study (EMAS) can find potential mediator CpG sites between exposure (x) and outcome (y) in epigenome-wide. For more information on the methods we used, please see the following references: Tingley, D. (2014) <doi:10.18637/jss.v059.i05>, Turner, S. D. (2018) <doi:10.21105/joss.00731>, Rosseel, D. (2012) <doi:10.18637/jss.v048.i02>. | 
| License: | GPL-3 | 
| Encoding: | UTF-8 | 
| LazyData: | true | 
| RoxygenNote: | 7.3.2 | 
| NeedsCompilation: | no | 
| Packaged: | 2025-09-04 15:35:33 UTC; niexi | 
| Repository: | CRAN | 
| Date/Publication: | 2025-09-04 16:20:08 UTC | 
An Emas results data.
Description
An Emas results data for 2000 CpGs. The data were fabricated.
Usage
E.result
Format
A data.frame produced by Emas contains 2000 obs of 13 variables.
Plotting the manhattan plot from the EMAS results
Description
Function to plot a manhattan plot from the Emas results.
Usage
EMAS.manhattan(E.result, type = "EPIC", ...)
Arguments
E.result | 
 A data.frame produced by   | 
type | 
 A character string indicating the type of annotation, only "EPIC" and "450k" are available.  | 
... | 
 Other arguments passed to   | 
Details
This function can plot a manhattan plot from the Emas results according to the annotation from 450k or EPIC.
Value
No return value, called for side effects.
Author(s)
Xiuquan Nie, niexiuquan1995@foxmail.com
References
Turner, (2018). qqman: an R package for visualizing GWAS results using Q-Q and manhattan plots. Journal of Open Source Software, 3(25), 731. doi:10.21105/joss.00731.
Examples
data(E.result)
EMAS.manhattan(E.result, type = "EPIC",
               genomewideline = -log10(0.05/2000),
               suggestiveline = -log10(1/100), ylim=c(0,5))
Plotting the volcano plot from the EMAS results
Description
Function to plot a volcano plot from the Emas results.
Usage
EMAS.volcano(
  E.result,
  epiwideline = -log10(1e-07),
  suggestiveline = -log10(1e-05)
)
Arguments
E.result | 
 A data.frame produced by   | 
epiwideline | 
 Where to draw a "epigenome-wide sigificant" line. Default -log10(1.0e-7).  | 
suggestiveline | 
 Where to draw a "suggestive" line. Default -log10(1.0e-5). Set to FALSE to disable.  | 
Details
This function can plot a volcano plot from the Emas results.
Value
No return value, called for side effects.
Author(s)
Xiuquan Nie, niexiuquan1995@foxmail.com
Examples
data(E.result)
EMAS.volcano(E.result, 
             epiwideline = -log10(0.05/2000),
             suggestiveline = -log10(1/100))
Epigenome-Wide Mediation Analysis Study
Description
This function can perform the Epigenome-Wide Mediation Analysis Study (EMAS).
Usage
Emas(
  data,
  M.matrix,
  id = "",
  x = "",
  y = "",
  x.cov = c(),
  y.cov = c(),
  m.cov = c(),
  mem.sav = FALSE,
  p.th = 0.1,
  ini.sims = 100,
  boot = FALSE,
  cl.n = 1,
  ...
)
Arguments
data | 
 A data.frame included id, x, y, x.cov, y.cov, m.cov.  | 
M.matrix | 
 A matrix with the epigenome-wide CpG information, maybe a M-value matrix or a beta value matrix.  | 
id | 
 Variable name of the id.  | 
x, y | 
 Variable name of exposure(x) and outcome(y).  | 
x.cov | 
 Variable names of covariates related to exposure(x).  | 
y.cov | 
 Variable names of covariates related to outcome(y).  | 
m.cov | 
 Variable names of covariates related to mediator(m).  | 
mem.sav | 
 A logical value. If 'TRUE', the memory required for the function will decrease, but the speed will also decrease.  | 
p.th | 
 Sobel indirect effects P-value threshold for subsequent nonparametric bootstrap or quasi-Bayesian approximation mediation analyses.  | 
ini.sims | 
 Initial number of Monte Carlo draws for nonparametric bootstrap or quasi-Bayesian approximation.  | 
boot | 
 A logical value. If 'FALSE' a quasi-Bayesian approximation is used for confidence intervals; if 'TRUE' nonparametric bootstrap will be used. Default is 'FALSE'.  | 
cl.n | 
 Number of cores used for parallel computing.  | 
... | 
 Other arguments passed to   | 
Details
This function can perform the Epigenome-Wide Mediation Analysis Study (EMAS) to explore the potential mediating CpG sites of exposure variables affecting outcome variables within the epigenome-wide.
Value
Emas returns a data.frame with the average mediation effects(AME), 
average direct effects(ADE), total effects, mediation proportion.
AMEEst: | 
 Point estimates for average mediation effects under the exposure conditions.  | 
AMElow95, AMEupp95: | 
 95 percentage confidence intervals for average mediation effects.  | 
AME.P: | 
 Two-sided p-values for average mediation effects.  | 
ADEEst: | 
 Point estimates for average direct effect under the exposure conditions.  | 
ADElow95, ADEupp95: | 
 95 percentage confidence intervals for average direct effects.  | 
ADE.P: | 
 Two-sided p-values for average direct effects.  | 
TotEst: | 
 Point estimate for total effect.  | 
Totlow95, Totupp95: | 
 95 percentage confidence interval for total effect.  | 
Tot.P: | 
 Two-sided p-values for total effect.  | 
PropEst: | 
 The "proportions mediated", or the size of the average mediation effects relative to the total effect.  | 
Author(s)
Xiuquan Nie, niexiuquan1995@foxmail.com
References
Tingley, D., Yamamoto, T., Hirose, K., Imai, K. and Keele, L. (2014). mediation: R package for Causal Mediation Analysis. Journal of Statistical Software, 59(5), 1–38. doi:10.18637/jss.v059.i05.
Examples
data(data.m)
data(Mvalue)
E.result <- Emas(data.m, Mvalue, id = "ID", x = "x", y = "y",
                 x.cov = c("age", "gender"),
                 y.cov = c("age", "gender"),
                 m.cov = c("age", "gender", "CD8T", "CD4T"), 
                 p.th = 0.1, ini.sims = 100, boot = FALSE, cl.n = 1)
Epigenome-Wide Mediation Analysis Study: Parallel multiple mediation model
Description
This function can perform the parallel multiple mediation model after the Epigenome-Wide Mediation Analysis Study (EMAS).
Usage
Emas.parallel(
  data,
  M.matrix,
  id = "",
  x = "",
  y = "",
  x.cov = c(),
  y.cov = c(),
  m.cov = c(),
  m.cor = TRUE,
  boot = FALSE,
  lavaan = FALSE,
  ...
)
Arguments
data | 
 A data.frame included id, x, y, x.cov, y.cov, m.cov.  | 
M.matrix | 
 A matrix with the CpG information screened from EMAS., maybe a M-value matrix or a beta value matrix.  | 
id | 
 Variable name of the id.  | 
x, y | 
 Variable name of exposure(x) and outcome(y).  | 
x.cov | 
 Variable names of covariates related to exposure(x).  | 
y.cov | 
 Variable names of covariates related to outcome(y).  | 
m.cov | 
 Variable names of covariates related to mediator(m).  | 
m.cor | 
 A logical value. If 'TRUE', the mediators in the parallel multiple mediation model are set to correlate with each other.  | 
boot | 
 A logical value or a numeric value. If a numeric value, the number for bootstrap.  | 
lavaan | 
 A logical value. If 'TRUE', a lavaan object will be given.  | 
... | 
 Other arguments passed to   | 
Details
This function can perform the parallel multiple mediation model after the Epigenome-Wide Mediation Analysis Study (EMAS) to further explore the potential parallel mediating CpG sites of exposure variables affecting outcome variables.
Value
Emas.parallel returns a data.frame with the average mediation effects(AME), 
average direct effects(ADE), and total effects(Tot). If lavaan is 'TRUE', a lavaan object will be given.
Author(s)
Xiuquan Nie, niexiuquan1995@foxmail.com
References
Rosseel, Y. (2012). lavaan: An R Package for Structural Equation Modeling. Journal of Statistical Software, 48(2), 1–36. doi:10.18637/jss.v048.i02.
Examples
data(data.m)
data(Mvalue)
EP.result <- Emas.parallel(data.m, Mvalue, 
                           id = "ID", x = "x", y = "y", 
                           x.cov = c("age", "gender"), 
                           y.cov = c("age", "gender"), 
                           m.cov = c("age", "gender", "CD8T", "CD4T"), 
                           m.cor = TRUE, boot = FALSE, lavaan = FALSE)
A M-value matrix for 221 participants
Description
A M-value matrix for 221 participants. The data were fabricated.
Usage
Mvalue
Format
A matrix contains 221 obs of 10 CpGs.
A data for 221 participants
Description
A data for 221 participants. The data were fabricated.
Usage
data.m
Format
A data.frame contains 221 obs of 7 variables. The variables are:
- ID
 The ID of these 221 people.
- age
 A numeric.
- gender
 A two level factor: "1" or "2"
- CD8T
 A numeric.
- CD4T
 A numeric.
- x
 A numeric.
- y
 A numeric.