| Type: | Package | 
| Title: | A Causal Mediation Method with Methylated Region (MR) as the Mediator | 
| Version: | 1.0.1 | 
| Author: | Qi Yan | 
| Maintainer: | Qi Yan <qy2253@cumc.columbia.edu> | 
| Description: | A causal mediation approach under the counterfactual framework to test the significance of total, direct and indirect effects. In this approach, a group of methylated sites from a predefined region are utilized as the mediator, and the functional transformation is used to reduce the possible high dimension in the region-based methylated sites and account for their location information. | 
| License: | GPL-2 | GPL-3 [expanded from: GPL (≥ 2)] | 
| Encoding: | UTF-8 | 
| LazyData: | true | 
| Depends: | R (≥ 3.5.0), fda | 
| Imports: | MASS, stats | 
| RoxygenNote: | 7.1.0 | 
| Collate: | 'MRmediation.R' 'mediation_single.R' 'example_data.R' | 
| NeedsCompilation: | no | 
| Packaged: | 2020-12-17 17:45:14 UTC; qiyan | 
| Repository: | CRAN | 
| Date/Publication: | 2020-12-17 22:50:16 UTC | 
This is the data for examples
Description
- data. phenotype file. 1st column is ID, 2nd column is continuous outcome, 3rd column is binary outcome, 4th column is exposure, 5th column is age, 6th column is gender, 7th-last columns are CpGs 
- pos. CpG locations from the defined region and they are from the same chromosome. 
Usage
data(example_data)
A causal mediation method with methylated region as the mediator
Description
A causal mediation method with methylated region as the mediator
Usage
mediation(
  pheno,
  predictor,
  region,
  pos,
  order,
  gbasis,
  covariate,
  base = "bspline",
  family = "gaussian"
)
Arguments
| pheno | A vector of continuous or binary phenotypes (class: numeric). | 
| predictor | A vector of values for the exposure variable (class: numeric). | 
| region | A matrix of CpGs in a region. Each column is a CpG (class: data.frame). | 
| pos | A vector of CpG locations from the defined region and they are from the same chromosome (class: integer). | 
| order | A value for the order of bspline basis. 1: constant, 2: linear, 3: quadratic and 4: cubic. | 
| gbasis | A value for the number of basis being used for functional transformation on CpGs. | 
| covariate | A matrix of covariates. Each column is a covariate (class: data.frame). | 
| base | "bspline" for B-spline basis or "fspline" for Fourier basis. | 
| family | "gaussian" for continuous outcome or "binomial" for binary outcome. | 
Value
1. pval$TE:   total effect (TE) p-value 
2. pval$DE:   direct effect (DE) p-value 
3. pval$IE:   indirect effect (IE) p-value 
4. pval_MX:   p-value for the association between methylation and exposure 
Examples
################
### Examples ###
################
data("example_data")
predictor = data$exposure
region = data[,7:dim(data)[2]]
covariates = subset(data, select=c("age","gender"))
# binary outcome
pheno_bin = data$pheno_bin
mediation(pheno_bin, predictor, region, pos, covariate=covariates, order=4, 
gbasis=4, base="bspline", family="binomial")
# continuous outcome 
pheno_con = data$pheno_con
mediation(pheno_con, predictor, region, pos, covariate=covariates, order=4, 
gbasis=4, base="bspline", family="gaussian")
A causal mediation method with a single CpG site as the mediator
Description
A causal mediation method with a single CpG site as the mediator
Usage
mediation_single(pheno, predictor, cpg, covariate, family = "gaussian")
Arguments
| pheno | A vector of continuous or binary phenotypes (class: numeric). | 
| predictor | A vector of values for the exposure variable (class: numeric). | 
| cpg | A vector of a CpG (class: numeric). | 
| covariate | A matrix of covariates. Each column is a covariate (class: data.frame). | 
| family | "gaussian" for continuous outcome or "binomial" for binary outcome. | 
Value
1. pval$TE:   total effect (TE) p-value 
2. pval$DE:   direct effect (DE) p-value 
3. pval$IE:   indirect effect (IE) p-value 
4. pval_MX:   p-value for the association between methylation and exposure 
Examples
################
### Examples ###
################
data("example_data")
predictor = data$exposure
cpg = data[,9] #any number in c(7:dim(data)[2])
covariates = subset(data, select=c("age","gender"))
# binary outcome
pheno_bin = data$pheno_bin
mediation_single(pheno_bin, predictor, cpg, covariate=covariates, family="binomial")
# continuous outcome
pheno_con = data$pheno_con
mediation_single(pheno_con, predictor, cpg, covariate=covariates, family="gaussian")