Calculate inverse probability of treatment weights (IPTW)
Source:R/ipw_weights.R
morie_calculate_ipw_weights.RdMirrors the Python morie.calculate_ipw_weights(). Pure-R, no extra
dependencies.
Usage
morie_calculate_ipw_weights(
data,
treatment,
ps_col,
stabilized = FALSE,
trim_quantiles = NULL
)Arguments
- data
A
data.framecontaining treatment assignment and propensity scores.- treatment
Column name (string) of the binary treatment.
- ps_col
Column name (string) of the propensity scores.
- stabilized
If
TRUE, return stabilised IPW weights. DefaultFALSE.- trim_quantiles
Optional length-2 numeric vector \((q_l, q_u)\) in \(`[0, 1]`\); if supplied, weights are clipped to the \(q_l\)-th and \(q_u\)-th quantiles of the unclipped weight distribution (Crump et al. 2009 trimming). Default
NULL.