mediation: A causal mediation method with methylated region as the...

Description Usage Arguments Value Examples

View source: R/MRmediation.R

Description

A causal mediation method with methylated region as the mediator

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
################
### 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")

MRmediation documentation built on Dec. 18, 2020, 1:06 a.m.