Skip to content
Open
Show file tree
Hide file tree
Changes from 233 commits
Commits
Show all changes
265 commits
Select commit Hold shift + click to select a range
35ff026
roll back dynare 7 toml
thorek1 Aug 8, 2025
47732d5
more test code
thorek1 Aug 8, 2025
4142ada
make plot_irf! work with different variables
thorek1 Aug 10, 2025
350a3f9
update todos
thorek1 Aug 10, 2025
e97443d
more plot examples
thorek1 Aug 10, 2025
cf14794
managed multi shock plots
thorek1 Aug 10, 2025
dc5e8e7
plot combination with multiple shocks and variables
thorek1 Aug 10, 2025
a3b7ba1
fix dual axis
thorek1 Aug 10, 2025
7277e8c
refactor plot variables and enhance shock handling in combined plots
thorek1 Aug 11, 2025
46a537d
fix length for annotation
Aug 15, 2025
06bcc6f
legend plot takes specific values if difference only along one dimension
Aug 15, 2025
59eac1c
fix multiple shocks naming when there is only one unique shock to show
Aug 15, 2025
672ffed
add negative shock logic
Aug 15, 2025
aac0fb2
implement algorithm for plot
Aug 15, 2025
d2f867a
add generalised IRF and handling of boolean in legend
Aug 15, 2025
33f7fab
add more things to the plotting
Aug 15, 2025
f0c4700
fix correct levels for plots
Aug 15, 2025
4889d61
more plotting examples
Aug 15, 2025
0019995
create reduced vectors to separate model name
Aug 15, 2025
3b5fccf
plot multiple models as well
thorek1 Aug 16, 2025
17462ea
more examples
thorek1 Aug 16, 2025
2791d52
add periods as possible argument to vary
thorek1 Aug 17, 2025
689abd4
reset ss page and handle shocks correctly
thorek1 Aug 17, 2025
bc0f74d
if ss differs due to algoruthm dont use Plot index as column but Algo…
thorek1 Aug 17, 2025
daf6a3a
update todos
thorek1 Aug 17, 2025
2fcf61a
add initial state inputs to diff tables
thorek1 Aug 17, 2025
da5c1f8
add tol to output comparison
thorek1 Aug 17, 2025
f107cc8
update todo
thorek1 Aug 17, 2025
30947f8
more plotting examples
thorek1 Aug 18, 2025
c8f406b
fix naming of shock part of title
Aug 18, 2025
00b2f8b
dual axis moves inside subplot func; add stack option; twinx simplifi…
thorek1 Aug 20, 2025
f6d27ca
add shock matrix correct handling
thorek1 Aug 20, 2025
da9590b
fix model estimates, no longer in absolute deviations
thorek1 Aug 20, 2025
d1ea753
transparent line color for fevd plot
thorek1 Aug 20, 2025
fa3a87b
refactor plot handling and update shock series for SW07_nonlinear model
thorek1 Aug 21, 2025
ed0e906
try to include ext in docs
Aug 21, 2025
305d63d
exclude Showoff from stale dependencies tests
Aug 21, 2025
461ac49
some fixes for plot_irf; set up container for cond fcst plot
Aug 21, 2025
843d1f1
make cond fcst work. many improvements for other plots as well. need …
Aug 21, 2025
c041467
more examples
Aug 21, 2025
9b9445d
comment out levels parameter in functionality_test for conditional fo…
thorek1 Aug 22, 2025
0cc7a73
fix ref stst handling
Aug 22, 2025
5b47ee1
Merge branch 'combine_plots' of https://github.com/thorek1/MacroModel…
Aug 22, 2025
d25519d
fix plot cnd fcst!
Aug 22, 2025
3e3c224
add dynamicppl 0.37
Aug 22, 2025
b397a35
restrict dynamicppl to 0.35
Aug 22, 2025
74e4026
rm 0 plots from moel estimates
Aug 22, 2025
8f76117
more test scripts
Aug 22, 2025
a39071b
auto palette, only non zero plots shown for estimates
thorek1 Aug 24, 2025
640fc4b
palette propagates through all plotting functions
thorek1 Aug 24, 2025
b6d1ce7
Enhance plotting functions with custom palettes and improved data han…
thorek1 Aug 24, 2025
fd4f18e
update todos
thorek1 Aug 25, 2025
b29b91c
cycle through palette
thorek1 Aug 25, 2025
68bd26d
Add RGB palette parsing for ECB color scheme in plotting functions
thorek1 Aug 25, 2025
e541b1d
broadcast pal val
Aug 25, 2025
561fd52
alpha reduction when palette is repeated
Aug 25, 2025
9edb296
working version of model_estimates! without proper legend
Aug 25, 2025
8259325
updated development script
Aug 25, 2025
76f8bf2
model_estimates! works. need to fix details for data and axis; improv…
thorek1 Aug 25, 2025
993e1f9
Add palette parameter to plot_model_estimates! for improved legend vi…
thorek1 Aug 25, 2025
335ee3d
Add support for presample periods in plot_model_estimates! function
thorek1 Aug 26, 2025
f3be42f
Add presample_periods parameter to plot_model_estimates! and plot_mod…
thorek1 Aug 26, 2025
de8853b
colors work for presampe periods
Aug 26, 2025
ab58312
fix plot estimates (remove constant vars)
Aug 26, 2025
30e805e
create combined axis
Aug 26, 2025
c275a76
compare args for keyed arryas -> values only
Aug 26, 2025
b96890a
more tests
Aug 26, 2025
d090968
fix test for plot estimates (failed to parse shocks== :none)
Aug 26, 2025
7fde0b3
no simulate as input for plot_model_estimates
Aug 26, 2025
d78dee6
add labels to ! functions
Aug 26, 2025
129b45a
update todo
Aug 26, 2025
874f9a0
added the irf alias funcs for ! version
Aug 26, 2025
e2f5028
add get_Estimated_variables
Aug 26, 2025
27f4559
docstrings for new functions
Aug 26, 2025
ff7cd41
add tests for get_model_estimates
Sep 6, 2025
0205769
first attempt at plot! tests
Sep 6, 2025
0600787
fix shock handling and longest data for axis
Sep 10, 2025
e257247
plot_irf! tests
Sep 10, 2025
86af9d5
fix plot cond fcast plots
Sep 10, 2025
e44c73c
add tests to cndtnl fcst
Sep 10, 2025
b202181
add plot_model_estimates! tests
thorek1 Sep 11, 2025
c0108a0
fix indexing for model estimates
Sep 16, 2025
700aced
tests for plot estimates
Sep 16, 2025
792730a
Merge branch 'combine_plots' of https://github.com/thorek1/MacroModel…
Sep 16, 2025
94c7060
test also for variables to be shown
Sep 16, 2025
d7cf083
fix char string type issues
Sep 17, 2025
2855016
test jet on rc
Sep 17, 2025
188bfa2
dont test jet pre
Sep 17, 2025
a7db319
plot label instead of plot index
Sep 17, 2025
2c63638
test label and plotting modalities for model_estimates
Sep 17, 2025
fef8f11
fix strings in joint shocks and variables
Sep 17, 2025
595590b
data label more consistent
Sep 17, 2025
600a52c
more test for plotting, label and plot_type
Sep 17, 2025
8c83805
fix plot saving
Sep 17, 2025
e68d192
no rc version tag, use jet and include package in pre version
Sep 17, 2025
145272c
label added to all relevant functions
Sep 17, 2025
dd62eb8
fix docs in statsplotsext
Sep 17, 2025
659528c
fix irf and cond fcst tests
Sep 17, 2025
fcbef77
fix tests
thorek1 Sep 17, 2025
47ae63e
fix minor typos
thorek1 Sep 17, 2025
5e5a83f
fix plotting logic with delta %, label handling, shock names showing …
thorek1 Sep 17, 2025
2f578e1
more examples
thorek1 Sep 17, 2025
33ed883
fix ! tests
thorek1 Sep 18, 2025
4b1bf88
add comments
Sep 18, 2025
3ba9a24
Merge branch 'combine_plots' of https://github.com/thorek1/MacroModel…
Sep 18, 2025
1f5a850
fix tests
Sep 18, 2025
03d2d78
implement title for tables in comparison plots
thorek1 Sep 19, 2025
e3393c7
RELEVANT Input Differences
thorek1 Sep 19, 2025
2181328
update annotation font size in plot functions for consistency
thorek1 Sep 19, 2025
555238f
add print statements to func test plot section
thorek1 Sep 21, 2025
074e9d4
more plot examples
thorek1 Sep 21, 2025
5e3bd7d
obc shocks -> aux
Sep 21, 2025
4066e9d
switch around plot so that tests pass
Sep 21, 2025
6d4949b
girf for obc with plot_irf
Sep 21, 2025
cbe276c
reshuffle plotting
Sep 21, 2025
285cd59
plots_5 set up runner and tests
Sep 21, 2025
429609c
vary shocks and conditions so tests pass
Sep 21, 2025
81c77d2
update todos
Sep 21, 2025
62d84c1
Refactor IRF response generation (#138)
thorek1 Sep 21, 2025
930b2ba
Merge branch 'combine_plots' of https://github.com/thorek1/MacroModel…
Sep 21, 2025
90ecb86
move function to main script
Sep 21, 2025
7bba05d
add caldara plot tests
Sep 21, 2025
fb24c58
move down variablse plot estim, to see if its only that thing that hangs
Sep 21, 2025
c0b9e40
take out var tests
Sep 21, 2025
15b5f37
more plots_5 plot estim
Sep 22, 2025
ea117c5
fix dispatch
Sep 22, 2025
1c3610d
fix common axis issues
Sep 22, 2025
f7e6b31
fix x axis for model estimates plots
Sep 23, 2025
d2b87dc
test different data inputs with model estimates
Sep 23, 2025
ec02839
runtests with multiple models on plot model estimates
Sep 23, 2025
b6e6027
more tests
Sep 23, 2025
ecbd234
add dates for tests
Sep 23, 2025
4e981b1
no test fodler when loading data
Sep 23, 2025
67a0c3e
fix legend and cond fcst and plot_irf
Sep 23, 2025
f61f97f
allow other dates versions
Sep 23, 2025
bf13a32
test cond fcst
Sep 23, 2025
515d92f
show shock names wo shocks and take labels out from duplicate detection
thorek1 Sep 23, 2025
f9e1f55
fix test condidition on shock_names in plot_irf
thorek1 Sep 24, 2025
5bd53d6
fix x axis for shock decomposition
Sep 30, 2025
93bc8dd
fix ogic for initial state and shocks in plot_irf!
Sep 30, 2025
a37fb7a
fix initial state also for cond fcst
Sep 30, 2025
a642262
remove label from duplicate check
Sep 30, 2025
d2eb7e0
correct numbering of shocks
Sep 30, 2025
c732609
count non finite values as zero when you sum in stacked charts
Sep 30, 2025
1dc0ab4
label init_state and shock entries that are nothing with nothing so t…
Sep 30, 2025
4a61a80
redo the merging of dictionnaries
Sep 30, 2025
105c8e2
more complex conditions, shocks, iniial state indexer for cond fcst
Sep 30, 2025
934e5d3
more tests
Sep 30, 2025
c86355a
Merge branch 'combine_plots' of https://github.com/thorek1/MacroModel…
Sep 30, 2025
33aa539
Update Project.toml
thorek1 Sep 30, 2025
526a471
less strict typing for seen entries
thorek1 Oct 1, 2025
03d78eb
more tests
thorek1 Oct 1, 2025
b39dd1e
for mdoels where there is no comparison show an empty string instead …
thorek1 Oct 1, 2025
8c88c89
test jet on pre
thorek1 Oct 1, 2025
5e0c6be
include jet 0.10
thorek1 Oct 1, 2025
83d2a3c
no more println in func tests
thorek1 Oct 1, 2025
1431f16
fixed x axis in stacked plots
thorek1 Oct 1, 2025
c7f9c78
more tests
thorek1 Oct 1, 2025
d10add8
pre with JET 0.10
Oct 2, 2025
8e1c288
try again for JET on pre
Oct 2, 2025
59a7f5f
bump turing compat to 0.40
Oct 2, 2025
102743d
rm pigeons from pre tom;
Oct 2, 2025
a56498e
see if rm pigeons from compat in pre is enough to get to JET 0.10
Oct 2, 2025
7d39063
shock matrix numbering
Oct 2, 2025
4ee2ec1
rm pigeons form pre in target section only
Oct 2, 2025
a4ae722
much enlarged fix script
Oct 2, 2025
f9d9d35
test with 2 model in func tests
thorek1 Oct 3, 2025
c168274
zip data with model for plt model estims
thorek1 Oct 3, 2025
9f5057d
update label in docstring
thorek1 Oct 3, 2025
cb116bf
rm println statements
thorek1 Oct 3, 2025
607860a
change order of model parsing fo rplt model estims
thorek1 Oct 3, 2025
04f1ae9
fix doc compilation. expl ext loading didnt work
thorek1 Oct 3, 2025
0b635e0
use get irf before get_soution
thorek1 Oct 3, 2025
5e3eb11
Normalize filtering option handling for data filtering utilities (#141)
thorek1 Oct 3, 2025
84f01de
Disable generalised IRFs for first-order algorithms automatically (#139)
thorek1 Oct 3, 2025
3687127
Refactor OBC ignore handling for IRF utilities (#140)
thorek1 Oct 3, 2025
9e4b814
Add warmup and draw controls for generalised IRFs (#142)
thorek1 Oct 3, 2025
0eaf0d4
put m2 model outside of funct_test call
thorek1 Oct 3, 2025
c3848f5
avoid ! error
thorek1 Oct 3, 2025
453c768
rm ignore_obc
thorek1 Oct 3, 2025
6ed206a
Refactor algorithm and filter handling in get_shock_decomposition and…
thorek1 Oct 3, 2025
af7a5ed
Centralize default option constants across extensions (#143)
thorek1 Oct 3, 2025
9a6d3c3
Add DEFAULT_VARIABLE_SELECTION to imports in StatsPlotsExt module
thorek1 Oct 4, 2025
023a1f1
Update JSON dependency version to support 0.21 and 1
thorek1 Oct 4, 2025
dd5d0b1
Refactor maxlog default value to use DEFAULT_MAXLOG constant in filte…
thorek1 Oct 4, 2025
796296c
fix zygote
thorek1 Oct 4, 2025
a807e6b
Improve warning messages for invalid options in @model and @parameter…
thorek1 Oct 4, 2025
1487877
Enhance warning messages for invalid variables and shocks, providing …
thorek1 Oct 4, 2025
1fa450e
Update shock input assertions to provide guidance on valid shock names
thorek1 Oct 4, 2025
0d65b2c
Improve error handling in filter_data_with_model function for steady …
thorek1 Oct 4, 2025
56fbf22
Improve filter-related docstrings (#145)
thorek1 Oct 4, 2025
6071ffa
Enhance logging for algorithm adjustments in get_steady_state function
thorek1 Oct 4, 2025
cb12617
Add comprehensive plotting documentation for impulse response functions
thorek1 Oct 4, 2025
a5c9067
Refactor get_steady_state function to use algorithm selector based on…
thorek1 Oct 4, 2025
c0cb749
Comment out conditional logic for shock_names in plot_irf! function t…
thorek1 Oct 4, 2025
3a7405c
Update INITIAL_STATE documentation to clarify levels handling in get_…
thorek1 Oct 4, 2025
cfdc6b5
Clarify documentation for initial_state to specify handling of multip…
thorek1 Oct 4, 2025
33f1e07
Refactor plot_irf! function to improve shock handling and simplify lo…
thorek1 Oct 4, 2025
a478fe4
Refactor plot_irf and plot_irf! functions to streamline shock handlin…
thorek1 Oct 4, 2025
3740ebd
Refactor plot_irf and plot_irf! functions to use extended periods for…
thorek1 Oct 4, 2025
1223246
centralised shock inout handling for irf codes
thorek1 Oct 5, 2025
40f84d0
Update shock_size documentation to clarify its effect on shock size a…
thorek1 Oct 5, 2025
5cdbf95
= $shock_size
thorek1 Oct 5, 2025
d6f9df0
Refactor process_shocks_input to streamline shock handling and update…
thorek1 Oct 5, 2025
179985f
no type annotation for shock in process shock input
thorek1 Oct 5, 2025
bf12156
Enhance process_shocks_input function with type annotations and impro…
thorek1 Oct 5, 2025
b458bd0
girf draws logic throughout and info message only if some draws failed
thorek1 Oct 5, 2025
507ce7b
go through a lot of examples for plot_irf
thorek1 Oct 5, 2025
35fc312
Update action versions for PR and commit comments to v5 and v4 respec…
Oct 6, 2025
a60e0d2
Update find-comment action version to v4 in benchmark workflow
Oct 6, 2025
2f44762
fix colours in legend
Oct 6, 2025
f8836ed
Update transparency default value to 1.0 and reference it in plot doc…
Oct 6, 2025
6752f7c
create path if it doesnt exist
Oct 6, 2025
c8cc4a2
Use default option constants in docstrings (#149)
thorek1 Oct 6, 2025
82fdaa9
Merge branch 'combine_plots' of https://github.com/thorek1/MacroModel…
Oct 6, 2025
e88c60a
Add configurable save name prefixes for StatsPlots exports (#150)
thorek1 Oct 6, 2025
18ecff2
Merge branch 'combine_plots' of https://github.com/thorek1/MacroModel…
Oct 6, 2025
d1c56c0
Enhance plotting script with custom color palette and additional plot…
Oct 6, 2025
cc1051b
Complete plotting_script.jl documentation for tol, quadratic_matrix_e…
Copilot Oct 6, 2025
ffe00b0
Remove lyapunov_algorithm references from plot_irf and plot_condition…
Oct 6, 2025
e9a00f2
Enhance plot_irf function with verbose output and improved parameter …
Oct 6, 2025
1d37f2a
delete plotting.md
Oct 6, 2025
3ef7799
Refactor fix_combined_plots.jl to improve model inclusion and streaml…
thorek1 Oct 6, 2025
4184fef
Merge branch 'combine_plots' of https://github.com/thorek1/MacroModel…
thorek1 Oct 6, 2025
63dc383
Add comprehensive plotting documentation and plot generation script (…
Copilot Oct 6, 2025
478e86a
Remove outdated plotting documentation from the repository
Oct 6, 2025
5a2f5e1
plotting docs file
Oct 6, 2025
a0d1799
rm save_plots args
Oct 6, 2025
3be8ce1
Update plotting documentation to improve image captions for clarity
Oct 6, 2025
68f73ad
Update plotting documentation to correct image paths for impulse resp…
Oct 6, 2025
3a6950a
Add generate_plots script to save impulse response function plots
Oct 6, 2025
bb6d3cf
Initial plan
Copilot Oct 6, 2025
470fed8
Add covariance derivatives support in get_moments function
Copilot Oct 6, 2025
43103b1
Fix syntax error in axis3 definition
Copilot Oct 6, 2025
acaf88d
Include covariance in derivatives flag logic
Copilot Oct 6, 2025
0473c6e
Remove the generate_plots.jl script, which contained code for generat…
Oct 7, 2025
5139519
Refactor import statements to include default_options.jl only once
Oct 7, 2025
b1b5f04
Refactor plot_solution to accept single algorithm and add plot_soluti…
Copilot Oct 7, 2025
23f9051
Merge branch 'combine_plots' into copilot/fix-20a9a78f-efdd-429a-8977…
thorek1 Oct 7, 2025
d88cc6e
Remove backup file pattern from .gitignore
Oct 7, 2025
8022d9f
Merge pull request #156 from thorek1/copilot/fix-20a9a78f-efdd-429a-8…
thorek1 Oct 7, 2025
28abed3
Add rename_dictionnary parameter to plotting functions for custom dis…
Copilot Oct 26, 2025
f638839
instructions for building locally
thorek1 Oct 26, 2025
75b7b69
Update actions/checkout to v5 and reorder cache step in documentation…
thorek1 Oct 26, 2025
ee6ce4b
Refactor build instructions in make.jl for clarity and conciseness
thorek1 Oct 26, 2025
d06e794
improvements to plotting.md
thorek1 Oct 26, 2025
d1ceae0
fix many whitespaces
thorek1 Oct 26, 2025
67183c4
clean up formatting
thorek1 Oct 26, 2025
9a04383
further keywords marked explicitly
thorek1 Oct 26, 2025
40a5408
whitespace changes
thorek1 Oct 26, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,15 @@ jobs:
echo 'Go to "Actions"->"Benchmark a pull request"->[the most recent run]->"Artifacts" (at the bottom).' >> body.md

- name: Find Comment
uses: peter-evans/find-comment@v3
uses: peter-evans/find-comment@v4
id: fcbenchmark
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: 'github-actions[bot]'
body-includes: Benchmark Results

- name: Comment on PR
uses: peter-evans/create-or-update-comment@v4
uses: peter-evans/create-or-update-comment@v5
with:
comment-id: ${{ steps.fcbenchmark.outputs.comment-id }}
issue-number: ${{ github.event.pull_request.number }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/benchmark_push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,6 @@ jobs:
echo 'A plot of the benchmark results have been uploaded as an artifact to the workflow run for this PR.' >> body.md
echo 'Go to "Actions"->"Benchmark a pull request"->[the most recent run]->"Artifacts" (at the bottom).' >> body.md
- name: Create commit comment
uses: peter-evans/commit-comment@v3
uses: peter-evans/commit-comment@v4
with:
body-path: body.md
16 changes: 10 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ jobs:
os: macOS-latest
arch: arm64
test_set: "plots_4"
- version: '1'
os: ubuntu-latest
arch: x64
test_set: "plots_5"
- version: '1'
os: macOS-latest
arch: x64
Expand Down Expand Up @@ -126,15 +130,15 @@ jobs:
- uses: julia-actions/setup-julia@v2
with:
version: ${{ matrix.version }}
arch: ${{ matrix.arch }}
arch: ${{ matrix.arch }}
# On the Julia “pre” matrix entries, drop the unsupported test-only package
- name: Strip JET references on pre Julia
- name: Remove Pigeons from targets on pre Julia
if: matrix.version == 'pre'
run: |
sed -i -e '/^[[:space:]]*JET[[:space:]]*=/d' \
-e '/^\[targets\]/,$s/,[[:space:]]*"JET"//g' \
-e '/^\[targets\]/,$s/"JET",[[:space:]]*//g' \
Project.toml
sed -i \
-e '/^\[targets\]/,$s/,[[:space:]]*"Pigeons"//g' \
-e '/^\[targets\]/,$s/"Pigeons",[[:space:]]*//g' \
Project.toml
- name: Set Custom Test Environment Variable (Windows)
if: matrix.os == 'windows-latest'
run: echo "TEST_SET=${{ matrix.test_set }}" | Out-File -Append -FilePath $env:GITHUB_ENV -Encoding utf8
Expand Down
18 changes: 10 additions & 8 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@ MacroTools = "1914dd2f-81c6-5fcd-8719-6d5c9610ff09"
MatrixEquations = "99c1a7ee-ab34-5fd5-8076-27c950a045f4"
NLopt = "76087f3c-5699-56af-9a33-bf431cd00edd"
Optim = "429524aa-4258-5aef-a3af-852621145aeb"
Polyester = "f517fe37-dbe3-4b94-8317-1923a5111588"
PrecompileTools = "aea7be01-6a6a-4083-8856-8a6e6704d82a"
PythonCall = "6099a3de-0909-46bc-b1f4-468b9a2dfc0d"
REPL = "3fa0cd96-eef1-5676-8a61-b3b8758bbffb"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
RecursiveFactorization = "f2c3362d-daeb-58d1-803e-2bc74f2840b4"
Reexport = "189a3867-3050-52da-a836-e630ba90ab69"
RuntimeGeneratedFunctions = "7e49a35a-f44a-4d26-94aa-eba1b4ca6b47"
Showoff = "992d4aef-0814-514b-bc4d-f2e9a6c4116f"
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
SpecialFunctions = "276daf66-3868-5448-9aa4-cd146d93841b"
Subscripts = "2b7f82d5-8785-4f63-971e-f18ddbeb808e"
Expand Down Expand Up @@ -63,15 +63,16 @@ ChainRulesCore = "1"
Combinatorics = "1"
DataFrames = "1"
DataStructures = "0.18, 0.19"
Dates = "1"
DifferentiationInterface = "0.6,0.7"
DispatchDoctor = "0.4"
DocStringExtensions = "0.8, 0.9"
DynamicPPL = "0.23 - 0.36"
DynarePreprocessor_jll = "6, 7"
DynamicPPL = "0.35 - 0.37"
DynarePreprocessor_jll = "6"
FiniteDifferences = "0.12"
ForwardDiff = "0.10, 1"
JET = "0.7, 0.8, 0.9"
JSON = "0.21"
JET = "0.7 - 0.10"
JSON = "0.21, 1"
Krylov = "0.10"
LaTeXStrings = "1"
LineSearches = "7"
Expand All @@ -85,7 +86,6 @@ MatrixEquations = "2"
NLopt = "0.6, 1"
Optim = "1"
Pigeons = "0.3, 0.4"
Polyester = "0.7"
PrecompileTools = "1"
Preferences = "1"
PythonCall = "0.9"
Expand All @@ -94,6 +94,7 @@ Random = "1"
RecursiveFactorization = "0.2"
Reexport = "1"
RuntimeGeneratedFunctions = "0.5"
Showoff = "1"
SparseArrays = "1"
SpecialFunctions = "2"
StatsPlots = "0.15"
Expand All @@ -103,7 +104,7 @@ SymPyPythonCall = "0.2 - 0.5"
Symbolics = "5, 6"
Test = "1"
ThreadedSparseArrays = "0.2.3"
Turing = "0.30 - 0.39"
Turing = "0.30 - 0.40"
Unicode = "1"
Zygote = "0.6, 0.7"
julia = "1.10"
Expand All @@ -113,6 +114,7 @@ ADTypes = "47edcb42-4c32-4615-8424-f2b9edc5f35b"
Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595"
CSV = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b"
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"
DynamicPPL = "366bfd00-2699-11ea-058f-f148b4cae6d8"
FiniteDifferences = "26cc04aa-876d-5657-8c51-4c34ba976000"
JET = "c3a54625-cd67-489e-a8e7-0a5a0ff4e31b"
Expand All @@ -127,4 +129,4 @@ Turing = "fce5fe82-541a-59a6-adf8-730c64b5f9a0"
Zygote = "e88e6eb3-aa80-5325-afca-941959d7151f"

[targets]
test = ["ADTypes", "Aqua", "JET", "CSV", "DataFrames", "DynamicPPL", "MCMCChains", "LineSearches", "Optim", "Test", "Turing", "Pigeons", "FiniteDifferences", "Zygote", "StatsPlots", "Preferences"]
test = ["ADTypes", "Aqua", "JET", "Dates", "CSV", "DataFrames", "DynamicPPL", "MCMCChains", "LineSearches", "Optim", "Test", "Turing", "Pigeons", "FiniteDifferences", "Zygote", "StatsPlots", "Preferences"]
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ plot_irf(RBC)
The package contains the following models in the `models` folder:

- [Aguiar and Gopinath (2007)](https://www.journals.uchicago.edu/doi/10.1086/511283) `Aguiar_Gopinath_2007.jl`
- [Ascari and Sbordone (2014)](https://www.aeaweb.org/articles?id=10.1257/jel.52.3.679) `Ascari_sbordone_2014.jl`
- [Backus, Kehoe, and Kydland (1992)](https://www.jstor.org/stable/2138686) `Backus_Kehoe_Kydland_1992`
- [Ascari and Sbordone (2014)](https://www.aeaweb.org/articles?id=10.1257/jel.52.3.679) `Ascari_Sbordone_2014.jl`
- [Backus, Kehoe, and Kydland (1992)](https://www.jstor.org/stable/2138686) `Backus_Kehoe_Kydland_1992.jl`
- [Baxter and King (1993)](https://www.jstor.org/stable/2117521) `Baxter_King_1993.jl`
- [Caldara et al. (2012)](https://www.sciencedirect.com/science/article/abs/pii/S1094202511000433) `Caldara_et_al_2012.jl`
- [Gali (2015)](https://press.princeton.edu/books/hardcover/9780691164786/monetary-policy-inflation-and-the-business-cycle) - Chapter 3 `Gali_2015_chapter_3_nonlinear.jl`
Expand Down
2 changes: 1 addition & 1 deletion docs/src/api.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

```@autodocs
Modules = [MacroModelling]
Modules = [MacroModelling, StatsPlotsExt, TuringExt]
Order = [:function, :macro]
```
4 changes: 2 additions & 2 deletions docs/src/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ The latter has to do with the fact that julia code is fast once compiled, and th
The package contains the following models in the `models` folder:

- [Aguiar and Gopinath (2007)](https://www.journals.uchicago.edu/doi/10.1086/511283) `Aguiar_Gopinath_2007.jl`
- [Ascari and Sbordone (2014)](https://www.aeaweb.org/articles?id=10.1257/jel.52.3.679) `Ascari_sbordone_2014.jl`
- [Backus, Kehoe, and Kydland (1992)](https://www.jstor.org/stable/2138686) `Backus_Kehoe_Kydland_1992`
- [Ascari and Sbordone (2014)](https://www.aeaweb.org/articles?id=10.1257/jel.52.3.679) `Ascari_Sbordone_2014.jl`
- [Backus, Kehoe, and Kydland (1992)](https://www.jstor.org/stable/2138686) `Backus_Kehoe_Kydland_1992.jl`
- [Baxter and King (1993)](https://www.jstor.org/stable/2117521) `Baxter_King_1993.jl`
- [Caldara et al. (2012)](https://www.sciencedirect.com/science/article/abs/pii/S1094202511000433) `Caldara_et_al_2012.jl`
- [Gali (2015)](https://press.princeton.edu/books/hardcover/9780691164786/monetary-policy-inflation-and-the-business-cycle) - Chapter 3 `Gali_2015_chapter_3_nonlinear.jl`
Expand Down
188 changes: 188 additions & 0 deletions docs/src/plotting.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,188 @@
# Plotting

MacroModelling.jl integrates a comprehensive plotting toolkit on top of [StatsPlots.jl](https://github.com/JuliaPlots/StatsPlots.jl). The plotting API is exported together with the modelling macros, so once you define a model you can immediately visualise impulse responses, simulations, conditional forecasts, model estimates, variance decompositions, and policy functions. All plotting functions live in the `StatsPlotsExt` extension, which is loaded automatically when StatsPlots is available.

## Setup

Load the packages once per session:

```julia
using MacroModelling, StatsPlots
```

The helpers return a `Vector{Plots.Plot}`, so you can post-process or save figures with the standard StatsPlots / Plots APIs.

## IRFs at a glance (quick start)

A minimal call computes standard impulse responses for **every exogenous shock** and **every endogenous variable**, using the model’s default solution (first-order perturbation) and a **one-standard-deviation positive** shock. The example below reproduces the RBC tutorial illustration.

```julia
@model RBC begin
1 / c[0] = (β / c[1]) * (α * exp(z[1]) * k[0]^(α - 1) (1 - δ))
c[0] k[0] = (1 - δ) * k[-1] q[0]
q[0] = exp(z[0]) * k[-1]^α
z[0] = ρᶻ * z[-1] σᶻ * ϵᶻ[x]
end

@parameters RBC begin
σᶻ = 0.01
ρᶻ = 0.2
δ = 0.02
α = 0.5
β = 0.95
end

plot_irf(RBC)
```

![Default RBC impulse responses](assets/irf__RBC__eps_z__1.png)

### Defaults to remember

- `periods = 40` → the x‑axis spans 40 periods.
- `shocks = :all_excluding_obc` → plots all shocks not used to enforce OBCs.
- `variables = :all_excluding_auxiliary_and_obc` → hides auxiliary and OBC bookkeeping variables.

The plot shows every endogenous variable affected by each exogenous shock and annotates the title with the model name, shock identifier, sign of the impulse (positive by default), and the page indicator (e.g. `(1/2)`). Each subplot overlays the steady state as a horizontal reference line (non‑stochastic for first‑order solutions, stochastic otherwise) and, when the variable is strictly positive, adds a secondary axis with percentage deviations.

## Selecting shocks, variables, and horizon

You can focus the figure on a subset of shocks, select specific variables, and change the horizon. The `shocks` keyword accepts `Symbol`s, collections (vectors/tuples), string equivalents, `:simulate`, or explicit shock paths via matrices and `AxisKeys.KeyedArray`s. Variable names can be passed as symbols or strings.

```julia
# Deterministic shock sequence with a focused variable set and shorter horizon
shock_path = zeros(1, 16)
shock_path[1, 2] = 0.5
shock_path[1, 8] = -0.25
plot_irf(RBC;
shocks = shock_path,
variables = [:c, :k],
periods = 16,
plots_per_page = 2)
```

![Custom shock path and variable selection](assets/irf__RBC__shock_matrix__1.png)

The horizon automatically extends when the provided shock matrix is longer than `periods`. To switch from IRFs to **stochastic simulations**, set `shocks = :simulate` and choose the horizon with `periods`.

## Changing parameters and comparing runs

Temporarily override parameter values with `parameters`. Provide a single `Pair`, a vector of pairs, or a dictionary from parameter symbols to values.

```julia
plot_irf(RBC; parameters = [:α => 0.65, :β => 0.98])
```

![Impulse responses after a parameter change](assets/irf__RBC_new__eps_z__1.png)

To compare scenarios in the **same** figure, call the mutating companion [`plot_irf!`](@ref) after the initial plot and supply `label` entries. New lines are overlaid (or stacked if `plot_type = :stack`) using the StatsPlots backend.

```julia
plot_irf(RBC; label = "baseline")
plot_irf!(RBC; parameters = :α => 0.6, label = "higher capital share")
```

![Overlaying IRFs](assets/irf__SW03_new__eta_R__1.png)

## Shock magnitude, sign, and higher-order algorithms

- `shock_size` rescales the one‑σ impulse;
- `negative_shock = true` flips its sign.

These are helpful for stress testing or exploring asymmetries (e.g., with OBCs).

`plot_irf` supports all perturbation orders implemented by the solver; select them via:

```julia
plot_irf(RBC; algorithm = :pruned_second_order)
```

Available options include `:first_order`, `:second_order`, `:third_order`, `:pruned_second_order`, and `:pruned_third_order`.

## Generalised IRFs and stochastic starting points

Set `generalised_irf = true` to compute **generalised impulse responses** (Monte Carlo averages over simulated histories). Control the workflow with:

- `generalised_irf_warmup_iterations` (burn‑in length),
- `generalised_irf_draws` (number of draws).

For higher‑order solutions, a tailored `initial_state` (or a vector of state arrays for pruned second/third order) is often informative when studying IRFs around non‑zero deviations from steady state.

## Occasionally binding constraints (OBCs)

When models include OBCs, the helper injects the constraint shocks by default so that the displayed paths respect the imposed limits. Override with `ignore_obc = true` to study the unconstrained response to the same disturbance.

```julia
plot_irf(Gali_2015_chapter_3_obc; shocks = :eps_z, parameters = :R̄ => 1.0)
plot_irf(Gali_2015_chapter_3_obc;
shocks = :eps_z,
parameters = :R̄ => 1.0,
ignore_obc = true)
```

![IRFs with occasionally binding constraint enforced](assets/Gali_2015_chapter_3_obc__eps_z.png)
![Ignoring the occasionally binding constraint](assets/Gali_2015_chapter_3_obc__simulation__no.png)

## Layout, styling, and persistence

Quality‑of‑life keywords:

- `plots_per_page` controls how many subplots stack in a single figure.
- `plot_attributes::Dict` forwards arbitrary StatsPlots attributes (line styles, palettes, legends, fonts, grid lines, etc.).
- `label` customises legend entries when comparing scenarios.
- `show_plots` (default `true`) suppresses display in batch/documentation builds when set to `false`.
- `save_plots`, `save_plots_format`, and `save_plots_path` persist figures directly from the helper.

Because calls return a `Vector{Plot}`, you can always post‑process or save with the standard APIs.

## Solver and accuracy options

Solver‑related keywords flow into an internal `CalculationOptions` object. Use:

- `verbose` to print progress and diagnostics,
- `tol::Tolerances` to control steady‑state, Sylvester, Lyapunov, and quadratic‑equation tolerances,
- `quadratic_matrix_equation_algorithm`, `sylvester_algorithm`, and `lyapunov_algorithm` to switch linear‑algebra routines (helpful for large systems or when trying iterative solvers).

Defaults already adapt to model size (e.g., large systems may prefer iterative Sylvester solvers).

## Option reference

The table below summarises all `plot_irf` keywords. Defaults correspond to the constants in `MacroModelling.default_options`.

| Keyword | Default | Description |
| --- | --- | --- |
| `periods::Int` | `40` | Number of periods shown on the x‑axis. Automatically increased when shock matrices with more periods are supplied. |
| `shocks` | `:all_excluding_obc` | Shock selector (`Symbol`, vector/tuple of symbols, string inputs, `:simulate`, `Matrix`, or `AxisKeys.KeyedArray`). Matrices and keyed arrays provide fully specified shock paths. |
| `variables` | `:all_excluding_auxiliary_and_obc` | Which endogenous variables to plot. Accepts symbols, strings, and collections thereof. |
| `parameters` | `nothing` | Replacement parameters applied before solving and plotting. Provide a `Pair`, vector of pairs, or a dictionary. |
| `label` | `1` | Legend label attached to this run (relevant when combining plots via `plot_irf!`). |
| `show_plots::Bool` | `true` | Whether to display figures as they are created. Set to `false` for scripted runs. |
| `save_plots::Bool` | `false` | Persist the generated figures to `save_plots_path`. |
| `save_plots_format::Symbol` | `:pdf` | File format passed to `StatsPlots.savefig`. |
| `save_plots_path::String` | `"."` | Output directory used when `save_plots = true`. |
| `plots_per_page::Int` | `9` | Number of subplots per page for the returned figure collection. |
| `algorithm::Symbol` | `:first_order` | Perturbation algorithm (`:first_order`, `:second_order`, `:third_order`, `:pruned_second_order`, `:pruned_third_order`). |
| `shock_size::Real` | `1` | Scale factor applied to the shock standard deviation. |
| `negative_shock::Bool` | `false` | Flips the sign of the impulse. |
| `generalised_irf::Bool` | `false` | Computes generalised IRFs based on Monte‑Carlo simulations. |
| `generalised_irf_warmup_iterations::Int` | `100` | Number of warm‑up simulations discarded when `generalised_irf = true`. |
| `generalised_irf_draws::Int` | `50` | Number of simulated draws averaged for generalised IRFs. |
| `initial_state` | `[0.0]` | Initial deviation from the reference steady state. Supply a vector of vectors for pruned higher‑order solutions. |
| `ignore_obc::Bool` | `false` | Skip adding the shocks that enforce occasionally binding constraints. |
| `plot_attributes::Dict` | `Dict()` | Additional StatsPlots attributes merged into the plotting recipe. |
| `verbose::Bool` | `false` | Enable detailed logging for the underlying solution routine. |
| `tol::Tolerances` | `Tolerances()` | Numerical tolerances passed to the solver (see [`Tolerances`](@ref)). |
| `quadratic_matrix_equation_algorithm::Symbol` | `:schur` | Algorithm used to solve quadratic matrix equations that arise in higher‑order perturbations. |
| `sylvester_algorithm` | `DEFAULT_SYLVESTER_SELECTOR(𝓂)` | Solver used for Sylvester equations. Accepts a `Symbol`, vector, or tuple to specify second‑ and third‑order choices. |
| `lyapunov_algorithm::Symbol` | `:doubling` | Algorithm used for discrete Lyapunov equations. |

## Related helpers

The following wrappers reuse the same interface:

- [`plot_irf!`](@ref) overlays or stacks multiple runs.
- [`plot_irfs`](@ref) and [`plot_irfs!`](@ref) are aliases of the IRF routines.
- [`plot_simulation`](@ref) / [`plot_simulations`](@ref) run stochastic simulations (equivalent to `shocks = :simulate`).
- [`plot_girf`](@ref) / [`plot_girf!`](@ref) specialise in generalised IRFs.

With these tools you can produce all impulse‑response visualisations used in the tutorials and tailor them for quick calibration feedback, policy experiments, or publication‑ready figures.
Loading
Loading