CBPS
Objectsbal.tab.CBPS.Rd
Generates balance statistics for CBPS
and CBMSM
objects from the CBPS package.
# S3 method for CBPS
bal.tab(x,
stats,
int = FALSE,
poly = 1,
distance = NULL,
addl = NULL,
data = NULL,
continuous,
binary,
s.d.denom,
thresholds = NULL,
weights = NULL,
cluster = NULL,
imp = NULL,
pairwise = TRUE,
s.weights = NULL,
abs = FALSE,
subset = NULL,
quick = TRUE,
...)
a CBPS
or CBMSM
object; the output of a call to CBPS::CBPS()
or CBPS::CBMSM()
.
see bal.tab()
for details.
See below for special notes on the distance
, addl
, s.d.denom
, and s.weights
arguments.
The following arguments have special notes when used with CBPS
or CBMSM
objects:
propensity scores generated by CBPS()
and CBMSM()
are automatically included and named "prop.score". For CBMSM
objects, each dataset in the list supplied to distance
must have one row per individual, unlike the data frame in the original call to CBMSM()
.
for CBMSM
objects, each dataset in the list supplied to addl
must have one row per individual, unlike the data frame in the original call to CBMSM()
.
if not specified, bal.tab()
will use "treated" if the estimand of the call to CBPS()
is the ATT and "pooled" if the estimand is the ATE.
the CBPS
object does not return sampling weights even if they are used; rather, the weights returned already have the sampling weights combined within them. Because some of the checks and defaults in bal.tab()
rely on patterns in these weights, using sampling weights in CBPS()
without specifying them in bal.tab()
can lead to incorrect results. If sampling weights are used in CBPS()
, it is important that they are specified in bal.tab()
as well using the s.weights
argument.
bal.tab.CBPS()
and bal.tab.CBMSM()
generate a list of balance summaries for the CBPS
or CBMSM
object given and functions similarly to CBPS::balance()
.
For point treatments, if clusters are not specified, an object of class "bal.tab"
containing balance summaries for the CBPS
object. See bal.tab()
for details.
If clusters are specified, an object of class "bal.tab.cluster"
containing balance summaries within each cluster and a summary of balance across clusters. See bal.tab.cluster
for details.
If CBPS()
is used with multi-category treatments, an object of class "bal.tab.multi"
containing balance summaries for each pairwise treatment comparison and a summary of balance across pairwise comparisons. See bal.tab.multi
for details.
If CBMSM()
is used for longitudinal treatments, an object of class "bal.tab.msm"
containing balance summaries for each time period and a summary of balance across time periods. See bal.tab.msm
for details.
bal.tab()
for details of calculations.
bal.tab.cluster
for more information on clustered data.
bal.tab.multi
for more information on multi-category treatments.
bal.tab.msm
for more information on longitudinal treatments.
library(CBPS)
#> Loading required package: MASS
#> Loading required package: nnet
#> Loading required package: numDeriv
#> Loading required package: glmnet
#> Loading required package: Matrix
#> Loaded glmnet 4.1-4
#> CBPS: Covariate Balancing Propensity Score
#> Version: 0.23
#> Authors: Christian Fong [aut, cre],
#> Marc Ratkovic [aut],
#> Kosuke Imai [aut],
#> Chad Hazlett [ctb],
#> Xiaolin Yang [ctb],
#> Sida Peng [ctb],
#> Inbeom Lee [ctb]
data("lalonde", package = "cobalt")
## Using CBPS() for generating covariate balancing
## propensity score weights
cbps.out <- CBPS(treat ~ age + educ + married + race +
nodegree + re74 + re75, data = lalonde)
#> [1] "Finding ATT with T=1 as the treatment. Set ATT=2 to find ATT with T=0 as the treatment"
bal.tab(cbps.out)
#> Call
#> CBPS(formula = treat ~ age + educ + married + race + nodegree +
#> re74 + re75, data = lalonde)
#>
#> Balance Measures
#> Type Diff.Adj
#> prop.score Distance -0.0057
#> age Contin. -0.0052
#> educ Contin. -0.0017
#> married Binary -0.0029
#> race_black Binary 0.0019
#> race_hispan Binary -0.0002
#> race_white Binary -0.0017
#> nodegree Binary 0.0042
#> re74 Contin. -0.0078
#> re75 Contin. 0.0061
#>
#> Effective sample sizes
#> Control Treated
#> Unadjusted 429. 185
#> Adjusted 99.97 185