Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
87 commits
Select commit Hold shift + click to select a range
78dac30
Update todo.md
thorek1 Apr 28, 2023
7e42f99
more export funcs, more explicit solve algo
thorek1 Apr 30, 2023
7951f0e
export model new func names
thorek1 Apr 30, 2023
476b48c
double export dynare entry
thorek1 May 1, 2023
2ef5237
add initial state to cond fcast; fix plot
thorek1 May 1, 2023
6323cc5
more flexible keyed array shock input
thorek1 May 1, 2023
0b13aa2
change conditions_in_levels in docs
thorek1 May 1, 2023
3d2980f
plot solution only vars with impact
thorek1 May 1, 2023
ce03339
bump version
thorek1 May 1, 2023
ae23b65
tests with conditions_in_levels
thorek1 May 1, 2023
2c4e1e3
decomposition only with keyedarrays
thorek1 May 1, 2023
8369c35
fix data handling in decomp
thorek1 May 2, 2023
a8d0581
update todos
thorek1 May 2, 2023
48e801b
update todos
thorek1 May 3, 2023
9eb8523
new get_statistics function
thorek1 May 3, 2023
b1d5457
return solved flag in first order solution
thorek1 May 3, 2023
5b2ed78
add estimation plots to gitignore
thorek1 May 3, 2023
4e28e01
fix zygote
thorek1 May 3, 2023
d4fdad4
remove svd
thorek1 May 3, 2023
579d027
bump version
thorek1 May 3, 2023
862a70c
change tol on method of moments
thorek1 May 3, 2023
3137273
spacing in SW03 model
thorek1 May 3, 2023
96c0f59
making SW03 pretty
thorek1 May 3, 2023
9f6fe49
fix kalman filter bounds check
thorek1 May 4, 2023
eceee77
bump version
thorek1 May 4, 2023
0603594
Update todo.md
thorek1 May 5, 2023
11bf6cb
Update todo.md
thorek1 May 5, 2023
5fa04cc
Update todo.md
thorek1 May 6, 2023
4fa93c6
comment parameter deifnitions in dynare
thorek1 May 6, 2023
a4a1cee
update todos
thorek1 May 6, 2023
6fc5aab
Merge branch 'main' of https://github.com/thorek1/MacroModelling.jl
thorek1 May 6, 2023
2df9ca1
Update todo.md
thorek1 May 8, 2023
d0561e2
Update ci.yml
thorek1 May 8, 2023
f831c5a
update todos
thorek1 May 8, 2023
31d761b
let SSS calc start from NSSS
thorek1 May 8, 2023
f5dc80a
Revert "let SSS calc start from NSSS"
thorek1 May 8, 2023
f415f0e
Update ci.yml
thorek1 May 8, 2023
7b9d7b8
add pruning to get_SSS
thorek1 May 8, 2023
98daefb
add pruning to tests
thorek1 May 8, 2023
973d5fe
plot pruned solution works
thorek1 May 8, 2023
0c98fbe
add pruned (g)irf
thorek1 May 9, 2023
c41786f
fix girf
thorek1 May 9, 2023
a92e856
rm test pruned irf update consistency
thorek1 May 9, 2023
a731fdd
fix test
thorek1 May 9, 2023
f8bee82
have simulate return levels by default
thorek1 May 9, 2023
3263d07
put precompilation back in
thorek1 May 9, 2023
cda1f3d
fix test for levels and plotting
thorek1 May 9, 2023
be3db0d
make irf test work
thorek1 May 9, 2023
b5f1da7
update ci
thorek1 May 9, 2023
6cab306
get_solution returns higher order solutions
thorek1 May 9, 2023
6be9054
improve docstring of get_solution
thorek1 May 9, 2023
afe7261
add weakdeps
thorek1 May 9, 2023
9f494b4
redo project.toml
thorek1 May 9, 2023
2bd1aec
redo implicitdiff
thorek1 May 9, 2023
e099c8c
test pruning
thorek1 May 9, 2023
afa7b40
undo implicitdiff changes
thorek1 May 9, 2023
ca1632f
typo
thorek1 May 10, 2023
ab69a02
todos
thorek1 May 10, 2023
cc8d215
rm higher order
thorek1 May 10, 2023
ea0330a
Merge branch 'main' into pruning
thorek1 May 10, 2023
1b26cec
Merge pull request #29 from thorek1/pruning
thorek1 May 10, 2023
267ea82
bump version
thorek1 May 10, 2023
b8a8371
Update todo.md
thorek1 May 10, 2023
42b7fdf
Update todo.md
thorek1 May 10, 2023
0e7f06b
fixed plotting of pruned solution
thorek1 May 11, 2023
d237f4f
update todo
thorek1 May 11, 2023
162de94
Update todo.md
thorek1 May 21, 2023
ba533ad
Add files via upload
matyasfarkas May 25, 2023
f8bbbb7
Filter free estimation test using Monte Carlo
matyasfarkas May 25, 2023
6aa91aa
Update filter_free.jl - Update
matyasfarkas May 25, 2023
bab2c72
solution works, need to set up filter
thorek1 Apr 28, 2023
e9fcd6a
skip aqua tests
thorek1 Apr 28, 2023
e597da6
runs
thorek1 Apr 28, 2023
11b51b5
Add files via upload
matyasfarkas May 25, 2023
55bdb24
Filter free estimation test using Monte Carlo
matyasfarkas May 25, 2023
2d5252e
Update filter_free.jl - Update
matyasfarkas May 25, 2023
631f4be
Merge branch 'filter-free' of https://github.com/matyasfarkas/macromo…
thorek1 May 26, 2023
bb33900
merge latest changes rom main branch
thorek1 May 26, 2023
82073b1
recovers shocks and parameter values; no prior
thorek1 May 26, 2023
58b1837
more annotation
thorek1 May 26, 2023
c67c5e6
delicate balance of shock llh and deviation loss
thorek1 May 29, 2023
d2274ed
recovers parameters and shocks to reasonable acc
thorek1 May 29, 2023
ff502a5
% dev. works as well
thorek1 May 29, 2023
2e330b2
consistent results between kalman and filter free
thorek1 May 29, 2023
3dc8082
comments
thorek1 May 29, 2023
911b012
test museinference
thorek1 May 31, 2023
3f9a1b3
Filter-free advantage with t-shocks Monte Carlo
matyasfarkas Jun 2, 2023
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
8 changes: 6 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ jobs:
fail-fast: false
matrix:
version:
- '1'
- '^1.9.0-0' #^1-0 and ^1.9-0 are not recognised
- '1.8'
- '1.9' #^1-0 and ^1.9-0 are not recognised
# - 'nightly' # fails for zygote
os:
- ubuntu-latest
Expand All @@ -26,6 +26,10 @@ jobs:
include:
- os: ubuntu-latest
prefix: xvfb-run
# - version: 'nightly'
# os: ubuntu-latest
# arch: x64
# allow_failure: true
steps:
- uses: actions/checkout@v3
- uses: julia-actions/setup-julia@latest
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,4 @@ fevd*.png
solution*.png
conditional_fcst*.png
.CondaPkg/
estimation__*
13 changes: 12 additions & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
name = "MacroModelling"
uuid = "687ffad2-3618-405e-ac50-e0f7b9c75e44"
authors = ["Thore Kockerols <[email protected]>"]
version = "0.1.19"
version = "0.1.23"

