Description Usage Arguments Value Examples
TTS
is used to estimate natural direct and natural indirect effects using the methods of
Tchetgen Tchetgen Shpitser (2012). This implementation can be used with a binary exposure, binary or continuous
mediator, and continuous outcome. Linear models are used to model the conditional expectation of continuous quantities,
and logisitc regression models are used to model binary quantities. As with the plmed
function,
the confounder set is the union terms in the exposure.formula
,
mediator.formula
, and outcome.formula
. Missing data behaviour is always na.action=na.omit
.
1 2 3 4 5 6 7 8 |
exposure.formula |
an object of class |
mediator.formula |
an object of class |
outcome.formula |
an object of class |
mediator.family |
link function for the mediator model, can be either |
data |
an optional data frame, list or environment
(or object coercible by |
An object of class plmed
with Total Effect (TE), Natural Direct Effect (NDE) and
Natural Indirect Effect (NIDE) estimates, with estimated standard errors, and
Wald based test statistics.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | #Example on Generated data
N <- 100
beta <- c(1,0,1) #Some true parameter values
#Generate data on Confounders (Z), Exposure (X)
#Mediator (M), Outcome (Y)
Z <- rnorm(N)
X <- rbinom(N,1,1/(exp(-Z)+1))
M <- beta[1]*X + Z +rnorm(N)
Y <- beta[2]*M + beta[3]*X + Z +rnorm(N)
TTS(X~Z,M~Z,Y~Z,"gaussian")
#Example on Generated data
N <- 100
beta <- c(1,0,1) #Some true parameter values
#Generate data on Confounders (Z), Exposure (X)
#Mediator (M), Outcome (Y)
Z <- rnorm(N)
X <- rbinom(N,1,plogis(Z))
M <- rbinom(N,1,plogis(X+Z))
Y <- beta[2]*M + beta[3]*X + Z +rnorm(N)
TTS(X~Z,M~Z,Y~Z,"binomial")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.