bal.tab()
and love.plot()
display balance statistics for the included covariates. The stats
argument in each of these functions controls which balance statistics are to be displayed. The argument to stats
should be a character vector with the names of the desired balance statistics.
This page describes all of the available balance statistics and how to request them. Abbreviations are allowed, so you can use the first few letters of each balance statistics to request it instead of typing out its whole name. That convention is used throughout the documentation. For example, to request mean differences and variance ratios in bal.tab()
or love.plot()
, you could include stats = c("m", "v")
. In addition, the thresholds
argument uses the same naming conventions and can be used to request balance thresholds on each statistic. For example, to request a balance threshold of .1 for mean differences, you could include thresholds = c(m = .1)
.
Below, each allowable entry to stats
and thresholds
are described, along with other details or option that accompany them.
Binary/Multi-Category Treatments
"mean.diffs"
Mean differences as computed by
col_w_smd()
. Can be abbreviated as"m"
. Setting the argumentscontinuous
andbinary
to either"std"
or"raw"
will determine whether standardized mean differences or raw mean differences are calculated for continuous and categorical variables, respectively. When standardized mean differences are requested, thes.d.denom
argument controls how the standardization occurs. Whenabs = TRUE
, negative values become positive. Mean differences are requested by default when no entry tostats
is provided."variance.ratios"
Variance ratios as computed by
col_w_vr()
. Can be abbreviated as"v"
. Will not be computed for binary variables. Whenabs = TRUE
, values less than 1 will have their inverse taken. When used withlove.plot
, the x-axis scaled will be logged so that, e.g., .5 is as far away from 1 as 2 is."ks.statistics"
Kolmogorov-Smirnov (KS) statistics as computed by
col_w_ks()
."ovl.coefficients"
Overlapping (OVL) statistics as computed by
col_w_ovl()
. Can be abbreviated as"ovl"
. Additional arguments passed tocol_w_ovl()
, such asintegrate
orbw
, can be supplied tobal.tab()
orlove.plot()
.
Continuous Treatments
"correlations"
Pearson correlations as computed by
col_w_cov()
. Can be abbreviated as"cor"
. Setting the argumentscontinuous
andbinary
to either"std"
or"raw"
will determine whether correlations or covariances are calculated for continuous and categorical variables, respectively (they are both"std"
by default). When correlations are requested, thes.d.denom
argument controls how the standardization occurs. Whenabs = TRUE
, negative values become positive. Pearson correlations are requested by default when no entry tostats
is provided."spearman.correlations"
Spearman correlations as computed by
col_w_cov()
. Can be abbreviated as"sp"
. All arguments are the same as those for"correlations"
. Whenabs = TRUE
, negative values become positive."mean.diffs.target"
Mean differences computed between the weighted and unweighted sample to ensure the weighted sample is representative of the original population. Can be abbreviated as
"m"
. Setting the argumentscontinuous
andbinary
to either"std"
or"raw"
will determine whether standardized mean differences or raw mean differences are calculated for continuous and categorical variables, respectively. The standardization factor will be computed in the unweighted sample. Whenabs = TRUE
, negative values become positive. This statistic is only computed for the adjusted samples."ks.statistics.target"
KS-statistics computed between the weighted and unweighted sample to ensure the weighted sample is representative of the original population. Can be abbreviated as
"ks"
. This statistic is only computed for the adjusted samples.
If a statistic is requested in thresholds
, it will automatically be placed in stats
. For example, bal.tab(..., stats = "m", thresholds = c(v = 2))
will display both mean differences and variance ratios, and the variance ratios will have a balance threshold set to 2.
Examples
data(lalonde)
#Binary treatments
bal.tab(treat ~ age + educ + married + re74, data = lalonde,
stats = c("m", "v", "ks"))
#> Error in bal.tab(treat ~ age + educ + married + re74, data = lalonde, stats = c("m", "v", "ks")): The given response variable, "treat", is not a variable in `data` or the global environment.
love.plot(treat ~ age + educ + married + re74, data = lalonde,
stats = c("m", "v", "ks"), binary = "std",
thresholds = c(m = .1, v = 2))
#> Error in love.plot(treat ~ age + educ + married + re74, data = lalonde, stats = c("m", "v", "ks"), binary = "std", thresholds = c(m = 0.1, v = 2)): The given response variable, "treat", is not a variable in `data` or the global environment.
#Continuous treatments
bal.tab(re75 ~ age + educ + married + re74, data = lalonde,
stats = c("cor", "sp"))
#> Error in bal.tab(re75 ~ age + educ + married + re74, data = lalonde, stats = c("cor", "sp")): The variable "educ" cannot be found. Be sure it is entered correctly or supply a dataset that contains this varialble to `data`.
love.plot(re75 ~ age + educ + married + re74, data = lalonde,
thresholds = c(cor = .1, sp = .1))
#> Error in love.plot(re75 ~ age + educ + married + re74, data = lalonde, thresholds = c(cor = 0.1, sp = 0.1)): The variable "educ" cannot be found. Be sure it is entered correctly or supply a dataset that contains this varialble to `data`.