calibrate | R Documentation |
calibrate()
performs Platt scaling to calibrate propensity scores as recommended by Gutman et al. (2024). This involves fitting a new propensity score model using logistic regression with the previously estimated propensity score as the sole predictor. Weights are computed using this new propensity score.
calibrate(x, ...)
## Default S3 method:
calibrate(x, treat, s.weights = NULL, data = NULL, ...)
## S3 method for class 'weightit'
calibrate(x, ...)
x |
A |
... |
Not used. |
treat |
A vector of treatment status for each unit. Only binary treatments are supported. |
s.weights |
A vector of sampling weights or the name of a variable in
|
data |
An optional data frame containing the variable named in |
If the input is a weightit
object, the output will be a
weightit
object with the propensity scores replaced with the calibrated propensity scores and the weights replaced by weights computed from the calibrated propensity scores.
If the input is a numeric vector of weights, the output will be a numeric vector of the calibrated propensity scores.
Gutman, R., Karavani, E., & Shimoni, Y. (2024). Improving Inverse Probability Weighting by Post-calibrating Its Propensity Scores. Epidemiology, 35(4). \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1097/EDE.0000000000001733")}
weightit()
, weightitMSM()
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.