Learn R Programming

cobalt (version 4.4.1)

bal.tab.weightit: Balance Statistics for WeightIt Objects

Description

Generates balance statistics for weightit and weightitMSM objects from WeightIt.

Usage

# S3 method for weightit
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,
        ...)

Value

For point treatments, if clusters and imputations are not specified, an object of class "bal.tab" containing balance summaries for the weightit object. See bal.tab() for details.

If imputations are specified, an object of class "bal.tab.imp" containing balance summaries for each imputation and a summary of balance across imputations. See bal.tab.imp for details.

If weightit() is used with multi-category treatments, an object of class "bal.tab.multi" containing balance summaries for each pairwise treatment comparison. See bal.tab.multi for details.

If weightitMSM() is used for longitudinal treatments, an object of class "bal.tab.msm" containing balance summaries for each time period. See bal.tab.msm 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.

Arguments

x

a weightit or weightitMSM object; the output of a call to WeightIt::weightit() or WeightIt::weightitMSM().

stats, int, poly, addl, data, continuous, binary, thresholds, weights, cluster, imp, pairwise, abs, subset, quick, ...

see bal.tab() for details.

See below for special notes on the distance, s.d.denom, and s.weights arguments.

The following arguments have special notes when used with weightit and weightitMSM objects:

distance

propensity scores generated by weightit() and weightitMSM() are automatically included and named "prop.score".

s.d.denom

if not specified, bal.tab() will figure out which one is best based on the estimand of the weightit object: if ATT, "treated"; if ATC, "control"; otherwise "pooled". Abbreviations allowed.

s.weights

if s.weights was supplied in the call to weightit() or weightitMSM(), they will automatically be included and do not need be specified again (though there is no harm if they are).

Author

Noah Greifer

Details

bal.tab.weightit() generates a list of balance summaries for the weightit object given.

See Also

bal.tab() for details of calculations.

Examples

Run this code
if (FALSE) { # all(sapply(c("WeightIt", "twang"), requireNamespace, quietly = TRUE))
library(WeightIt)
data("lalonde", package = "cobalt")

## Basic propensity score weighting
w.out1 <- weightit(treat ~ age + educ + race + 
                     married + nodegree + re74 + re75, 
                   data = lalonde, method = "ps")
bal.tab(w.out1, un = TRUE, m.threshold = .1, 
        v.threshold = 2)

## Weighting with a multi-category treatment
w.out2 <- weightit(race ~ age + educ + married + 
                     nodegree + re74 + re75, 
                   data = lalonde, method = "ps",
                   estimand = "ATE", use.mlogit = FALSE)
bal.tab(w.out2, un = TRUE)
bal.tab(w.out2, un = TRUE, pairwise = FALSE)

## IPW for longitudinal treatments
data("iptwExWide", package = "twang")
wmsm.out <- weightitMSM(list(tx1 ~ use0 + gender,
                             tx2 ~ use0 + gender + use1 + tx1,
                             tx3 ~ use0 + gender + use1 + tx1 + use2 + tx2),
                        data = iptwExWide,
                        stabilize = TRUE)
bal.tab(wmsm.out)
}

Run the code above in your browser using DataLab