A unified function for covariate balance assessment and treatment effect estimation. Combines a formal balance test (via classification permutation test), visual diagnostics (propensity score distributions), and treatment effect estimates using both difference-in-means and augmented inverse propensity weighting (AIPW).
Usage
balance(
Y = NULL,
W,
X,
alpha = 0.05,
perm.N = 1000,
class.method = "ferns",
seed = 1995,
fastcpt.args = list()
)
# S3 method for class 'balance'
print(x, ...)
# S3 method for class 'balance'
summary(object, ...)
# S3 method for class 'balance'
plot(x, which = "all", combined = TRUE, breaks = 15, ...)Arguments
- Y
Outcome vector (numeric) or
NULL. IfNULL, treatment effect estimation (and the treatment effect plot) is skipped.- W
Treatment assignment vector (binary: 0/1 or logical).
- X
Pre-treatment covariate matrix or data frame.
- alpha
Significance level for balance test. Default is 0.05.
- perm.N
Number of permutations for the balance test. Default is 1000.
- class.method
Classification method for balance test. Default is "ferns".
- seed
Random seed for reproducibility. Default is 1995.
- fastcpt.args
A named list of additional arguments to pass to
fastcpt. For example,fastcpt.args = list(parallel = TRUE, leaveout = 0.2).- x
A balance result object.
- ...
Additional arguments (currently unused).
- object
A balance result object (for summary method).
- which
Character vector specifying which plots to create. Options are "pscores", "null_dist", "effects", or "all".
- combined
Logical. If TRUE, displays all three plots in a combined panel. Default is TRUE.
- breaks
Number of breaks for histograms. Default is 15.
Value
A list of class "balance" containing:
- balance_test
Results from fastcpt including p-value and propensity scores.
- dim
Difference-in-means estimate with standard error and confidence interval (only if
Yis provided).- aipw
Doubly robust estimate from causal forest (with propensity weighting) with standard error and CI (only if
Yis provided).- aipw_const
Outcome-adjusted estimate from causal forest (no propensity weighting) with SE and CI (only if
Yis provided).- passed
Logical indicating whether the balance test passed.
- alpha
The significance level used.
- cf
The fitted causal_forest object for advanced users (only if
Yis provided).