print.bal.tab {cobalt}R Documentation

Print Results of a Call to bal.tab()

Description

Prints bal.tab() output in a clean way. Provides options for printing.

Usage

## S3 method for class 'bal.tab'
print(x, 
      imbalanced.only = "as.is", 
      un = "as.is", 
      disp.bal.tab = "as.is", 
      stats = "as.is", 
      disp.thresholds = "as.is", 
      disp = "as.is", 
      digits = max(3, getOption("digits") - 3), 
      ...)

## S3 method for class 'bal.tab.subclass'
print(x, 
      imbalanced.only = "as.is", 
      un = "as.is", 
      disp.bal.tab = "as.is", 
      stats = "as.is", 
      disp.thresholds = "as.is", 
      disp = "as.is", 
      disp.subclass = "as.is", 
      digits = max(3, getOption("digits") - 3), 
      ...)

## S3 method for class 'bal.tab.cluster'
print(x, 
      imbalanced.only = "as.is", 
      un = "as.is", 
      disp.bal.tab = "as.is", 
      stats = "as.is", 
      disp.thresholds = "as.is", 
      disp = "as.is", 
      which.cluster, 
      cluster.summary = "as.is", 
      cluster.fun = "as.is", 
      digits = max(3, getOption("digits") - 3), 
      ...)

## S3 method for class 'bal.tab.imp'
print(x, 
      imbalanced.only = "as.is", 
      un = "as.is", 
      disp.bal.tab = "as.is", 
      stats = "as.is", 
      disp.thresholds = "as.is", 
      disp = "as.is", 
      which.imp, 
      imp.summary = "as.is", 
      imp.fun = "as.is", 
      digits = max(3, getOption("digits") - 3), 
      ...)
    
## S3 method for class 'bal.tab.multi'
print(x, 
      imbalanced.only = "as.is", 
      un = "as.is", 
      disp.bal.tab = "as.is", 
      stats = "as.is", 
      disp.thresholds = "as.is", 
      disp = "as.is", 
      which.treat, 
      multi.summary = "as.is", 
      digits = max(3, getOption("digits") - 3), 
      ...)
    
## S3 method for class 'bal.tab.msm'
print(x, 
      imbalanced.only = "as.is", 
      un = "as.is", 
      disp.bal.tab = "as.is", 
      stats = "as.is", 
      disp.thresholds = "as.is", 
      disp = "as.is", 
      which.time, 
      msm.summary = "as.is", 
      digits = max(3, getOption("digits") - 3), 
      ...)

Arguments

x

a bal.tab object; the output of a call to bal.tab.

imbalanced.only

whether to display only the covariates that failed to meet at least one of balance thresholds. Depends only on whether threshold were initial set in the call to bal.tab() and not on any arguments to print() (except disp.bal.tab).

un

whether to display balance values for the unadjusted sample. Ignored (and set to TRUE) if no conditioning was performed.

disp.bal.tab

whether to display the table of balance statistics. If FALSE, only other values (e.g., the call, sample sizes, balance tallies, and maximum imbalances) will be presented.

stats

character; which statistic(s) should be reported. For binary or multi-category treatments, the options are "mean.diffs" for mean differences (standardized or not according the selected bal.tab options), "variance.ratios" for variance ratios, and "ks.statistics" for Kolmogorov-Smirnov statistics. "mean.diffs" is the default. For continuous treatments, the only option is "correlations" for treatment-covariate correlations. Multiple options are allowed. Abbreviations allowed. Statistics that weren't requested in the original call to bal.tab() cannot be requested with print unless quick = FALSE in the original call.

disp.thresholds

logical; whether to display thresholds for each statistic for which thresholds were originally requested in the call to bal.tab. Should be a named logical vector with names corresponding to the thresholds. For example, if thresholds for mean differences were requested in bal.tab, set disp.thresholds = c(m = FALSE) to prevent them from being printed. If a statistic was prevented from being displayed by another argument to print, the thresholds will not be displayed.

disp

character; which distribution summary statistics to display. Allowable options include "means" and "sds". Statistics that weren't requested in the original call to bal.tab() cannot be requested with print unless quick = FALSE in the original call.

