Skip to content

Commit 79e59df

Browse files
Copilotthorek1
andcommitted
Add Plot Type section explaining :stack and :compare usage
Added comprehensive section explaining the plot_type argument with practical examples: - :stack for layered shock scenarios showing cumulative effects - :compare for parameter comparisons showing separate lines - Clear use cases for when to use each option - Code examples demonstrating both visualization types Positioned between Plot Labels and Plot Attributes sections for logical flow. Co-authored-by: thorek1 <[email protected]>
1 parent d682861 commit 79e59df

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed

docs/src/irf.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -939,6 +939,53 @@ plot_irf!(Gali_2015_chapter_3_nonlinear,
939939
save_plots_format = :svg)
940940
```
941941

942+
### Plot Type
943+
944+
The `plot_type` argument (default: `:compare`, type: `Symbol`) determines how IRFs are visualized when multiple scenarios are displayed. Two options are available:
945+
946+
- `:compare` - Displays IRFs as separate lines for comparison across scenarios
947+
- `:stack` - Stacks IRFs on top of each other to show cumulative effects
948+
949+
The `:stack` option is particularly useful when analyzing scenarios composed of multiple shock series, as it shows how different shocks contribute to the overall response. The `:compare` option is better suited for comparing IRFs across different parameter values or model specifications.
950+
951+
#### Using `:stack` for Layered Shock Scenarios
952+
953+
When analyzing a scenario composed of multiple shocks, `:stack` visualizes the cumulative impact. For example, plot the combined effect of `eps_a` and `nu` shocks:
954+
955+
```julia
956+
# First shock in the scenario
957+
plot_irf(Gali_2015_chapter_3_nonlinear,
958+
shocks = :eps_a)
959+
960+
# Add second shock to show cumulative effect
961+
plot_irf!(Gali_2015_chapter_3_nonlinear,
962+
shocks = :nu,
963+
plot_type = :stack)
964+
```
965+
966+
The `:stack` visualization shows how each shock contributes to the total response, with the second shock's effect layered on top of the first.
967+
968+
#### Using `:compare` for Parameter Comparisons
969+
970+
When comparing IRFs across different parameter values, `:compare` displays the responses as separate lines:
971+
972+
```julia
973+
# Baseline parameterization
974+
plot_irf(Gali_2015_chapter_3_nonlinear,
975+
parameters = ( => 0.99,),
976+
shocks = :eps_a,
977+
label = "β = 0.99")
978+
979+
# Alternative parameterization for comparison
980+
plot_irf!(Gali_2015_chapter_3_nonlinear,
981+
parameters = ( => 0.95,),
982+
shocks = :eps_a,
983+
label = "β = 0.95",
984+
plot_type = :compare)
985+
```
986+
987+
The `:compare` option (the default) makes it easy to see how parameter changes affect the IRF magnitude and persistence.
988+
942989
### Plot Attributes
943990

944991
The `plot_attributes` argument (default: `Dict()`, type: `Dict`) accepts a dictionary of attributes passed on to the plotting function. See the Plots.jl documentation for details.

0 commit comments

Comments
 (0)