Description Usage Arguments Details Value Examples
r_mediation_cell_type : function to simulate DNA methylation data for mediation analyzis (and cell type)
1 2 3 4 5 | r_mediation_cell_type(n, p, K, K.ct, freq = NULL, prop.causal.x = 0.01,
prop.causal.y = 0.01, prop.causal.ylx = 0.5, prop.variance.y = 0.6,
prop.variance.x = 0.2, rho = 0.2, sigma = 0.2, sd.A = 1,
mean.A = 3, sd.B = 1, mean.B = 5, sd.U = 1, sd.V = 1,
sd.ct = 1, alpha = NULL)
|
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 |
sd.ct |
: standard deviations for loadings (cell type) |
alpha |
: parameter for the dirichlet distribution (for cell type), default : runif(K.ct) |
prop.causal |
: proportion of causal variables (probes/loci) |
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. Cell type is simulate with dirichlet distribution To finish the methylation matrix is calculated thanks to the formula : M = V*U + A*X + B*Y + Z
M : matrix of methylation beta values
Y : phenotype/health outcome
B : effect sizes phenotype/health outcome
X : exposure
A : effect sizes exposure
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)
cell_type : proportion of cell type
tcell_type : loadings of cell type
1 2 | # Simulate data :
simu <- r_mediation_cell_type(100, 500, 2, 5)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.