disp.subclass

whether to display balance information for individual subclasses if subclassification is used in conditioning.

which.cluster

which cluster(s) to display. If NULL, all clusters will be displayed. If NA, no clusters will be displayed. Otherwise, can be a vector of cluster names or numerical indices for which to display balance. Indices correspond to the alphabetical order of cluster names. To display the clusters requested in the original call to bal.tab(), omit this argument, as specifying "as.is" will request a cluster called "as.is.".

cluster.summary

whether to display the cluster summary table. If which.cluster is NA, cluster.summary will be set to TRUE.

cluster.fun

a character vector of functions of balance statistics to display when displaying balance across clusters. Can be "mean", "min", or "max". More than one are allowed.

which.imp

which imputation(s) to display. If NULL, all imputations will be displayed. If NA, no imputations will be displayed. Otherwise, can be a vector of imputations numbers for which to display balance. To display the imputations requested in the original call to bal.tab(), omit this argument, or enter "as.is".

imp.summary

whether to display the imputation summary table. If which.imp is NA, cluster.summary will be set to TRUE.

imp.fun

a character vector of functions of balance statistics to display when displaying balance across imputations. Can be "mean", "min", or "max". More than one are allowed.

which.treat

which treatments to display when multi-category treatments are used. See bal.tab.multi for details.

multi.summary

logical; whether to display the balance summary table across pairwise comparisons when multi-category treatments are used. See bal.tab.multi for details.

which.time

which time periods to display if longitudinal treatments are used. See bal.tab.msm for details.

msm.summary

logical; whether to display the balance summary table across time periods when longitudinal treatments are used. See bal.tab.msm for details.

digits

the number of digits to display.

...

further arguments passed to or from other methods.

Details

Simply calling bal.tab() will print its results, but it can be useful to store the results into an object and print them again later, possibly with different print options specified. The print() function automatically dispatches the correct method for the bal.tab object given. For balance tables generated from using weighting, matching, or no adjustment with binary or continuous treatments, print.bal.tab() will be used. For balance tables generated from using weighting, matching, or no adjustment with clusters, print.bal.tab.cluster() will be used. For balance tables generated from using subclassification, print.bal.tab.subclass() will be used. For balance tables generated with multi-category treatments, print.bal.tab.multi() will be used. For balance tables generated with sequential treatments, print.bal.tab.msm() will be used. For balance tables generated with multiply imputed data, print.bal.tab.imp() will be used.

For all parameters except which.cluster, which.imp, which.treat, and which.time, either omitting the argument or setting it to "as.is" will use the corresponding print option stored in the bal.tab object, which results from the original call to bal.tab(). For these other arguments, to retain the display option of the original call to bal.tab(), the argument must omitted, as using "as.is" would cause print() to attempt to display balance for, e.g., a cluster called "as.is". If such a cluster existed and it was desired, it would otherwise be impossible to display it.

Any parameter used in bal.tab() for calculations, such as int, addl, or distance, cannot be used with print(); only those parameters listed above, those that solely determine printing options, can be used. To change computation options, a new call to bal.tab() must be performed.

Prior versions of print() used different arguments, such as m.threshold to display thresholds and disp.means to display group means, and these arguments still work but are not documented here. See display_options.

Note

Unless quick = FALSE in the original call to bal.tab(), some values may not be calculated, in which case using print() will not display these values even when requested. For example, if stats = "m" and quick = TRUE in the original call to bal.tab() (the default for both), setting stats = "ks" in print() will not print the KS statistics because they were not calculated.

Author(s)

Noah Greifer

See Also

print, bal.tab display options for further information on some of these options.

Examples

data(lalonde)
library(WeightIt)
w.out <- weightit(treat ~ age + educ + married + race + re74 + re75, 
                  data = lalonde)
b <- bal.tab(w.out, stats = c("m", "v", "ks"), 
             un = TRUE, v.threshold = 2)
print(b, un = FALSE, stats = c("m", "v"),
      disp.thresholds = c(v = FALSE))

[Package cobalt version 4.2.2 Index]