[deps]
AbstractDifferentiation = "c29ec348-61ec-40c8-8164-b8c60e9d9f3d"
AdvancedHMC = "0bf59076-c3b1-5ca4-86bd-e02cd72cde3d"
AxisKeys = "94b1ba4f-4ee9-5380-92f1-94cde586c3c5"
BlockTriangularForm = "adeb47b7-70bf-415a-bb24-c358563e873a"
ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4"
ComponentArrays = "b0b7db55-cfe3-40fc-9ded-d10e2dbeff66"
DataStructures = "864edb3b-99cc-5e75-8d2d-829cb0a9cfe8"
DifferentiableStateSpaceModels = "beacd9db-9e5e-4956-9b09-459a4b2028df"
DocStringExtensions = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae"
DynamicHMC = "bbc10e6e-7c05-544b-b16e-64fede858acb"
DynarePreprocessor_jll = "23afba7c-24e5-5ee2-bc2c-b42e07f0492a"
FiniteDifferences = "26cc04aa-876d-5657-8c51-4c34ba976000"
ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210"
Expand All @@ -21,6 +25,7 @@ LineSearches = "d3d80556-e9d4-5f37-9878-2ab0fcc64255"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
LinearMaps = "7a12625a-238d-50fd-b39a-03d52299707e"
MacroTools = "1914dd2f-81c6-5fcd-8719-6d5c9610ff09"
MuseInference = "43b88160-90c7-4f71-933b-9d65205cd921"
Optim = "429524aa-4258-5aef-a3af-852621145aeb"
PrecompileTools = "aea7be01-6a6a-4083-8856-8a6e6704d82a"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
Expand All @@ -38,6 +43,10 @@ Symbolics = "0c5d862f-8b57-4792-8d23-62f2024744c7"
Turing = "fce5fe82-541a-59a6-adf8-730c64b5f9a0"
Zygote = "e88e6eb3-aa80-5325-afca-941959d7151f"

