Fit intermediate confounding mechanism with(out) conditioning on mediators
Source:R/fit_mechanisms.R
fit_moc_mech.RdFit intermediate confounding mechanism with(out) conditioning on mediators
Usage
fit_moc_mech(
train_data,
valid_data = NULL,
contrast,
learners,
m_names,
w_names,
type = c("q", "r")
)Arguments
- train_data
A
data.tablecontaining observed data, with columns in the order specified by the NPSEM (Y, M, R, Z, A, W), with column names set appropriately based on the input data. Such a structure is a convenience utility to passing data around to the various core estimation routines and is automatically generated bymedoutcon.- valid_data
A holdout data set, with columns exactly matching those appearing in the preceding argument
data, to be used for estimation via cross-fitting. Optional, defaulting toNULL.- contrast
A
numericdouble indicating the two values of the interventionAto be compared. The default value ofc(0, 1)assumes a binary intervention nodeA.- learners
Stack, or other learner class (inheriting fromLrnr_base), containing a set of learners from sl3, to be used in fitting a model for the intermediate confounding mechanism, i.e., q = E[z|a',W] and r = E[z|a',m,w]).- m_names
A
charactervector of the names of the columns that correspond to mediators (M). The input for this argument is automatically generated by a call to the wrapper functionmedoutcon.- w_names
A
charactervector of the names of the columns that correspond to baseline covariates (W). The input for this argument is automatically generated bymedoutcon.- type
A
charactervector indicating whether to condition on the mediators (M) or not. Specifically, this is an option for specifying one of two types of nuisance regressions: "r" is defined as the component that conditions on the mediators (i.e., r = E[z|a',m,w]) while "q" is defined as the component that does not (i.e., q = E[z|a',w]).