ipw_shift | R Documentation |
IPW Estimator of the Causal Effects of Additive Modified Treatment Policies
ipw_shift(
W,
A,
Y,
delta = 0,
n_bins = make_bins(A, "hist"),
cv_folds = 10L,
lambda_seq,
...,
bin_type = c("equal_range", "equal_mass"),
selector_type = c("dcar", "plateau", "gcv", "all")
)
W |
A |
A |
A |
Y |
A |
delta |
A |
n_bins |
A |
cv_folds |
A |
lambda_seq |
A |
... |
Additional arguments for model fitting to be passed directly to
|
bin_type |
A |
selector_type |
A |
# simulate data
n_obs <- 50
W1 <- rbinom(n_obs, 1, 0.6)
W2 <- rbinom(n_obs, 1, 0.2)
W3 <- rpois(n_obs, 3)
A <- rpois(n_obs, 3 * W1 - W2 + 2 * W1 * W2 + 4)
Y <- rbinom(n_obs, 1, plogis(A + W1 + W2 - W3 - W1 * W3))
# fit the IPW estimator
est_ipw <- ipw_shift(
W = cbind(W1, W2, W3), A = A, Y = Y,
delta = 0.5, cv_folds = 2L,
n_bins = 5L, bin_type = "equal_range",
lambda_seq = exp(seq(-1, -10, length = 100L)),
# arguments passed to hal9001::fit_hal()
max_degree = 3,
smoothness_orders = 0,
num_knots = NULL,
reduce_basis = 1 / sqrt(n_obs)
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.