[weakdeps]
StatsPlots = "f3b207a7-027a-5e70-b257-86293d7955fd"
Turing = "fce5fe82-541a-59a6-adf8-730c64b5f9a0"

[compat]
AxisKeys = "^0.2"
BlockTriangularForm = "^0.1"
Expand All @@ -60,9 +69,11 @@ Requires = "^1"
RuntimeGeneratedFunctions = "^0.5"
SpecialFunctions = "^2"
SpeedMapping = "^0.3"
StatsPlots = "^0.15"
Subscripts = "^0.1"
SymPy = "^1"
Symbolics = "^5"
Turing = "^0.21"
julia = "1.8"

[extras]
Expand Down
8 changes: 5 additions & 3 deletions docs/src/tutorials/rbc.md
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ For simulations this is possible by calling [`simulate`](@ref):
simulate(RBC)
```

which returns the simulated data in a 3-dimensional `KeyedArray` of the same structure as for the IRFs.
which returns the simulated data in levels in a 3-dimensional `KeyedArray` of the same structure as for the IRFs.

## Conditional forecasts

Expand Down Expand Up @@ -206,17 +206,19 @@ Note that for the first 4 periods the shock has no predetermined value and is de
Finally we can get the conditional forecast:

```@repl tutorial_1
get_conditional_forecast(RBC, conditions, shocks = shocks)
get_conditional_forecast(RBC, conditions, shocks = shocks, conditions_in_levels = false)
```

The function returns a `KeyedArray` with the values of the endogenous variables and shocks matching the conditions exactly.

We can also plot the conditional forecast. Please note that you need to import the `StatsPlots` packages once before the first plot. In order to plot we can use:

```@repl tutorial_1
plot_conditional_forecast(RBC, conditions, shocks = shocks)
plot_conditional_forecast(RBC, conditions, shocks = shocks, conditions_in_levels = false)
```

![RBC conditional forecast](../assets/conditional_fcst__RBC__conditional_forecast__1.png)

and we need to set `conditions_in_levels = false` since the conditions are defined in deviations.

Note that the stars indicate the values the model is conditioned on.
8 changes: 5 additions & 3 deletions docs/src/tutorials/sw03.md
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ For simulations this is possible by calling [`simulate`](@ref):
simulate(SW03)
```

which returns the simulated data in a 3-dimensional `KeyedArray` of the same structure as for the IRFs.
which returns the simulated data in levels in a 3-dimensional `KeyedArray` of the same structure as for the IRFs.

## Conditional forecasts

Expand Down Expand Up @@ -340,19 +340,21 @@ The above shock `Matrix` means that for the first two periods shocks 1, 2, 3, 5,
Finally we can get the conditional forecast:

