geom_love() and love_plot() are helper functions to create Love plots in ggplot2. Love plots are a diagnostic approach to assessing balance before and after weighting. Many researchers use 0.1 on the absolute SMD scale to evaluate if a variable is well-balanced between groups, although this is just a rule of thumb. geom_love() is a simple wrapper around ggplot2::geom_point(), ggplot2::geom_line(), and ggplot2::geom_vline(). It also adds default aesthetics via ggplot2::aes(). love_plot() is a quick plotting function that further wraps geom_love(). For more complex Love plots, we recommend using ggplot2 directly.

geom_love(
  linewidth = 0.8,
  line_size = NULL,
  point_size = 1.85,
  vline_xintercept = 0.1,
  vline_color = "grey70",
  vlinewidth = 0.6,
  vline_size = NULL
)

love_plot(
  .df,
  linewidth = 0.8,
  line_size = NULL,
  point_size = 1.85,
  vline_xintercept = 0.1,
  vline_color = "grey70",
  vlinewidth = 0.6,
  vline_size = NULL
)

Arguments

linewidth

The line size, passed to ggplot2::geom_line().

line_size

Deprecated. Please use linewidth.

point_size

The point size, passed to ggplot2::geom_point().

vline_xintercept

The X intercept, passed to ggplot2::geom_vline().

vline_color

The vertical line color, passed to ggplot2::geom_vline().

vlinewidth

The vertical line size, passed to ggplot2::geom_vline().

vline_size

Deprecated. Please use vlinewidth.

.df

a data frame produced by tidy_smd()

Value

a list of geoms or a ggplot

Examples

plot_df <- tidy_smd(
  nhefs_weights,
  race:active,
  .group = qsmk,
  .wts = starts_with("w_")
)

love_plot(plot_df)


# or use ggplot2 directly
library(ggplot2)
ggplot(
  plot_df,
  aes(
    x = abs(smd),
    y = variable,
    group = method,
    color = method,
    fill = method
  )
) +
  geom_love()