Compute Global Standardized Mean Difference (GSD)
gsd.RdEstimates the Global Standardized Mean Difference (GSD), a standardized mean difference used for assessing balance in covariate distributions between treatment groups. The GSD is reported as a percentage and is widely used in propensity score weighting methods.
Arguments
- object
An optional object of class `"lbc_net"`, from which `Z`, `Tr`, and `weights` are extracted.
- Z
A numeric matrix, data frame, or vector of covariates. Required if `object` is not provided.
- Tr
A numeric vector (0/1) indicating treatment assignment. Required if `object` is not provided.
- ps
A numeric vector of propensity scores (\(0 < ps < 1\)). Used to compute weights as: $$\frac{w^*(ps)}{Tr \cdot ps + (1 - Tr) \cdot (1 - ps)}.$$ The argument
ATEmust be specified: ifATE = 1, then \(w^*(ps) = 1\); ifATE = 0, then \(w^*(ps) = ps\). Ignored ifwtis provided.- wt
A numeric vector of inverse probability weights (IPW) or other balancing weights. If provided, `ps` is ignored.
- ate_flag
An integer (0 or 1) specifying the target estimand. The default is 1, which estimates the Average Treatment Effect (ATE) by weighting all observations equally. Setting it to 0 estimates the Average Treatment Effect on the Treated (ATT), where only treated units are fully weighted while control units are downweighted based on their propensity scores. Ignored if
wtis provided. Seelbc_netfor more information on ATT, ATE, and their corresponding weighting schemes.- ...
Additional arguments passed to the specific method.
Details
Definition of GSD:
The GSD measures covariate balance across treatment groups: $$ GSD = \frac{| \mu_1 - \mu_0 | }{ \sqrt{ ( m_1 v_1 + m_0 v_0 )/(m_1 + m_0) } } \times 100\% $$ where:
- \(\mu_1\) and \(\mu_0\) are the IPTW-weighted means for the treated and control groups: $$ \mu_1 = \frac{\sum_{i=1}^{N} T_i W_i X_i }{ \sum_{i=1}^{N} T_i W_i }, \quad \mu_0 = \frac{\sum_{i=1}^{N} (1-T_i) W_i X_i }{ \sum_{i=1}^{N} (1-T_i) W_i }. $$
- \(v_1\) and \(v_0\) are the corresponding weighted variances: $$ v_1 = \frac{\sum_{i=1}^{N} T_i W_i (X_i - \mu_1)^2 }{ \sum_{i=1}^{N} T_i W_i - 1 }, \quad v_0 = \frac{\sum_{i=1}^{N} (1-T_i) W_i (X_i - \mu_0)^2 }{ \sum_{i=1}^{N} (1-T_i) W_i - 1 }. $$
- \(m_1\) and \(m_0\) are the effective sample sizes (ESS) of the treated and control groups: $$ m_1 = \frac{ (\sum_{i=1}^{N} T_i W_i)^2 }{ \sum_{i=1}^{N} T_i W_i^2 }, \quad m_0 = \frac{ (\sum_{i=1}^{N} (1-T_i) W_i)^2 }{ \sum_{i=1}^{N} (1-T_i) W_i^2 }. $$
Automatic Extraction from `lbc_net` Object if an `lbc_net` object is provided.
Examples
# Example with manually provided inputs
set.seed(123)
Z <- matrix(rnorm(200), nrow = 100, ncol = 2)
Tr <- rbinom(100, 1, 0.5)
ps <- runif(100, 0.1, 0.9) # Simulated propensity scores
# Compute GSD using propensity scores
gsd(Z = Z, Tr = Tr, ps = ps)
#> V1 V2
#> -14.193571 2.216594
# Compute GSD using weights
wt <- 1 / (Tr * ps + (1 - Tr) * (1 - ps)) # Convert ps to weights
gsd(Z = Z, Tr = Tr, wt = wt)
#> V1 V2
#> -14.193571 2.216594
if (FALSE) { # \dontrun{
# Example with an lbc_net object
model <- lbc_net(data = data, formula = Tr ~ X1 + X2 + X3 + X4)
gsd(model)
} # }