Plots event-window contribution uncertainty by shock
Source:R/plot-hd.R
plot_hd_event_distribution.RdPlots posterior medians and equal-tailed credible intervals for cumulative structural-shock contributions over a selected historical period.
Usage
plot_hd_event_distribution(
object,
start = NULL,
end = start,
probability = 0.9,
variables = NULL,
shocks = NULL,
models = NULL,
shock_groups = NULL,
top_n = NULL,
collapse_other = TRUE,
facet_scales = "free_y",
model = "model1",
...
)Arguments
- object
A posterior model object,
PosteriorHD, or a tidy table of historical decompositions. Plots that reconstruct the observed series require a posterior model. Combining multiple shocks, including an"Other"component, requires draw-level input: marginal medians and interval bounds cannot be added. Ungrouped summary tables remain supported.- start, end
Event-window start and end indexes for event-specific plots.
- probability
Probability mass of the equal-tailed credible interval computed when
objectis not already a summary table.- variables
Variables whose historical decompositions are included.
- shocks
Structural shocks whose contributions are included.
- models
Model specifications to include.
- shock_groups
Optional named character vector mapping shock names to display groups.
- top_n
Optional number of largest contributors to retain within each model-variable panel.
- collapse_other
If
TRUE, contributors outsidetop_n(or unmapped shocks undershock_groups) are collapsed into"Other".- facet_scales
Facet scales passed to
ggplot2.- model
Model label used when converting posterior objects to posterior-summary tables.
- ...
Additional arguments passed to
tidy_hd()ortidy_hd_event()when conversion is required.