Skip to contents

A coefficient plot for estimates that differ by group, date, or specification. Each estimate is a point with two vertical bars: a thick bar for the sampling interval (lower, higher) and a thin bar for the bias-aware interval (honest_lower, honest_higher). Use it for cohort groups (cdd_groups()), for placebo dates next to the exposed surveys (cdd_placebo(), cdd_popavg()), or for a grid of specifications.

Usage

plot_estimates(
  x,
  by = "group",
  series = NULL,
  open = NULL,
  level = NULL,
  scale = 1,
  honest = TRUE,
  ref = NULL,
  vline = NULL,
  xlab = NULL,
  ylab = "Effect",
  col = "#00539B",
  dodge = 0.5
)

Arguments

x

A data frame of estimates with columns ate, lower, higher and, for the thin bars, honest_lower, honest_higher; for example the rows returned by cdd_groups() or cdd_popavg(), stacked with rbind().

by

Name of the column placed on the horizontal axis. A numeric column (survey year, number of surveys) gives a continuous axis; any other column gives a discrete one in the order of appearance.

series

Optional name of a column that splits the estimates into series drawn side by side in shades of col (for example the exposed survey or the extrapolant).

open

Optional name of a logical column; estimates for which it is TRUE are drawn in grey with open markers (for example placebo dates).

level

Outcome level to plot (default: first).

scale

Multiply effects by this (100 for percentage points).

honest

Logical; draw the thin bias-aware bars.

ref

Optional single-row data frame (for example the population estimate) drawn as a dashed line with a band for its sampling interval.

vline

Optional position of a dashed vertical line (for example the onset on a year axis).

xlab, ylab

Axis labels.

col

Base colour. Further series use lighter shades of it.

dodge

Horizontal offset between series.

Value

A ggplot object.

Examples

data(gss_culture)
g <- cdd_groups(gss_culture, "homosex", onset = 1992, waves = 1993, H = 5, levels = 1)
plot_estimates(g, by = "group", scale = 100, ylab = "Effect (points)")