if (FALSE) { # requireNamespace("gbm", quietly = TRUE)
library("cobalt")
data("lalonde", package = "cobalt")
#Using GBM to estimate weights
(W <- weightit(treat ~ age + educ + married +
nodegree + re74, data = lalonde,
method = "gbm", estimand = "ATT",
criterion = "smd.max"))
summary(W)
#Calibrating the GBM propensity scores
Wc <- calibrate(W)
#Calibrating propensity scores directly
PSc <- calibrate(W$ps, treat = lalonde$treat)
}
Run the code above in your browser using DataLab