Skip to contents

Base plot() method for the contamination weights returned by contamination_weights(): a ggplot2 tile heatmap.

Each cell at position (twfe_period, catt_label) shows the weight \(\omega^{\ell''}_{e,\ell}\): how much of \(CATT_{e,\ell}\) leaks into the TWFE coefficient \(\hat\mu_{\ell''}\).

  • Diagonal cells (catt_period == twfe_period): own-period weights (sum across cohorts should be \(\approx 1\)).

  • Off-diagonal cells: cross-period contamination (ideally close to zero under treatment effect homogeneity).

Usage

# S3 method for class 'sa_contamination_weights'
plot(
  x,
  limit_abs = NULL,
  midpoint = 0,
  low = "#2166AC",
  mid = "white",
  high = "#B2182B",
  theme = c("bw", "minimal", "classic"),
  show_values = FALSE,
  value_digits = 2L,
  ...
)

Arguments

x

An sa_contamination_weights object from contamination_weights().

limit_abs

Numeric; symmetric colour scale limit [-limit, limit]. Defaults to the maximum absolute weight (rounded up to one decimal).

midpoint

Numeric; midpoint of the diverging colour scale (default 0).

low

Colour for negative weights (default "#2166AC").

mid

Colour for zero weight (default "white").

high

Colour for positive weights (default "#B2182B").

theme

Character; "bw" (default), "minimal", or "classic".

show_values

Logical; overlay weight values in each tile (default FALSE).

value_digits

Integer; decimal digits when show_values = TRUE (default 2L).

...

Unused.

Value

A ggplot2::ggplot() object.