```@repl tutorial_2
get_conditional_forecast(SW03, conditions, shocks = shocks, variables = [:Y,:pi,:W])
get_conditional_forecast(SW03, conditions, shocks = shocks, variables = [:Y,:pi,:W], conditions_in_levels = false)
```

The function returns a `KeyedArray` with the values of the endogenous variables and shocks matching the conditions exactly.

We can also plot the conditional forecast. Please note that you need to import the `StatsPlots` packages once before the first plot.

```@repl tutorial_2
plot_conditional_forecast(SW03,conditions, shocks = shocks, plots_per_page = 6,variables = [:Y,:pi,:W])
plot_conditional_forecast(SW03,conditions, shocks = shocks, plots_per_page = 6,variables = [:Y,:pi,:W],conditions_in_levels = false)
```

![SW03 conditional forecast 1](../assets/conditional_fcst__SW03__conditional_forecast__1.png)

![SW03 conditional forecast 2](../assets/conditional_fcst__SW03__conditional_forecast__2.png)

and we need to set `conditions_in_levels = false` since the conditions are defined in deviations.

Note that the stars indicate the values the model is conditioned on.
25 changes: 22 additions & 3 deletions docs/src/unfinished_docs/todo.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,24 @@
## High priority

- [ ] add balanced growth path handling
- [ ] add JOSS article (see Makie.jl)
- [ ] write docs for (non-linear) solution algorithms
- [ ] for cond forecastind and kalman, get rid of observables input and use axis key of data input
- [ ] for cond forecasting allow less shocks than conditions with a warning. should be svd then
- [ ] have parser accept rss | (r[ss] - 1) * 400 = rss
- [ ] when doing calibration with optimiser have better return values when he doesnt find a solution (probably NaN)
- [ ] sampler returned negative std. investigate and come up with solution ensuring sampler can continue
- [ ] automatically adjust plots for different legend widhts and heights
- [ ] include weakdeps: https://pkgdocs.julialang.org/dev/creating-packages/#Weak-dependencies
- [ ] write to mod file for unicode characters. have them take what you would type: \alpha\bar
- [ ] have get_std take variables as an input
- [ ] more informative errors when something goes wrong when writing a model
- [ ] initial state accept keyed array
- [ ] bring solution error into an object of the model so we dont have to pass it on as output
- [ ] check that there is an error if he cant find SS
- [ ] plot_model_estimates with unconditional forecast at the end
- [ ] check if you can do analytic derivatives for higher order derivatives
- [ ] kick out unsused parameters from m.parameters
- [ ] kick out unused parameters from m.parameters
- [ ] higher order solution derivs with Zygote
- [ ] use cache for gradient calc in estimation (see DifferentiableStateSpaceModels)
- [ ] use krylov instead of linearsolve and speed up sparse matrix calcs in implicit diff of higher order funcs
Expand All @@ -29,7 +45,10 @@
- [ ] figure out combinations for inputs (parameters and variables in different formats for get_irf for example)
- [ ] Find any SS by optimising over both SS guesses and parameter inputs
- [ ] weed out SS solver and saved objects


