Computes the effective sample size (ESS) of a weighted sample, which represents the size of an unweighted sample with approximately the same amount of precision as the weighted sample under consideration.
The ESS is calculated as \((\sum w)^2/\sum w^2\).
References
McCaffrey, D. F., Ridgeway, G., & Morral, A. R. (2004). Propensity Score Estimation With Boosted Regression for Evaluating Causal Effects in Observational Studies. Psychological Methods, 9(4), 403–425. doi:10.1037/1082-989X.9.4.403
Shook‐Sa, B. E., & Hudgens, M. G. (2020). Power and sample size for observational studies of point exposure effects. Biometrics, biom.13405. doi:10.1111/biom.13405
Examples
library("cobalt")
#> cobalt (Version 4.5.5, Build Date: 2024-04-02)
data("lalonde", package = "cobalt")
#Balancing covariates between treatment groups (binary)
(W1 <- weightit(treat ~ age + educ + married +
nodegree + re74, data = lalonde,
method = "glm", estimand = "ATE"))
#> A weightit object
#> - method: "glm" (propensity score weighting with GLM)
#> - number of obs.: 614
#> - sampling weights: none
#> - treatment: 2-category
#> - estimand: ATE
#> - covariates: age, educ, married, nodegree, re74
summary(W1)
#> Summary of weights
#>
#> - Weight ranges:
#>
#> Min Max
#> treated 1.5560 |--------------------------| 73.3315
#> control 1.0222 || 3.0438
#>
#> - Units with the 5 most extreme weights by group:
#>
#> 124 184 172 181 182
#> treated 11.2281 11.3437 12.0848 26.1775 73.3315
#> 411 595 269 409 296
#> control 2.3303 2.4365 2.5005 2.6369 3.0438
#>
#> - Weight statistics:
#>
#> Coef of Var MAD Entropy # Zeros
#> treated 1.609 0.555 0.403 0
#> control 0.247 0.211 0.029 0
#>
#> - Effective Sample Sizes:
#>
#> Control Treated
#> Unweighted 429. 185.
#> Weighted 404.35 51.73
ESS(W1$weights[W1$treat == 0])
#> [1] 404.3484
ESS(W1$weights[W1$treat == 1])
#> [1] 51.73462