View source: R/compute_effects.R
ComputeEffectxx | R Documentation |
ComputeEffectxx
computes either direct, indirect, or total effect
of each xx variable on response y when transition x from xp to xpp.
ComputeEffectxx(dat, fit, effect, xp = 0, xpp = 1, risk_scale = NULL,
mmn = FALSE, rmean = NULL)
dat |
List containing data (see SimulateData for format) |
fit |
List with path coefficients. |
effect |
Either 'direct', 'indirect', or 'total' |
xp |
The initial value of x. |
xpp |
The new value of x. |
risk_scale |
Either 'diff' (for risk difference) or 'ratio' (for odds). see details for more information. |
mmn |
Should gene set network be simulated. If FALSE assume conditionally independent mediators. |
Vector of effects.
params <- SimpleSim()
dat <- SimulateData(params)
fit <- ComputePath(dat)
d <- ComputeEffectxx(dat,fit,"direct")
i <- ComputeEffectxx(dat,fit,"indirect")
to <- ComputeEffectxx(dat,fit,"total")
## effects computed by estimating integrals
print(c(d,i,to))
## effects using model linearity assumption
ComputeEffectsLinear(fit) ## based on sample
## exact effects using simulation coefficients
ComputeEffectsLinear(params) ## exact
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.