R/confint.R
confint.ipw_haldensify.Rd
Confidence Intervals for IPW Estimates of the Causal Effects of Stochatic Shift Interventions
An object of class ipw_haldensify
, produced by invoking
the function ipw_shift
, for which a confidence interval is to
be computed.
A numeric
vector indicating indices of object$est
for which to return confidence intervals.
A numeric
indicating the nominal level of the confidence
interval to be computed.
Other arguments. Not currently used.
A named numeric
vector containing the parameter estimate from
a ipw_haldensify
object, alongside lower/upper Wald-style confidence
intervals at a specified coverage level.
Compute confidence intervals for estimates produced by
ipw_shift
.
# 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)
)
#> Warning: Some fit_control arguments are neither default nor glmnet/cv.glmnet arguments: n_folds;
#> They will be removed from fit_control
#> 2% of observations outside training support...predictions trimmed.
#> Warning: Some fit_control arguments are neither default nor glmnet/cv.glmnet arguments: n_folds;
#> They will be removed from fit_control
#> Warning: Dropping reduce_basis; only applies if smoothness_orders = 0
confint(est_ipw)
#> # A tibble: 2 × 8
#> lwr_ci psi upr_ci se_est type l1_norm lambda_idx gn_nbins
#> <dbl> <dbl> <dbl> <dbl> <chr> <dbl> <dbl> <int>
#> 1 0.600 0.760 0.869 0.0693 dcar_tol 6.62 39 5
#> 2 0.600 0.760 0.869 0.0693 dcar_min 6.62 39 5