| print.bal.tab {cobalt} | R Documentation |
bal.tab()
Prints bal.tab() output in a clean way. Provides options for printing.
## 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),
...)
x |
a |
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 |
un |
whether to display balance values for the unadjusted sample. Ignored (and set to |
disp.bal.tab |
whether to display the table of balance statistics. If |
stats |
|
disp.thresholds |
|
disp |
|
disp.subclass |
whether to display balance information for individual subclasses if subclassification is used in conditioning. |
which.cluster |
which cluster(s) to display. If |
cluster.summary |
whether to display the cluster summary table. If |
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 |
imp.summary |
whether to display the imputation summary table. If |
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 |
multi.summary |
|
which.time |
which time periods to display if longitudinal treatments are used. See |
msm.summary |
|
digits |
the number of digits to display. |
... |
further arguments passed to or from other methods. |
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.
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.
Noah Greifer
print, bal.tab
display options for further information on some of these options.
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))