View source: R/CausalMediation.R
CausalMediation | R Documentation |
CausalMediation utilizes models from regmedint package
CausalMediation(
data,
OutcomeTargetVariable = NULL,
TreatmentVariable = NULL,
MediatorVariable = NULL,
Covariates = NULL,
MM_TreatmentCovariates = NULL,
OM_TreatmentCovariates = NULL,
OM_MediatorCovariates = NULL,
SurvivalEventVariable = NULL,
UnTreated_ReferenceIndicator = NULL,
Treated_ReferenceIndicator = NULL,
Mediator_ControlDirectEffectLevel = NULL,
Covariate_NaturalDirectIndirect = 0,
MediatorTargetType = "linear",
OutcomeTargetType = "linear",
TreatmentMediatorInteraction = TRUE,
CaseControlSourceData = FALSE,
RemoveNA = FALSE
)
data |
Data frame containing the following relevant variables. |
OutcomeTargetVariable |
yvar in underlying model. A character vector of length 1. Outcome variable name. It should be the time variable for the survival outcome. |
TreatmentVariable |
avar in underlying model. A character vector of length 1. Treatment variable name. |
MediatorVariable |
mvar in underlying model. A character vector of length 1. Mediator variable name. |
Covariates |
For main model |
MM_TreatmentCovariates |
emm_ac_mreg in underlying model. A character vector of length > 0. Effect modifiers names. The covariate vector in treatment-covariate product term in the mediator model. |
OM_TreatmentCovariates |
emm_ac_yreg in underlying model. A character vector of length > 0. Effect modifiers names. The covariate vector in treatment-covariate product term in the outcome model. |
OM_MediatorCovariates |
emm_mc_yreg in underlying model. A character vector of length > 0. Effect modifiers names. The covariate vector in mediator-covariate product term in outcome model. |
SurvivalEventVariable |
eventvar in underlying model. An character vector of length 1. Only required for survival outcome regression models. Note that the coding is 1 for event and 0 for censoring, following the R survival package convention. |
UnTreated_ReferenceIndicator |
a0 in underlying model. A numeric vector of length 1. The reference level of treatment variable that is considered "untreated" or "unexposed". |
Treated_ReferenceIndicator |
a1 in underlying model. A numeric vector of length 1. |
Mediator_ControlDirectEffectLevel |
m_cde in underlying model. A numeric vector of length 1. Mediator level at which controlled direct effect is evaluated at. |
Covariate_NaturalDirectIndirect |
c_cond in underlying model. A numeric vector of the same length as |
MediatorTargetType |
mreg in underlying model. A character vector of length 1. Mediator regression type: |
OutcomeTargetType |
yreg in underlying model. A character vector of length 1. Outcome regression type: |
TreatmentMediatorInteraction |
interaction in underlying model. A logical vector of length 1. The presence of treatment-mediator interaction in the outcome model. Default to TRUE. |
CaseControlSourceData |
casecontrol in underlying model. A logical vector of length 1. Default to FALSE. Whether data comes from a case-control study. |
RemoveNA |
na_omit in underlying model. A logical vector of length 1. Default to FALSE. Whether to remove NAs in the columns of interest before fitting the models. |
ConfoundingVariables |
cvar in underlying model. A character vector of length > 0. Covariate names. Use |
list with model output object, summary output, effects output, and an effects plot
Adrian Antico
## Not run:
library(regmedint) # to load vv2015
data(vv2015)
Output <- AutoQuant::CausalMediation(
data = vv2015,
OutcomeTargetVariable = 'y', # yvar char length = 0
TreatmentVariable = "x", # avar char length = 0 (binary)
MediatorVariable = "m", # mvar char length = 0 (binary)
Covariates = "c", # cvar char length > 0
MM_TreatmentCovariates = NULL, # emm_ac_mreg = NULL char length > 0
OM_TreatmentCovariates = NULL, # emm_ac_yreg = NULL char length > 0
OM_MediatorCovariates = NULL, # emm_mc_yreg = NULL char length > 0
SurvivalEventVariable = "event", # eventvar char length = 0
UnTreated_ReferenceIndicator = 0, # ao num length = 1
Treated_ReferenceIndicator = 1, # a1 num length = 1
Mediator_ControlDirectEffectLevel = 1, # m_cde num length = 1
Covariate_NaturalDirectIndirect = 3, # c_cond; same length as Covariates num length = length(Covariates)
MediatorTargetType = 'logistic', # mreg "linear" or "logistic",
OutcomeTargetType = 'survAFT_weibull', # yreg "linear", "logistic", "loglinear", "poisson", "negbin", "survCox", "survAFT_exp", or "survAFT_weibull"
TreatmentMediatorInteraction = TRUE, # interaction = TRUE,
CaseControlSourceData = FALSE, # casecontrol = FALSE,
RemoveNA = FALSE)
# data = vv2015
# OutcomeTargetVariable = 'y'
# TreatmentVariable = "x"
# MediatorVariable = "m"
# Covariates = "c"
# MM_TreatmentCovariates = NULL
# OM_TreatmentCovariates = NULL
# OM_MediatorCovariates = NULL
# SurvivalEventVariable = "event"
# UnTreated_ReferenceIndicator = 0
# Treated_ReferenceIndicator = 1
# Mediator_ControlDirectEffectLevel = 1
# Covariate_NaturalDirectIndirect = 3
# MediatorTargetType = 'logistic'
# OutcomeTargetType = 'survAFT_weibull'
# TreatmentMediatorInteraction = TRUE
# CaseControlSourceData = FALSE
# RemoveNA = FALSE
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.