You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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/3)`). 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.
73
74
74
-
### Algorithm
75
+
### `algorithm`
75
76
76
-
[Default: `:first_order`, Type: `Symbol`]: algorithm to solve for the dynamics of the model. Available algorithms: `:first_order`, `:second_order`, `:pruned_second_order`, `:third_order`, `:pruned_third_order`
77
+
[Default: `:first_order`, Type: `Symbol`]: algorithm to solve for the dynamics of the model. Available algorithms: `:first_order`, `:second_order`, `:pruned_second_order`, `:third_order`, `:pruned_third_order`.
77
78
You can plot IRFs for different solution algorithms. Here we use a second-order perturbation solution:
78
79
79
80
```julia
@@ -98,6 +99,7 @@ We can compare the two solution methods side by side with `plot_irf!`, which add
Note that the pruned third-order solution includes the effect of time varying risk and flips the sign for the reaction of `MC` and `N`. The additional solution is added to the plot as another colored line and another entry in the legend and a new entry in the table below highlighting the relevant steady states.
121
123
122
-
### Initial state
124
+
### `initial_state`
123
125
124
126
[Default: `[0.0]`, Type: `Union{Vector{Vector{Float64}},Vector{Float64}}`]: The initial state defines the starting point for the model. In the case of pruned solution algorithms the initial state can be given as multiple state vectors (Vector{Vector{Float64}}). In this case the initial state must be given in deviations from the non-stochastic steady state. In all other cases the initial state must be given in levels. If a pruned solution algorithm is selected and `initial_state` is a Vector{Float64} then it impacts the first order initial state vector only. The state includes all variables as well as exogenous variables in leads or lags if present. `get_irf(𝓂, shocks = :none, variables = :all, periods = 1)` returns a `KeyedArray` with all variables. The `KeyedArray` type is provided by the AxisKeys package.
@@ -473,6 +485,7 @@ We can plot them on top of each other using the :stack option:
473
485
```julia
474
486
plot_irf(Gali_2015_chapter_3_nonlinear,
475
487
shocks = shock_matrix_1)
488
+
476
489
plot_irf!(Gali_2015_chapter_3_nonlinear,
477
490
shocks = shock_matrix_2,
478
491
plot_type =:stack)
@@ -501,9 +514,11 @@ Let's take a shock matrix with 15 period length as input and set the periods arg
501
514
502
515
```julia
503
516
shock_matrix =zeros(length(shocks), 15)
517
+
504
518
shock_matrix[1, 1] = .1
505
519
shock_matrix[3, 5] =-1/2
506
520
shock_matrix[2, 15] =1/3
521
+
507
522
plot_irf!(Gali_2015_chapter_3_nonlinear,
508
523
shocks = shock_matrix,
509
524
periods =20)
@@ -623,6 +638,7 @@ In order to see the auxiliary variables let's use a model that has auxiliary var
623
638
log_gy_obs[0] =log(gy_obs[0])
624
639
log_gp_obs[0] =log(gp_obs[0])
625
640
end
641
+
626
642
@parameters FS2000 begin
627
643
alp =0.356
628
644
bet =0.993
@@ -639,8 +655,8 @@ end
639
655
both c and P appear in t+2 and will thereby add auxiliary variables to the model. If we now plot the IRF for all variables excluding OBC-related ones we see the auxiliary variables as well:
640
656
641
657
```julia
642
-
plot_irf(FS2000,
643
-
variables =:all_excluding_obc)
658
+
plot_irf(FS2000,
659
+
variables =:all_excluding_obc)
644
660
```
645
661
646
662

@@ -675,6 +691,7 @@ c and P appear twice, once as the variable itself and once as an auxiliary varia
675
691
r_real_ann[0] =4*log(realinterest[0])
676
692
M_real[0] = Y[0] / R[0] ^ η
677
693
end
694
+
678
695
@parameters Gali_2015_chapter_3_obc begin
679
696
R̄ =1.0
680
697
σ =1
@@ -737,6 +754,7 @@ The steady states and dynamics changed as a result of changing the discount fact
737
754
plot_irf(Gali_2015_chapter_3_nonlinear,
738
755
parameters =:β=>0.99,
739
756
shocks =:eps_a)
757
+
740
758
plot_irf!(Gali_2015_chapter_3_nonlinear,
741
759
parameters =:β=>0.95,
742
760
shocks =:eps_a)
@@ -770,7 +788,9 @@ or simply a Vector of parameter values in the order they were defined in the mod
The comparison of the IRFs for S reveals that the reaction of S is highly state dependent and can go either way depending on the state of the economy when the shock hits. The same is true for `W_real`, while the other variables are less state dependent and the GIRF and standard IRF are more similar.
The number of draws and warmup iterations can be adjusted using the generalised_irf_draws and generalised_irf_warmup_iterations arguments. Increasing the number of draws will increase the accuracy of the GIRF at the cost of increased computation time. The warmup iterations are used to ensure that the starting points of the individual draws are exploring the state space sufficiently and are representative of the model's ergodic distribution.
893
+
The number of draws and warmup iterations can be adjusted using the `generalised_irf_draws` and `generalised_irf_warmup_iterations` arguments. Increasing the number of draws will increase the accuracy of the GIRF at the cost of increased computation time. The warmup iterations are used to ensure that the starting points of the individual draws are exploring the state space sufficiently and are representative of the model's ergodic distribution.
874
894
875
895
Let's start with the GIRF that had the wiggly lines above:
876
896
@@ -915,6 +935,7 @@ In order to fully cover the ergodic distribution of the model it can be useful t
[Default: `Tolerances()`, Type: `Tolerances`]: define various tolerances for the algorithm used to solve the model. See documentation of Tolerances for more details: `?Tolerances`
1116
-
You can adjust the tolerances used in the numerical solvers. The Tolerances object allows you to set tolerances for the non-stochastic steady state solver (NSSS), Sylvester equations, Lyapunov equation, and quadratic matrix equation (qme). For example, to set tighter tolerances (here we also change parameters to force a recomputation of the solution):
1130
+
You can adjust the tolerances used in the numerical solvers. The Tolerances object allows you to set tolerances for the non-stochastic steady state solver (NSSS), Sylvester equations, Lyapunov equation, and quadratic matrix equation (QME). For example, to set tighter tolerances (here we also change parameters to force a recomputation of the solution):
For most use cases, the default :schur algorithm is recommended. Use this argument if you have specific needs or encounter issues with the default solver.
1159
+
For most use cases, the default `:schur` algorithm is recommended. Use this argument if you have specific needs or encounter issues with the default solver.
1145
1160
1146
1161
### `sylvester_algorithm`
1147
1162
@@ -1162,8 +1177,7 @@ For third-order solutions, you can specify different algorithms for the second a
0 commit comments