Plot contamination weights as a tile heatmap
Source:R/contamination_weights_sa.R
plot.sa_contamination_weights.RdBase 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).
Arguments
- x
An
sa_contamination_weightsobject fromcontamination_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(default2L).- ...
Unused.
Value
A ggplot2::ggplot() object.