Description Usage Arguments Details Value Examples
Working marginal structural model for causal effects of an intervention grid
1 2 3 4 5 6 7 8 9 10 11 12 13 14 
Y 
A 
A 
A 
W 
A 
C 
A 
V 
The covariates that are used in determining the sampling procedure
that gives rise to censoring. The default is 
delta_grid 
A 
msm_form 
A 
estimator 
The type of estimator to be fit, either 
weighting 
Whether to weight each parameter estimate by the inverse of
its variance (in order to improve stability of the resultant MSM fit) or to
simply weight all parameter estimates equally. The default is the option

ci_level 
A 
ci_type 
Whether to construct a simultaneous confidence band covering all parameter estimates at once or marginal confidence intervals covering each parameter estimate separately. The default is to construct marginal confidence intervals for each parameter estimate rather than a simultaneous confidence band. 
... 
Additional arguments to be passed to 
Computes estimates of the counterfactual mean over a grid of shift stochastic interventions and fits a working marginal structural model to summarize the trend through the counterfactual means as a function of the specified shift intervention. The working marginal structural model may be linear in the shift parameter or piecewise linear with a single knot point. Provides support for two weighting schemes, may be used with either of the onestep or TML estimators, and also allows the construction of marginal or simultaneous confidence intervals.
A list
containing estimates of the individual counterfactual
means over a grid in the shift parameters (delta_grid
), alongside
the estimate of a marginal structural model that summarizes a trend through
these counterfactual means.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37  if (require("sl3")) {
n_obs < 100
W < as.numeric(replicate(1, rbinom(n_obs, 1, 0.5)))
A < as.numeric(rnorm(n_obs, mean = 2 * W, sd = 1))
Y < rbinom(n_obs, 1, plogis(2 * A  W))
msm < msm_vimshift(
W = W, A = A, Y = Y, estimator = "tmle",
g_fit_args = list(
fit_type = "sl",
sl_learners_density = Lrnr_density_hse$new(Lrnr_glm$new())
),
Q_fit_args = list(
fit_type = "glm",
glm_formula = "Y ~ ."
),
delta_grid = seq(1, 1, 0.25)
)
# fit a linear spline with knot at 0
n_obs < 100
W < as.numeric(replicate(1, rbinom(n_obs, 1, 0.5)))
A < as.numeric(rnorm(n_obs, mean = 2 * W, sd = 1))
Y < rbinom(n_obs, 1, plogis(0.1 * A * (A >= 0)  3 * A * (A < 0)  W))
msm < msm_vimshift(
W = W, A = A, Y = Y, estimator = "tmle",
g_fit_args = list(
fit_type = "sl",
sl_learners_density = Lrnr_density_hse$new(Lrnr_glm$new())
),
Q_fit_args = list(
fit_type = "glm",
glm_formula = "Y ~ ."
),
delta_grid = seq(1, 1, 0.25),
msm_form = list(type = "piecewise", knot = 0)
)
}

Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.