| plot_att_gt | R Documentation |
Visualises the full cohort-by-period ATT(g,t) matrix stored in the
att_gt attribute of an es_result object produced by
run_es(estimator = "cs"). Two display styles are available:
"heatmap": a tile plot with calendar time t on the
x-axis and cohort g on the y-axis, colour-filled by the point
estimate. Cells whose pointwise confidence interval excludes zero are
marked with a filled dot; cells that are simultaneously significant
(when bootstrap data are available) are additionally marked with an open
diamond.
"facet": one panel per cohort showing ATT(g,t) over
calendar time t with a pointwise confidence ribbon, mirroring
the style of plot_es. A lighter simultaneous CI ribbon
is overlaid when bootstrap data are available.
Both types draw a vertical dashed line at t = g (treatment onset)
for each cohort.
plot_att_gt(
x,
type = c("heatmap", "facet"),
ci_level = 0.95,
zero_line = TRUE,
theme = c("bw", "minimal", "classic"),
color = "#B25D91FF",
fill = "#B25D91FF",
alpha = 0.2
)
## S3 method for class 'att_gt_result'
autoplot(object, ...)
x |
An |
type |
|
ci_level |
Confidence level for pointwise intervals (default 0.95). |
zero_line |
Logical; draw a horizontal reference line at zero in the
|
theme |
One of |
color |
Line and point colour used in the |
fill |
Ribbon fill colour in the |
alpha |
Ribbon transparency in the |
object |
An |
... |
Passed to |
A ggplot object.
When attr(x, "bootstrap") is present (i.e., run_es() was
called with bootstrap = TRUE), both plot types add simultaneous
inference overlays sourced from the (g,t)-level bootstrap object.
plot_es, run_es
## Not run:
cs_result <- run_es(data = mydata, outcome = y, time = year,
timing = g, unit = id, fe = ~id + year,
staggered = TRUE, estimator = "cs")
plot_att_gt(cs_result)
plot_att_gt(cs_result, type = "facet")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.