Description Usage Arguments Details Value Examples
r_mediation_real_gene : function to simulate DNA methylation data for mediation analyzis
1 2 3 4 5 6 | r_mediation_real_gene(meth = NULL, n = nrow(meth), p = ncol(meth),
K = 5, prop.causal.x = 0.005, prop.causal.y = 0.005,
prop.causal.ylx = 0.5, prop.variance.y = 0.1,
prop.variance.x = 0.1, rho = 0.2, sigma = 1, sd.A = 0.1,
mean.A = 1, sd.B = 0.1, mean.B = 1, sd.U = sort(runif(K, 0, 2)),
sd.V = 5, s.real = 1)
|
meth |
: methylation matrix |
n |
: number of individuals |
p |
: number of cpg variables |
K |
: number of latent factors |
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 |
s.real |
: strengh of real data |
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. To finish the methylation matrix is calculated thanks to the formula : M = meth + 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)
1 | # Simulate data :
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.