Description Usage Arguments Methods (by class) Author(s) Examples
This function provides estimation and inference for the Population Intervention Indirect Effect (PIIE) as described in Fulcher et al. (2017). The outcome and intermediate variables must be continuous as a linear model is used to model the means. Similarly, the exposure variable must be binary as a logistic model is used.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | piieffect(data, outcome, intermediate, exposure, covariates.outcome,
covariates.intermediate, covariates.exposure, interaction, astar)
## S4 method for signature
## 'data.frame,
## character,
## character,
## character,
## vector,
## vector,
## vector,
## numeric,
## numeric'
piieffect(data,
outcome, intermediate, exposure, covariates.outcome = c(1),
covariates.intermediate = c(1), covariates.exposure = c(1),
interaction = 1, astar = 0)
|
data |
A dataframe |
outcome |
The variable name for the outcome variable in data |
intermediate |
The variable name for the intermediate variable in data |
exposure |
The variable name for the exposure variable in data |
covariates.outcome |
A vector of variable names for covariates to be included in the outcome model |
covariates.intermediate |
A vector of variable names for covariates to be included in the outcome model |
covariates.exposure |
A vector of variable names for covariates to be included in the exposure model |
interaction |
A binary variable indicating if an interaction term between intermediate and exposure is needed |
astar |
A numeric value for the level of the exposure the intermediate value takes |
data = data.frame,outcome = character,intermediate = character,exposure = character,covariates.outcome = vector,covariates.intermediate = vector,covariates.exposure = vector,interaction = numeric,astar = numeric
: Generic/Function
Isabel Fulcher
1 2 3 4 5 6 7 8 | #Load example dataset
simdata <- readRDS(system.file("rds","simdata1.rds",package="frontdoorpiie"))
#Create an interaction term among covariates
simdata$c1c2 <- simdata$c1*simdata$c2
#Apply the function to estimate PIIE
example <- piieffect(data=simdata,outcome="y",intermediate="m",exposure="a",
covariates.outcome=c("c1","c2","c1c2"),covariates.intermediate=c("c1","c2","c1c2"),covariates.exposure=c("c1","c2","c1c2"),
interaction=1,astar=0)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.