| calculate_ipw_weights | R Documentation |
Functions for calculating propensity score weights with optional trimming for binary and multiple treatment groups. Calculate Inverse Probability Weights (IPW)
Calculates inverse probability weights for binary or multiple treatment groups. For ATE (Average Treatment Effect), weights are 1/e_j(X) for each treatment j. For ATT (Average Treatment Effect on the Treated), weights target a specific treatment group.
calculate_ipw_weights(
ps_result,
data,
treatment_var,
estimand = "ATE",
att_group = NULL
)
ps_result |
A list returned by
|
data |
A data.frame containing the treatment variable. |
treatment_var |
A character string specifying the name of the treatment
variable in |
estimand |
Character string specifying the estimand. One of "ATE" (default) or "ATT" (Average Treatment Effect on the Treated). |
att_group |
For ATT estimation, specifies which treatment group to target. This is MANDATORY when estimand = "ATT". |
For ATE with multiple treatments, weights are:
w_j(X_i) = \frac{1}{e_j(X_i)} \text{ for individual i in treatment j}
For ATT targeting treatment k, weights are:
w_j(X_i) = \begin{cases}
1 & \text{if } j = k \\
\frac{e_k(X_i)}{e_j(X_i)} & \text{if } j \neq k
\end{cases}
A numeric vector of IPW weights with length equal to nrow(data).
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.