For SC estimates, i.e., if lambda is a vector of zeros, plots the trajectories and SC estimate of the effect, but no diagram.

synthdid_plot(
  estimates,
  treated.name = "treated",
  control.name = "synthetic control",
  spaghetti.units = c(),
  spaghetti.matrices = NULL,
  facet = NULL,
  facet.vertical = TRUE,
  lambda.comparable = !is.null(facet),
  overlay = 0,
  lambda.plot.scale = 3,
  trajectory.linetype = 1,
  effect.curvature = 0.3,
  line.width = 0.5,
  guide.linetype = 2,
  point.size = 1,
  trajectory.alpha = 0.5,
  diagram.alpha = 0.95,
  effect.alpha = 0.95,
  onset.alpha = 0.3,
  ci.alpha = 0.3,
  spaghetti.line.width = 0.2,
  spaghetti.label.size = 2,
  spaghetti.line.alpha = 0.3,
  spaghetti.label.alpha = 0.5,
  se.method = "jackknife",
  alpha.multiplier = NULL
)

Arguments

estimates,

a list of estimates output by synthdid_estimate. Or a single estimate.

treated.name,

the name of the treated curve that appears in the legend. Defaults to 'treated'

control.name,

the name of the control curve that appears in the legend. Defaults to 'synthetic control'

spaghetti.units,

a list of units to plot individually. spaghetti.unit %in% rownames(Y) must work. Defaults to the empty list.

spaghetti.matrices,

a list of matrices --- one for each element of estimates --- of trajectories to plot individually. The rows of these matrices should be the same length as the trajectories in Y and they must be named --- set rownames(spaghetti.trajectories[[i]]) --- so trajectories can be labeled in the plot.

facet,

a list of the same length as estimates indicating the facet in which to plot each estimate. The values of the elements of the list are used to label the facets. If NULL, plot each estimate in a different facet. Defaults to NULL.

facet.vertical,

TRUE if facets should be stacked vertically. Defaults to FALSE (horizonal).

lambda.comparable,

TRUE if the weights lambda should be plotted in such a way that the ribbons have the same mass from plot to plot, assuming the treated curve is the same. Useful for side-by-side or overlaid plots. Defaults to FALSE if facet is not passed, TRUE if passed.

overlay,

a number in [0,1] defaulting to 0, can be used to shift the control trajectory toward the treated trajectory. When a nonzero value is passed, we plot the control after subtracting that fraction of the diff-in-diff style adjustment for the difference between lambda-weighted pre-treatment averages of the treated and control. With intercept of almost one, this makes it easier to assess parallel-ness by making trajectories closer With intercept of one, this essentially overlays the curves, and plotting a diagram is suppressed as in the case of a SC estimate. To use different values for different plots, pass these values as an attribute 'overlay' of each estimate. If a vector is passed, plots at different intercept levels indicated by the 'frame' aesthetic. ggplotly will interpret this as an animation.

lambda.plot.scale

determines the scale of the plot of the weights lambda.

trajectory.linetype,

the linetype of the treated and synthetic control trajectories

effect.curvature,

the curvature of the arrows indicating the treatment effect. Defaults to zero. Nonzero values help avoid overplotting when plotting multiple estimates in one facet.

line.width

the line width.

guide.linetype

determines the (ggplot) linetype of the vertical segments of the parallelogram

point.size

determines the size of the points of the parallelogram

trajectory.alpha

determines transparency of trajectories

diagram.alpha

determines transparency of diff-in-diff diagram

effect.alpha

determines transparency of effect arrows

onset.alpha

determines transparency of vertical lines indicating onset of treatment

ci.alpha

determines transparency of the arrows illustrating upper and lower bounds of a 95% confidence interval for the effect

spaghetti.line.width

determines the width of spaghetti trajectories

spaghetti.label.size

determines the size of spaghetti labels

spaghetti.line.alpha

determines transparency of spaghetti trajectories

spaghetti.label.alpha

determines transparency of spaghetti trajectory labels

se.method

determines the method used to calculate the standard error used for this confidence interval. if 'none', don't show the interval

alpha.multiplier,

a vector of the same length as estimates, is useful for comparing multiple estimates in one facet but highlighting one or several. All plot elements associated with the estimate are displayed with alpha multiplied by the corresponding element of alpha.multiplier. Defaults to a vector of ones.

Details

Requires ggplot2 Due to differences between ggplot and ggplotly, this will warn about an unknown aesthetic frame.