- [x] fix ss of pruned solution in plotsolution. seems detached
- [x] get solution higher order with multidimensional array (states, 1 and 2 partial derivatives variables names as dimensions in 2order case)
- [x] add pruning
- [x] add other outputs from estimation (smoothed, filter states and shocks)
- [x] shorten plot_irf (take inspiration from model estimate)
- [x] fix solution plot
Expand Down Expand Up @@ -96,7 +115,6 @@
- [ ] rewrite first order with riccati equation MatrixEquations.jl
- [ ] exploit variable incidence and compression for higher order derivatives
- [ ] for estimation use CUDA with st order: linear time iteration starting from last 1st order solution and then LinearSolveCUDA solvers for higher orders. this should bring benefits for large models and HANK models
- [ ] test on highly [nonlinear model](https://www.sciencedirect.com/science/article/pii/S0165188917300970)
- [ ] pull request in StatsFuns to have norminv... accept type numbers and add translation from matlab: norminv to StatsFuns norminvcdf
- [ ] more informative errors when declaring equations/ calibration
- [ ] unit equation errors
Expand All @@ -106,6 +124,7 @@
- [ ] print legend for algorithm in last subplot of plot only
- [ ] select variables for moments

- [x] test on highly [nonlinear model](https://www.sciencedirect.com/science/article/pii/S0165188917300970) # caldara et al is actually epstein zin wiht stochastic vol
- [x] conditional forecasting
- [x] find way to recover from failed SS solution which is written to init guess
- [x] redo ugly solution for selecting parameters to differentiate for
Expand Down
125 changes: 91 additions & 34 deletions models/SW03.jl
Original file line number Diff line number Diff line change
@@ -1,105 +1,162 @@
@model SW03 begin
-q[0] + beta * ((1 - tau) * q[1] + epsilon_b[1] * (r_k[1] * z[1] - psi^-1 * r_k[ss] * (-1 + exp(psi * (-1 + z[1])))) * (C[1] - h * C[0])^(-sigma_c))

-q_f[0] + beta * ((1 - tau) * q_f[1] + epsilon_b[1] * (r_k_f[1] * z_f[1] - psi^-1 * r_k_f[ss] * (-1 + exp(psi * (-1 + z_f[1])))) * (C_f[1] - h * C_f[0])^(-sigma_c))

-r_k[0] + alpha * epsilon_a[0] * mc[0] * L[0]^(1 - alpha) * (K[-1] * z[0])^(-1 + alpha)

-r_k_f[0] + alpha * epsilon_a[0] * mc_f[0] * L_f[0]^(1 - alpha) * (K_f[-1] * z_f[0])^(-1 + alpha)

-G[0] + T[0]

-G[0] + G_bar * epsilon_G[0]

-G_f[0] + T_f[0]

-G_f[0] + G_bar * epsilon_G[0]

-L[0] + nu_w[0]^-1 * L_s[0]

-L_s_f[0] + L_f[0] * (W_i_f[0] * W_f[0]^-1)^(lambda_w^-1 * (-1 - lambda_w))

L_s_f[0] - L_f[0]

L_s_f[0] + lambda_w^-1 * L_f[0] * W_f[0]^-1 * (-1 - lambda_w) * (-W_disutil_f[0] + W_i_f[0]) * (W_i_f[0] * W_f[0]^-1)^(-1 + lambda_w^-1 * (-1 - lambda_w))

Pi_ws_f[0] - L_s_f[0] * (-W_disutil_f[0] + W_i_f[0])

Pi_ps_f[0] - Y_f[0] * (-mc_f[0] + P_j_f[0]) * P_j_f[0]^(-lambda_p^-1 * (1 + lambda_p))

-Q[0] + epsilon_b[0]^-1 * q[0] * (C[0] - h * C[-1])^(sigma_c)

-Q_f[0] + epsilon_b[0]^-1 * q_f[0] * (C_f[0] - h * C_f[-1])^(sigma_c)

-W[0] + epsilon_a[0] * mc[0] * (1 - alpha) * L[0]^(-alpha) * (K[-1] * z[0])^alpha

-W_f[0] + epsilon_a[0] * mc_f[0] * (1 - alpha) * L_f[0]^(-alpha) * (K_f[-1] * z_f[0])^alpha

-Y_f[0] + Y_s_f[0]

Y_s[0] - nu_p[0] * Y[0]

-Y_s_f[0] + Y_f[0] * P_j_f[0]^(-lambda_p^-1 * (1 + lambda_p))

beta * epsilon_b[1] * (C_f[1] - h * C_f[0])^(-sigma_c) - epsilon_b[0] * R_f[0]^-1 * (C_f[0] - h * C_f[-1])^(-sigma_c)

beta * epsilon_b[1] * pi[1]^-1 * (C[1] - h * C[0])^(-sigma_c) - epsilon_b[0] * R[0]^-1 * (C[0] - h * C[-1])^(-sigma_c)

Y_f[0] * P_j_f[0]^(-lambda_p^-1 * (1 + lambda_p)) - lambda_p^-1 * Y_f[0] * (1 + lambda_p) * (-mc_f[0] + P_j_f[0]) * P_j_f[0]^(-1 - lambda_p^-1 * (1 + lambda_p))

epsilon_b[0] * W_disutil_f[0] * (C_f[0] - h * C_f[-1])^(-sigma_c) - omega * epsilon_b[0] * epsilon_L[0] * L_s_f[0]^sigma_l

-1 + xi_p * (pi[0]^-1 * pi[-1]^gamma_p)^(-lambda_p^-1) + (1 - xi_p) * pi_star[0]^(-lambda_p^-1)

-1 + (1 - xi_w) * (w_star[0] * W[0]^-1)^(-lambda_w^-1) + xi_w * (W[-1] * W[0]^-1)^(-lambda_w^-1) * (pi[0]^-1 * pi[-1]^gamma_w)^(-lambda_w^-1)

-Phi - Y_s[0] + epsilon_a[0] * L[0]^(1 - alpha) * (K[-1] * z[0])^alpha

-Phi - Y_f[0] * P_j_f[0]^(-lambda_p^-1 * (1 + lambda_p)) + epsilon_a[0] * L_f[0]^(1 - alpha) * (K_f[-1] * z_f[0])^alpha

std_eta_b * eta_b[x] - log(epsilon_b[0]) + rho_b * log(epsilon_b[-1])

-std_eta_L * eta_L[x] - log(epsilon_L[0]) + rho_L * log(epsilon_L[-1])

std_eta_I * eta_I[x] - log(epsilon_I[0]) + rho_I * log(epsilon_I[-1])

std_eta_w * eta_w[x] - f_1[0] + f_2[0]

std_eta_a * eta_a[x] - log(epsilon_a[0]) + rho_a * log(epsilon_a[-1])

std_eta_p * eta_p[x] - g_1[0] + g_2[0] * (1 + lambda_p)

std_eta_G * eta_G[x] - log(epsilon_G[0]) + rho_G * log(epsilon_G[-1])

-f_1[0] + beta * xi_w * f_1[1] * (w_star[0]^-1 * w_star[1])^(lambda_w^-1) * (pi[1]^-1 * pi[0]^gamma_w)^(-lambda_w^-1) + epsilon_b[0] * w_star[0] * L[0] * (1 + lambda_w)^-1 * (C[0] - h * C[-1])^(-sigma_c) * (w_star[0] * W[0]^-1)^(-lambda_w^-1 * (1 + lambda_w))

-f_2[0] + beta * xi_w * f_2[1] * (w_star[0]^-1 * w_star[1])^(lambda_w^-1 * (1 + lambda_w) * (1 + sigma_l)) * (pi[1]^-1 * pi[0]^gamma_w)^(-lambda_w^-1 * (1 + lambda_w) * (1 + sigma_l)) + omega * epsilon_b[0] * epsilon_L[0] * (L[0] * (w_star[0] * W[0]^-1)^(-lambda_w^-1 * (1 + lambda_w)))^(1 + sigma_l)

-g_1[0] + beta * xi_p * pi_star[0] * g_1[1] * pi_star[1]^-1 * (pi[1]^-1 * pi[0]^gamma_p)^(-lambda_p^-1) + epsilon_b[0] * pi_star[0] * Y[0] * (C[0] - h * C[-1])^(-sigma_c)

-g_2[0] + beta * xi_p * g_2[1] * (pi[1]^-1 * pi[0]^gamma_p)^(-lambda_p^-1 * (1 + lambda_p)) + epsilon_b[0] * mc[0] * Y[0] * (C[0] - h * C[-1])^(-sigma_c)

-nu_w[0] + (1 - xi_w) * (w_star[0] * W[0]^-1)^(-lambda_w^-1 * (1 + lambda_w)) + xi_w * nu_w[-1] * (W[-1] * pi[0]^-1 * W[0]^-1 * pi[-1]^gamma_w)^(-lambda_w^-1 * (1 + lambda_w))

-nu_p[0] + (1 - xi_p) * pi_star[0]^(-lambda_p^-1 * (1 + lambda_p)) + xi_p * nu_p[-1] * (pi[0]^-1 * pi[-1]^gamma_p)^(-lambda_p^-1 * (1 + lambda_p))

-K[0] + K[-1] * (1 - tau) + I[0] * (1 - 0.5 * varphi * (-1 + I[-1]^-1 * epsilon_I[0] * I[0])^2)

-K_f[0] + K_f[-1] * (1 - tau) + I_f[0] * (1 - 0.5 * varphi * (-1 + I_f[-1]^-1 * epsilon_I[0] * I_f[0])^2)

U[0] - beta * U[1] - epsilon_b[0] * ((1 - sigma_c)^-1 * (C[0] - h * C[-1])^(1 - sigma_c) - omega * epsilon_L[0] * (1 + sigma_l)^-1 * L_s[0]^(1 + sigma_l))

U_f[0] - beta * U_f[1] - epsilon_b[0] * ((1 - sigma_c)^-1 * (C_f[0] - h * C_f[-1])^(1 - sigma_c) - omega * epsilon_L[0] * (1 + sigma_l)^-1 * L_s_f[0]^(1 + sigma_l))

-epsilon_b[0] * (C[0] - h * C[-1])^(-sigma_c) + q[0] * (1 - 0.5 * varphi * (-1 + I[-1]^-1 * epsilon_I[0] * I[0])^2 - varphi * I[-1]^-1 * epsilon_I[0] * I[0] * (-1 + I[-1]^-1 * epsilon_I[0] * I[0])) + beta * varphi * I[0]^-2 * epsilon_I[1] * q[1] * I[1]^2 * (-1 + I[0]^-1 * epsilon_I[1] * I[1])

-epsilon_b[0] * (C_f[0] - h * C_f[-1])^(-sigma_c) + q_f[0] * (1 - 0.5 * varphi * (-1 + I_f[-1]^-1 * epsilon_I[0] * I_f[0])^2 - varphi * I_f[-1]^-1 * epsilon_I[0] * I_f[0] * (-1 + I_f[-1]^-1 * epsilon_I[0] * I_f[0])) + beta * varphi * I_f[0]^-2 * epsilon_I[1] * q_f[1] * I_f[1]^2 * (-1 + I_f[0]^-1 * epsilon_I[1] * I_f[1])
std_eta_pi * eta_pi[x] - log(pi_obj[0]) + rho_pi_bar * log(pi_obj[-1]) + log(calibr_pi_obj) * (1 - rho_pi_bar)

-C[0] - I[0] - T[0] + Y[0] - psi^-1 * r_k[ss] * K[-1] * (-1 + exp(psi * (-1 + z[0])))
-calibr_pi + std_eta_R * eta_R[x] - log(R[ss]^-1 * R[0]) + r_Delta_pi * (-log(pi[ss]^-1 * pi[-1]) + log(pi[ss]^-1 * pi[0])) + r_Delta_y * (-log(Y[ss]^-1 * Y[-1]) + log(Y[ss]^-1 * Y[0]) + log(Y_f[ss]^-1 * Y_f[-1]) - log(Y_f[ss]^-1 * Y_f[0])) + rho * log(R[ss]^-1 * R[-1]) + (1 - rho) * (log(pi_obj[0]) + r_pi * (-log(pi_obj[0]) + log(pi[ss]^-1 * pi[-1])) + r_Y * (log(Y[ss]^-1 * Y[0]) - log(Y_f[ss]^-1 * Y_f[0])))

-C_f[0] - I_f[0] + Pi_ws_f[0] - T_f[0] + Y_f[0] + L_s_f[0] * W_disutil_f[0] - L_f[0] * W_f[0] - psi^-1 * r_k_f[ss] * K_f[-1] * (-1 + exp(psi * (-1 + z_f[0])))

epsilon_b[0] * (K[-1] * r_k[0] - r_k[ss] * K[-1] * exp(psi * (-1 + z[0]))) * (C[0] - h * C[-1])^(-sigma_c)

epsilon_b[0] * (K_f[-1] * r_k_f[0] - r_k_f[ss] * K_f[-1] * exp(psi * (-1 + z_f[0]))) * (C_f[0] - h * C_f[-1])^(-sigma_c)


# Perceived inflation objective
std_eta_pi * eta_pi[x] - log(pi_obj[0]) + rho_pi_bar * log(pi_obj[-1]) + log(calibr_pi_obj) * (1 - rho_pi_bar)

# Taylor rule
-calibr_pi + std_eta_R * eta_R[x] - log(R[ss]^-1 * R[0]) + r_Delta_pi * (-log(pi[ss]^-1 * pi[-1]) + log(pi[ss]^-1 * pi[0])) + r_Delta_y * (-log(Y[ss]^-1 * Y[-1]) + log(Y[ss]^-1 * Y[0]) + log(Y_f[ss]^-1 * Y_f[-1]) - log(Y_f[ss]^-1 * Y_f[0])) + rho * log(R[ss]^-1 * R[-1]) + (1 - rho) * (log(pi_obj[0]) + r_pi * (-log(pi_obj[0]) + log(pi[ss]^-1 * pi[-1])) + r_Y * (log(Y[ss]^-1 * Y[0]) - log(Y_f[ss]^-1 * Y_f[0])))

end

@parameters SW03 begin
lambda_p = .368
G_bar = .362
lambda_p = 0.368
G_bar = 0.362
lambda_w = 0.5
Phi = .819
Phi = 0.819

alpha = 0.3
beta = 0.99
alpha = 0.3
beta = 0.99
gamma_w = 0.763
gamma_p = 0.469
h = 0.573
omega = 1
psi = 0.169
h = 0.573
omega = 1
psi = 0.169

r_pi = 1.684
r_Y = 0.099
r_Delta_pi = 0.14
r_Delta_y = 0.159
r_pi = 1.684
r_Y = 0.099
r_Delta_pi = 0.14
r_Delta_y = 0.159

sigma_c = 1.353
sigma_l = 2.4
tau = 0.025
varphi = 6.771
xi_w = 0.737
xi_p = 0.908
tau = 0.025
varphi = 6.771
xi_w = 0.737
xi_p = 0.908

rho = 0.961
rho_b = 0.855
rho_L = 0.889
rho_I = 0.927
rho_a = 0.823
rho_G = 0.949
rho_pi_bar = 0.924
rho = 0.961
rho_b = 0.855
rho_L = 0.889
rho_I = 0.927
rho_a = 0.823
rho_G = 0.949
rho_pi_bar = 0.924

std_scaling_factor = 10

std_eta_b = 0.336 / std_scaling_factor
std_eta_L = 3.52 / std_scaling_factor
std_eta_I = 0.085 / std_scaling_factor
std_eta_a = 0.598 / std_scaling_factor
std_eta_w = 0.6853261 / std_scaling_factor
std_eta_p = 0.7896512 / std_scaling_factor
std_eta_G = 0.325 / std_scaling_factor
std_eta_R = 0.081 / std_scaling_factor
std_eta_pi = 0.017 / std_scaling_factor
std_eta_b = 0.336 / std_scaling_factor
std_eta_L = 3.52 / std_scaling_factor
std_eta_I = 0.085 / std_scaling_factor
std_eta_a = 0.598 / std_scaling_factor
std_eta_w = 0.6853261 / std_scaling_factor
std_eta_p = 0.7896512 / std_scaling_factor
std_eta_G = 0.325 / std_scaling_factor
std_eta_R = 0.081 / std_scaling_factor
std_eta_pi = 0.017 / std_scaling_factor

calibr_pi_obj | 1 = pi_obj[ss]
calibr_pi | pi[ss] = pi_obj[ss]
Expand Down
Loading