Skip to contents

Wave means of the outcome for a given age range, the kernel-weighted local-linear fit through the H pre-shock waves, its dotted extrapolation to the treated wave, the extrapolated counterfactual (a grey filled circle), and the gap between it and the observed mean (a double-headed arrow whose heads stop at the edges of the two points, labeled with its value). Observed means are filled before the shock and open after.

Usage

plot_design(
  data,
  outcome,
  onset,
  wave,
  H = 5,
  lo = 20,
  hi = 70,
  from = NULL,
  level = NULL,
  scale = 1,
  kernel = "triangular",
  year = "year",
  age = "age",
  weight = "weight",
  col_fit = "#00539B",
  col_window = "#E3ECF5",
  col_cf = "grey45",
  col_point = col_fit,
  digits = 1,
  gap_pad = 0.025
)

Arguments

data

A data frame of repeated cross-sections.

outcome

Name of the outcome column. Categorical outcomes are expanded into one linear probability equation per level unless continuous = TRUE.

onset

Onset year of the shock. Pre-shock waves are those strictly before it.

wave

The treated survey wave (year) whose respondents are the treated sample.

H

Number of pre-shock waves (the bandwidth in waves).

lo, hi

Age range of respondents to pool.

from

First wave to display.

level

Level of a categorical outcome to plot as a share (NULL for continuous).

scale

Multiply by this.

kernel

Kernel over wave rank, see cdd_kernel().

year, age, weight

Names of the survey-year, age, and survey-weight columns.

col_fit

Colour of the fit and its extrapolation.

col_window

Fill of the pre-shock window.

col_cf

Colour of the counterfactual point and the gap arrow.

col_point

Colour of the survey means (filled before the onset, open after).

digits

Digits for the gap label.

gap_pad

Fraction of the vertical range by which the double-headed gap arrow is shortened at each end, so that its heads sit on the edges of the two points rather than inside them.

Value

A ggplot object.