bal.tab()
Prints bal.tab()
output in a clean way. Provides options for printing.
# S3 method for bal.tab
print(
x,
imbalanced.only,
un,
disp.bal.tab,
disp.call,
stats,
disp.thresholds,
disp,
which.subclass,
subclass.summary,
which.imp,
imp.summary,
imp.fun,
which.treat,
multi.summary,
which.time,
msm.summary,
which.cluster,
cluster.summary,
cluster.fun,
digits = max(3, getOption("digits") - 3),
...
)
a bal.tab
object; the output of a call to bal.tab()
.
logical
; 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
).
logical
; whether to display balance values for the unadjusted sample. Ignored (and set to TRUE
) if no conditioning was performed.
logical
; 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.
logical
; whether to display the function call for the input object, if any.
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.
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.
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.
when used with subclassification, which subclass(es) to display. If NULL
, all subclasses will be displayed. If NA
, no subclasses will be displayed. Otherwise, can be a vector of subclass indices for which to display balance. To display the subclasses requested in the original call to bal.tab()
, omit this argument. See class-bal.tab.subclass
for details.
logical
; when used with subclassification, whether to display the subclass balance summary table. If which.subclass
is NA
, subclass.summary
will be set to TRUE
. See class-bal.tab.subclass
for details.
when used with multiply imputed data, 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. See class-bal.tab.imp
for details.
logical
; when used with multiply imputed data, whether to display the imputation summary table. If which.imp
is NA
, imp.summary
will be set to TRUE
. See class-bal.tab.imp
for details.
character
; when used with multiply imputed data, 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. See class-bal.tab.imp
for details.
when used with multi-category treatments, which treatments to display. See bal.tab.multi()
for details.
logical
; when used with multi-category treatments, whether to display the balance summary table across pairwise comparisons. See bal.tab.multi()
for details.
when used with longitudinal treatments, which time periods to display if longitudinal treatments are used. See class-bal.tab.msm
for details.
logical
; when used with longitudinal treatments, whether to display the balance summary table across time periods. See class-bal.tab.msm
for details.
when used with clustered data, 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. See class-bal.tab.cluster
for details.
logical
; when used with clustered data, whether to display the cluster summary table. If which.cluster
is NA
, cluster.summary
will be set to TRUE
. See class-bal.tab.cluster
for details.
character
; when used with clustered data, 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. See class-bal.tab.cluster
for details.
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.
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()
had separate methods for each bal.tab
class. Now they are dispatched internally.
print()
, bal.tab()
display-options
for further information on some of these options.
if (FALSE) { # requireNamespace("WeightIt", quietly = TRUE)
data("lalonde", package = "cobalt")
w.out <- WeightIt::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))
}
Run the code above in your browser using DataLab