R/AllGenerics.R
, R/methods-Matched.R
plotCovariate.Rd
This function plots the distributions of a covariate from each matched set of a Matched object.
plotCovariate(
x,
covar = NULL,
sets = c("focal", "matched", "pool", "unmatched"),
type = NULL,
log = NULL,
...
)
# S4 method for Matched,character_OR_missing,character_OR_missing,character_OR_missing,character_OR_missing
plotCovariate(x, covar, sets, type, log, thresh = 12)
Matched object
Character naming the covariate to plot. If multiple are provided, only the first one is used.
Character vector describing which matched set(s) to include in the plot. Options are 'focal', 'matched', 'pool', or 'unmatched'. Multiple options are accepted.
Character naming the plot type. Available options are one of either 'ridges', 'jitter', 'lines', or 'bars'. Note that for large datasets, use of 'jitter' is discouraged because the large density of points can stall the R-graphics device.
Character vector describing which axis or axes to apply log-transformation. Available options are 'x' and/or 'y'.
Additional arguments.
Integer describing the number of
unique values required to classify a numeric
variable as discrete (and convert it to a factor).
If the number of unique values exceeds thresh
then the variable is considered continuous.
Returns a plot of a covariate's distribution among matched sets.
By default, plotCovariate
will sense the
class of covariate and make a plot best suited to
that data type. For example, if the covariate class
is categorical in nature then the type
argument
defaults to 'bars'. type
is set to 'lines' for
continuous covariates. These settings can also be overwritten
manually.
plotPropensity()
to plot propensity scores.
## Matched example dataset
set.seed(123)
mdf <- makeExampleMatchedDataSet(matched = TRUE)
## Visualize covariates
plotCovariate(mdf)
plotCovariate(mdf, covar = 'feature3')
plotCovariate(mdf,
covar = 'feature2',
sets = c('focal', 'matched', 'pool'))
plotCovariate(mdf,
covar = 'feature2',
sets = c('focal', 'matched', 'pool'),
type = 'ridges')
#> Picking joint bandwidth of 0.553
plotCovariate(mdf,
covar = 'feature2',
sets = c('focal', 'matched', 'pool'),
type = 'jitter')