r_mediation_real_cell_type: r_mediation_real_cell_type : function to simulate DNA...

Description Usage Arguments Details Value Examples

View source: R/mediation.R

Description

r_mediation_real_cell_type : function to simulate DNA methylation data for mediation analyzis (and cell type)

Usage

1
2
3
4
5
6
7
r_mediation_real_cell_type(CT = NULL, CT.l = NULL, n = nrow(CT),
  p = ncol(CT.l), K = 2, K.ct = 5, freq = NULL,
  prop.causal.x = 0.01, prop.causal.y = 0.01, prop.causal.ylx = 0.5,
  prop.variance.y = 0.1, prop.variance.x = 0.1, rho = 0.1,
  sigma = 1, sd.A = 0.1, mean.A = 1, sd.B = 0.1, mean.B = 1,
  sd.U = 1, sd.V = 1, strength = 1, sd.ct = 1, alpha = NULL,
  prob.bin = NULL)

Arguments

CT

: Cell type proportion. null by default. You can use real data (n * K.ct matrix)

CT.l

: Cell type loading. null by default. You can use real data (K.ct * p matrix)

n

: number of individuals

p

: number of cpg variables

K

: number of latent factors

K.ct

: number of cell type

freq

: (vector) mean methylation values (if NULL, set randomly)

prop.causal.x

: proportion of causal cpg M -> x

prop.causal.y

: proportion of causal cpg M -> y

prop.causal.ylx

: proportion of causal y in causal x

prop.variance.y

: proportion of phenotypic variance explained by latent structure (intensity of confounding)

prop.variance.x

: proportion of exposure variance explained by latent structure (intensity of confounding)

rho

: correlation outcome/exposure (direct effect)

sigma

: standard deviation of residual errors

sd.A

: standard deviation for effect sizes (A: M->X)

mean.A

: (vector) mean of effect sizes

sd.B

: standard deviation for effect sizes (B: M->Y)

mean.B

: (vector) mean of effect sizes

sd.U

: (vector) standard deviations for factors

sd.V

: standard deviations for loadings

strength

: if you use real data for loading of cell type, strength of the real data

sd.ct

: standard deviations for loadings (cell type)

alpha

: parameter for the dirichlet distribution (for cell type), default : runif(K.ct)

prob.bin

: if you use binairy exposure (X), probability of success on each trial

prop.causal

: proportion of causal variables (probes/loci)

Details

This function is used to simulate datasets for analysis of mediations. The simulation model is based on linear relationships. First, it construct a covariance matrix for X, Y and U using the parameter rho (direct effect or correlation between X and Y) and propvar (intensity of the confounders or correlation between Y and U). Then this matrix is used to simulate via normal laws X, Y and U. Thereafter, the effect sizes of X (A), Y (B) and U (V) are calculated using mean parameters of effect sizes (meanA and meanB) and standard deviations (sdA, sdB and sdV). Note that the effect sizes of X and Y are calculated only for causal mediators with X and/or Y. For non-causal mediators, the effect sizes is 0. On the other hand, a residual error matrix is calculated via the sigma (Z) parameter. For Cell type (CT) and loading of cell type (CT.l) you can use real data. If Cell type is simulate : Cell type is simulate with dirichlet distribution, loading of cell type simulate via normal laws. To finish the methylation matrix is calculated thanks to the formula : M = VU + CT.l*CT + AX + BY + Z

Value

M : matrix of methylation beta values

X : exposure

Y : phenotype/health outcome

A : effect sizes exposure

B : effect sizes phenotype/health outcome

M.bin : matrix of methylation beta values, use if you use the binairy exposure

X.bin : binairy exposure

CT : proportion of cell type

CT.l : loading of cell type

mediators : set of true mediators

causal.x : set of CpGs associated with the exposure

causal.y : set of CpGs associated with the outcome

U : simulated confounders

V : loadings of coufounders

freq : mean methylation values

controls : true control gene (NOT USE for simulation study)

Examples

1
2
# Simulate data :
simu <- r_mediation_cell_type(100, 500, 2, 5)

jumentib/useFonc documentation built on Nov. 18, 2019, 3:17 p.m.