Create a plot showing those variables having the largest imbalance before matching, and those
variables having the largest imbalance after matching. Requires running
computeCovariateBalance
first.
plotCovariateBalanceOfTopVariables(
balance,
n = 20,
maxNameWidth = 100,
title = NULL,
fileName = NULL,
beforeLabel = "before matching",
afterLabel = "after matching"
)
A data frame created by the computeCovariateBalance
function.
(Maximum) count of covariates to plot.
Covariate names longer than this number of characters are truncated to create a nicer plot.
Optional: the main title for the plot.
Name of the file where the plot should be saved, for example 'plot.png'. See
the function ggsave
in the ggplot2 package for supported file formats.
Label for identifying data before matching / stratification / trimming.
Label for identifying data after matching / stratification / trimming.
A ggplot object. Use the ggplot2::ggsave function to save to file in a different format.