add_spl_est | R Documentation |
This function estimates the ADRF with an additive spline estimator described in Bia et al. (2014).
add_spl_est(Y, treat, treat_formula, data, grid_val, knot_num, treat_mod, link_function, ...)
Y |
is the the name of the outcome variable contained in |
treat |
is the name of the treatment variable contained in
|
treat_formula |
an object of class "formula" (or one that can be
coerced to that class) that regresses |
data |
is a dataframe containing |
grid_val |
contains the treatment values to be evaluated. |
knot_num |
is the number of knots used in outcome model |
treat_mod |
a description of the error distribution to be used in the
model for treatment. Options include: |
link_function |
is either "log", "inverse", or "identity" for the
"Gamma" |
... |
additional arguments to be passed to the outcome regression fitting function. |
This function estimates the ADRF using additive splines in the outcome model described in Bia et al. (2014).
add_spl_est
returns an object of class "causaldrf",
a list that contains the following components:
param |
parameter estimates for a add_spl fit. |
t_mod |
the result of the treatment model fit. |
out_mod |
the result of the outcome model fit. |
call |
the matched call. |
Schafer, J.L., Galagate, D.L. (2015). Causal inference with a continuous treatment and outcome: alternative estimators for parametric dose-response models. Manuscript in preparation.
Bia, Michela, et al. (2014). A Stata package for the application of semiparametric estimators of dose response functions. Stata Journal 14.3, 580-604.
nw_est
, iw_est
, hi_est
, gam_est
,
bart_est
, etc. for other estimates.
t_mod
, overlap_fun
to prepare the data
for use in the different estimates.
## Example from Schafer (2015). example_data <- sim_data add_spl_list <- add_spl_est(Y = Y, treat = T, treat_formula = T ~ B.1 + B.2 + B.3 + B.4 + B.5 + B.6 + B.7 + B.8, data = example_data, grid_val = seq(8, 16, by = 1), knot_num = 3, treat_mod = "Normal") sample_index <- sample(1:1000, 100) plot(example_data$T[sample_index], example_data$Y[sample_index], xlab = "T", ylab = "Y", main = "additive spline estimate") lines(seq(8, 16, by = 1), add_spl_list$param, lty = 2, lwd = 2, col = "blue") legend('bottomright', "additive spline estimate", lty=2, lwd = 2, col = "blue", bty='Y', cex=1) rm(example_data, add_spl_list, sample_index) ## See Vignette for more examples.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.