Generate a Love Plot of Standardized Mean Differences
Generates a Love plot, which is a dot plot with variable names on the y-axis and standardized mean differences on the x-axis. Each point represents the standardized mean difference of the corresponding covariate in the matched or unmatched sample. Love plots are a simple way to display covariate balance before and after matching. The plots are generated using dotchart and points.
## S3 method for class 'summary.matchit'
plot(x, abs = TRUE, var.order = "data",
threshold = c(.1, .05), position = "bottomright", ...)x |
a |
abs |
|
var.order |
how the variables should be ordered. Allowable options include |
threshold |
numeric values at which to place vertical lines indicating a balance threshold. These can make it easier to see for which variables balance has been achieved given a threshold. Multiple values can be supplied to add multiple lines. When |
position |
the position of the legend. Should be one of the allowed keyword options supplied to |
... |
ignored. |
For matching methods other than subclassification, plot.summary.matchit uses x$sum.all[,"Std. Mean Diff."] and x$sum.matched[,"Std. Mean Diff."] as the x-axis values. For subclassification, in addition to points for the unadjusted and aggregate subclass balance, numerals representing balance in individual subclasses are plotted if subclass = TRUE in the call to summary. Aggregate subclass standardized mean differences are taken from x$sum.across[,"Std. Mean Diff."] and the subclass-specific mean differences are taken from x$sum.subclass.
A plot is displayed, and x is invisibly returned.
Noah Greifer
cobalt::love.plot is a more flexible and sophisticated function to make Love plots and is also natively compatible with matchit objects.
data("lalonde")
m.out <- matchit(treat ~ age + educ + married +
race + re74, data = lalonde,
method = "nearest")
plot(summary(m.out, interactions = TRUE),
var.order = "unmatched")
s.out <- matchit(treat ~ age + educ + married +
race + nodegree + re74 + re75,
data = lalonde, method = "subclass")
plot(summary(s.out, subclass = TRUE),
var.order = "unmatched", abs = FALSE)Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.