Balancing weights under a WeightIt-style method name. The methods
this package has engines for run natively and give the same weights
whatever is installed: "glm" / "ps" (logistic propensity
weights, morie_weight_ps), "cbps"
(morie_weight_cbps), "ebal" / "entropy"
(morie_weight_entropy for the ATT, morie_weightit
otherwise) and "ipt" (morie_weightit). Any other method
("energy", "optweight", "bart", ...) is passed to
WeightIt::weightit(), which must then be installed; the error says
so and names the native methods.
Usage
morie_causal_weighting(
data,
treatment,
covariates,
method = "glm",
estimand = c("ATE", "ATT", "ATC"),
...
)Arguments
- data
A data frame.
- treatment
Name of the treatment column (binary, multinomial, or continuous depending on
method).- covariates
Character vector of covariate names.
- method
One of
"glm","cbps","ebal","ipt","ps","energy","optweight", or any other method accepted byWeightIt::weightit().- estimand
One of
"ATE","ATT","ATC"; defaults to"ATE".- ...
Additional arguments forwarded to
WeightIt::weightit()(non-native methods only).
Value
Named list with elements weights (numeric vector),
propensity_scores (numeric vector or NULL),
method, estimand, ess (effective sample
size), and weightit (the WeightIt object for a non-native
method, NULL otherwise).
References
Greifer N (2024). WeightIt: Weighting for Covariate Balance in Observational Studies. R package version 1.4.0.
Examples
set.seed(1)
w <- morie_causal_weighting(data = data.frame(t = rbinom(40, 1, 0.4),
x = rnorm(40)), treatment = "t", covariates = "x")
w$ess
#> [1] 38.295
