Skip to contents

Estimate the population-average risk difference between two treatments using augmented inverse probability weighting (AIPW). Bootstrap resampling provides a standard error, confidence interval, and p-value.

Usage

atefitbinary(
  data,
  cate.model,
  ps.model,
  ps.method = "glm",
  minPS = 0.01,
  maxPS = 0.99,
  interactions = TRUE,
  n.boot = 500,
  seed = NULL,
  verbose = 0,
  ps.control = list()
)

Arguments

data

A data frame containing the outcome, treatment, and covariates.

cate.model

A formula with the binary outcome on the left and outcome model covariates on the right. The outcome must be numeric or logical and coded 0/1; missing values and offsets are not supported.

ps.model

A formula with treatment on the left and treatment-model covariates on the right. The model estimates the propensity score. Both treatment groups must be present. Numeric 0/1 or logical FALSE/TRUE map to treatment 0/1; other two-valued labels are sorted and mapped to 0/1 in that order. Use trt ~ 1 for an intercept-only model.

ps.method

Propensity score method: "glm" (default) or "lasso", using the package's propensity-score LASSO procedure.

minPS, maxPS

Lower and upper truncation limits for propensity scores. Defaults are 0.01 and 0.99; minPS must be smaller than maxPS.

interactions

If TRUE (default), include interactions between treatment and all outcome-model covariates. If FALSE, fit a pooled logistic outcome model with a treatment main effect and no interactions.

n.boot

Number of bootstrap samples, an integer of at least 2. Default is 500.

seed

An optional integer seed; NULL uses the current random number state. Supplying a seed sets R's random-number state.

verbose

Accepted for compatibility with the other ATE functions; the binary implementation does not currently display progress messages.

ps.control

Named options for LASSO propensity-score interaction screening. Supported entry: solver = "C" (default) or "R".

Value

An object of class atefit containing:

  • risk.difference: A data frame with the estimate for treatment 1 minus treatment 0, bootstrap standard error, 95% Wald confidence limits, and two-sided Wald p-value.

  • risk0, risk1: Data frames with estimated treatment-specific response probabilities.

  • trt.boot: Bootstrap risk differences; risk.boot: bootstrap treatment-specific risks; n.boot: number of replicates.

  • treatment.labels: Original treatment labels in 0/1 order.

  • bootstrap.diagnostics: A data frame containing the replicate number, affected measure and reason for each failed or non-finite estimate.

Details

The estimator combines predicted risks from a logistic outcome model with inverse-propensity-weighted residual corrections. Under appropriate identification and regularity assumptions, it is consistent if either the outcome model or treatment model is correctly specified. A causal interpretation also requires consistency, no unmeasured confounding and adequate treatment overlap. Propensity score truncation can affect the guarantee based on the treatment model. AIPW risk estimates need not lie in [0, 1]. Outcomes should be fully observed for the intended follow-up horizon; this function does not adjust for censoring.

Each bootstrap replicate refits both models. If any replicate for the risk difference fails or is non-finite, inference is unavailable; failures are summarized in a warning and stored in bootstrap.diagnostics. diagnostics() can be used to inspect the records. The point estimate and standard error are returned by coef() and through the result object; confint() calculates Wald intervals at a requested level.

References

Hoogland, J., IntHout, J., Belias, M., et al. (2021). A tutorial on individualized treatment effect prediction from randomized trials with a binary endpoint. Statistics in Medicine, 40(26), 5961–5981. doi:10.1002/sim.9154

Author

Thomas Debray tdebray@fromdatatowisdom.com

Examples

d <- simulate_binary(n = 500, seed = 42)
fit <- atefitbinary(d, cate.model = y ~ age + female,
                    ps.model = trt ~ age, n.boot = 10, seed = 42)
coef(fit)
#> risk.difference 
#>      -0.0287478 
confint(fit)
#>                       2.5 %     97.5 %
#> risk.difference -0.09705359 0.03955799