mediation_single: A causal mediation method with a single CpG site as the...

Description Usage Arguments Value Examples

View source: R/mediation_single.R

Description

A causal mediation method with a single CpG site as the mediator

Usage

1
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

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

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