Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

obc #58

Merged
merged 109 commits into from
Nov 19, 2023
Merged

obc #58

Show file tree
Hide file tree
Changes from 83 commits
Commits
Show all changes
109 commits
Select commit Hold shift + click to select a range
fa4708d
parse maxmin + calc NSSS
thorek1 Oct 11, 2023
3a79e2a
parse obc
thorek1 Oct 12, 2023
b7fc564
playing around with optim to find shocks
thorek1 Oct 12, 2023
d1f1488
got 1 period optim going
thorek1 Oct 17, 2023
6a87342
update todo
thorek1 Oct 19, 2023
62b95ae
get irfs, simulate and plotting works
thorek1 Oct 25, 2023
15a0094
switch solver, exclude ocb vars/shocks, edit docs
thorek1 Oct 25, 2023
5e7cf29
fix state_update functions types
thorek1 Oct 25, 2023
71e89be
fix variable selection (obc/aux)
thorek1 Oct 26, 2023
3db5d67
fix obc func conditions+kalman error
thorek1 Oct 26, 2023
0308b14
test suite
thorek1 Oct 26, 2023
9fe91d2
fix kalman filter pullback and estimation test
thorek1 Oct 27, 2023
a1b9f99
helpers
thorek1 Oct 27, 2023
ecd43f7
add iacoviello 2005 model
thorek1 Oct 27, 2023
7ca4314
prototype investment constraints
thorek1 Oct 27, 2023
9241112
Merge branch 'main' into obc
thorek1 Oct 27, 2023
19133b8
Merge branch 'main' into obc
thorek1 Oct 31, 2023
5a7a9f0
borrcon works
thorek1 Nov 3, 2023
b08c968
got it to work for two examples
thorek1 Nov 4, 2023
223bcb4
smarter expected shocks construction
thorek1 Nov 5, 2023
e0a0796
improved precision
thorek1 Nov 5, 2023
fda69ed
MadNLP->NLopt+correct shock signs+3 examples work
thorek1 Nov 6, 2023
3112064
works but not optimal
thorek1 Nov 10, 2023
b1223b1
add max_obc_shift
thorek1 Nov 10, 2023
55f87f7
works on all examples
thorek1 Nov 10, 2023
c7ceda1
transform obc s into correct form
thorek1 Nov 10, 2023
2771550
implement complementarity
thorek1 Nov 11, 2023
3351d22
fix tests
thorek1 Nov 11, 2023
92e5bc0
compat for tests
thorek1 Nov 11, 2023
8f90a6c
obc shock param
thorek1 Nov 12, 2023
6a88952
lower accuracy for obc
thorek1 Nov 14, 2023
383ce63
gi2017 model
thorek1 Nov 14, 2023
e3d9b59
debuggers
thorek1 Nov 14, 2023
521485a
ready solver optimisation
thorek1 Nov 14, 2023
6d20003
SS solver parameters as variable input
thorek1 Nov 14, 2023
09a58a5
SS_solve_func has cold_start param, returns iters
thorek1 Nov 14, 2023
b4ec315
fix tests
thorek1 Nov 14, 2023
28301f8
fix ss_solve_func returns
thorek1 Nov 14, 2023
34aef16
cleaner SS solver optim
thorek1 Nov 16, 2023
b7c4f47
fix cold start
thorek1 Nov 16, 2023
c7e7d8d
update AbstractDifferentiation
thorek1 Nov 16, 2023
b8ddb74
more efficient obc model solve
thorek1 Nov 17, 2023
4dd5c06
first attempt at documentation
thorek1 Nov 17, 2023
2d60df6
more docs and todos
thorek1 Nov 17, 2023
77a0ff7
make toml future proof
thorek1 Nov 17, 2023
36de677
resolve compat
thorek1 Nov 17, 2023
44b7ebd
fix aqua
thorek1 Nov 17, 2023
8878c2e
add QUEST3 model
thorek1 Nov 17, 2023
cf83fb3
add QUEST3 to docs
thorek1 Nov 17, 2023
785eec3
take out stricter tol for MadNLP (not solving)
thorek1 Nov 17, 2023
4f0e2bf
switch solvers for reliability
thorek1 Nov 17, 2023
11813bd
SW03 with elb
thorek1 Nov 17, 2023
cc20145
fix calib pars
thorek1 Nov 17, 2023
f0df2cf
parametrised obc shift/fcst horizon
thorek1 Nov 17, 2023
0d452a8
free individual shock values
thorek1 Nov 17, 2023
242c898
max_obc_shift becomes parameter
thorek1 Nov 17, 2023
32c2e85
rename obc shift to horizon
thorek1 Nov 17, 2023
1786775
more docs
thorek1 Nov 17, 2023
5f60a0b
docs and todos
thorek1 Nov 17, 2023
e7bc365
rename baxter and king
thorek1 Nov 17, 2023
a896ae0
rename GI2017
thorek1 Nov 17, 2023
5f0488a
include obc in docs
thorek1 Nov 17, 2023
8c601c2
added elb
thorek1 Nov 17, 2023
70bcea4
add gali2015 obc
thorek1 Nov 17, 2023
69e5a82
updat gali 2015 obc
thorek1 Nov 17, 2023
6596e42
fix cold start
thorek1 Nov 17, 2023
2bb6e20
update todo
thorek1 Nov 18, 2023
1372e57
fix refs bib
thorek1 Nov 18, 2023
85c990a
executable examples in how to guides
thorek1 Nov 18, 2023
aabd725
comment out so docs run
thorek1 Nov 18, 2023
ded8218
update docs
thorek1 Nov 18, 2023
576d54a
remove model files from test folder
thorek1 Nov 18, 2023
dcad711
add info to FS2000
thorek1 Nov 18, 2023
435921b
fix plot_solution for obc
thorek1 Nov 18, 2023
c716482
add obc tests and fix func tests
thorek1 Nov 18, 2023
32b8c39
add test for obc and fix model paths
thorek1 Nov 18, 2023
5d98051
add test for QUEST3, fix paths
thorek1 Nov 18, 2023
0647d8d
new optmizer params
thorek1 Nov 19, 2023
a2950aa
fix tests
thorek1 Nov 19, 2023
2e0459c
test obc
thorek1 Nov 19, 2023
77a28d2
leaner obc violation func, update current period
thorek1 Nov 19, 2023
fcd11aa
simplify shock matching
thorek1 Nov 19, 2023
a2ca276
update toml
thorek1 Nov 19, 2023
c6091ef
update todo
thorek1 Nov 19, 2023
afdc64e
rm obc shock bounds
thorek1 Nov 19, 2023
7e4a1e9
optional shift
thorek1 Nov 19, 2023
1da4928
update obc guide
thorek1 Nov 19, 2023
9b75a09
Delete src/figure_out_kron.jl
thorek1 Nov 19, 2023
423e6a7
Delete src/parse_obc.jl
thorek1 Nov 19, 2023
5546cfe
Delete src/test_me.jl
thorek1 Nov 19, 2023
b48389c
Delete test/GI2017.jl
thorek1 Nov 19, 2023
39b2bf0
Delete test/GI2017.mod
thorek1 Nov 19, 2023
71a726c
delete files
thorek1 Nov 19, 2023
7c017d6
fix precompile
thorek1 Nov 19, 2023
97992bf
amend JET compat
thorek1 Nov 19, 2023
8b71c78
no threadedsparsearrays
thorek1 Nov 19, 2023
9c97cbe
no info on different solver
thorek1 Nov 19, 2023
8fc25f4
update toml
thorek1 Nov 19, 2023
c539281
individual test sets
thorek1 Nov 19, 2023
6becb68
Jet not a dependency
thorek1 Nov 19, 2023
342a477
add test_estimation back in
thorek1 Nov 19, 2023
4ccfaed
different test sets
thorek1 Nov 19, 2023
1d7d6c0
print test set info
thorek1 Nov 19, 2023
2ff42e8
jet and aqua in basic test set
thorek1 Nov 19, 2023
9415cc8
fix path for estim FS2000 model
thorek1 Nov 19, 2023
4ce9804
test estimation and plots test set
thorek1 Nov 19, 2023
056cfc8
fix higher order
thorek1 Nov 19, 2023
f899c58
set windows env var
thorek1 Nov 19, 2023
cf9a1ae
also accept older NLopt
thorek1 Nov 19, 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
27 changes: 26 additions & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,15 @@ DynarePreprocessor_jll = "23afba7c-24e5-5ee2-bc2c-b42e07f0492a"
ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210"
ImplicitDifferentiation = "57b37032-215b-411a-8a7c-41a003a55207"
JSON = "682c06a0-de6a-54ab-a142-c8b1cf79cde6"
JuMP = "4076af6c-e467-56ae-b986-b466b2749572"
Krylov = "ba0b0d4f-ebba-5204-a429-3ac8c609bfb7"
LaTeXStrings = "b964fa9f-0449-5b57-a5c2-d3ea65f4040f"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
LinearOperators = "5c8ed15e-5a4c-59e4-a42b-c7e8811fb125"
MacroTools = "1914dd2f-81c6-5fcd-8719-6d5c9610ff09"
MadNLP = "2621e9c9-9eb4-46b1-8089-e8c72242dfb6"
MatrixEquations = "99c1a7ee-ab34-5fd5-8076-27c950a045f4"
NLopt = "76087f3c-5699-56af-9a33-bf431cd00edd"
PrecompileTools = "aea7be01-6a6a-4083-8856-8a6e6704d82a"
REPL = "3fa0cd96-eef1-5676-8a61-b3b8758bbffb"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
Expand All @@ -41,32 +44,54 @@ StatsPlots = "f3b207a7-027a-5e70-b257-86293d7955fd"
Turing = "fce5fe82-541a-59a6-adf8-730c64b5f9a0"

[compat]
AbstractDifferentiation = "^0.5"
AbstractDifferentiation = "^0.5, 0.6"
Aqua = "^0.8"
AxisKeys = "^0.2"
BlockTriangularForm = "^0.1"
CSV = "^0.10"
ChainRulesCore = "^1"
DataFrames = "^1"
DataStructures = "^0.18"
DocStringExtensions = "^0.8, 0.9"
DynamicPPL = "0.23, 0.24"
DynarePreprocessor_jll = "^6.2"
FiniteDifferences = "^0.12"
ForwardDiff = "^0.10"
ImplicitDifferentiation = "^0.5"
JET = "^0.8"
JSON = "^0.21"
JuMP = "^1"
Krylov = "^0.9"
LaTeXStrings = "^1"
LineSearches = "^7"
LinearAlgebra = "^1"
LinearOperators = "^2"
MCMCChains = "^6"
MacroTools = "^0.5"
MadNLP = "^0.7"
MatrixEquations = "^2"
NLopt = "^1"
Optim = "^1"
Plots = "^1"
PrecompileTools = "^1"
REPL = "^1"
Random = "^1"
RecursiveFactorization = "^0.2"
Reexport = "^1"
Requires = "^1"
RuntimeGeneratedFunctions = "^0.5"
SparseArrays = "^1"
SpecialFunctions = "^2"
SpeedMapping = "^0.3"
StatsPlots = "^0.15"
Subscripts = "^0.1"
SymPyPythonCall = "^0.2"
Symbolics = "^5"
Test = "^1"
ThreadedSparseArrays = "^0.2"
Turing = "^0.29"
Unicode = "^1"
Zygote = "^0.6"
julia = "1.8"

[extras]
Expand Down
10 changes: 7 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@

**Author: Thore Kockerols (@thorek1)**

`MacroModelling.jl` is a Julia package for developing and solving dynamic stochastic general equilibrium (DSGE) models. These kinds of models describe the behavior of a macroeconomy and are particularly suited for counterfactual analysis (economic policy evaluation) and exploring / quantifying specific mechanisms (academic research). Due to the complexity of these models, efficient numerical tools are required, as analytical solutions are often unavailable. `MacroModelling.jl` serves as a tool for handling the complexities involved, such as forward-looking expectations, nonlinearity, and high dimensionality.
`MacroModelling.jl` is a Julia package for developing and solving dynamic stochastic general equilibrium (DSGE) models.

These kinds of models describe the behavior of a macroeconomy and are particularly suited for counterfactual analysis (economic policy evaluation) and exploring / quantifying specific mechanisms (academic research). Due to the complexity of these models, efficient numerical tools are required, as analytical solutions are often unavailable. `MacroModelling.jl` serves as a tool for handling the complexities involved, such as forward-looking expectations, nonlinearity, and high dimensionality.

The goal of this package is to reduce coding time and speed up model development by providing functions for working with discrete-time DSGE models. The user-friendly syntax, automatic variable declaration, and effective steady state solver facilitate fast prototyping of models. Furthermore, the package allows the user to work with nonlinear model solutions (up to third order (pruned) perturbation) and estimate the model using gradient based samplers (e.g. NUTS, or HMC). Currently, `DifferentiableStateSpaceModels.jl` is the only other package providing functionality to estimate using gradient based samplers but the use is limited to models with an analytical solution of the non stochastic steady state (NSSS). Larger models tend to not have an analytical solution of the NSSS and `MacroModelling.jl` can also use gradient based sampler in this case. The target audience for the package includes central bankers, regulators, graduate students, and others working in academia with an interest in DSGE modelling.

Expand All @@ -20,6 +22,7 @@ As of now the package can:
- parse a model written with user friendly syntax (variables are followed by time indices `...[2], [1], [0], [-1], [-2]...`, or `[x]` for shocks)
- (tries to) solve the model only knowing the model equations and parameter values (no steady state file needed)
- calculate first, second, and third order (pruned) perturbation solutions using (forward or reverse-mode) automatic differentiation (AD)
- handle occasionally binding constraints
- calculate (generalised) impulse response functions, simulate the model, or do conditional forecasts
- calibrate parameters using (non stochastic) steady state relationships
- match model moments (also for pruned higher order solutions)
Expand Down Expand Up @@ -78,7 +81,7 @@ 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`
- [Baxter and King (1993)](https://www.jstor.org/stable/2117521) `Baxter_and_King_1993.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`
- [Gali and Monacelli (2005)](https://crei.cat/wp-content/uploads/users/pages/roes8739.pdf) - CPI inflation-based Taylor rule `Gali_Monacelli_2005_CITR.jl`
Expand All @@ -87,6 +90,7 @@ The package contains the following models in the `models` folder:
- [Ireland (2004)](http://irelandp.com/pubs/tshocksnk.pdf) `Ireland_2004.jl`
- [Jermann and Quadrini (2012)](https://www.aeaweb.org/articles?id=10.1257/aer.102.1.238) - RBC `JQ_2012_RBC.jl`
- [New Area-Wide Model (2008)](https://www.ecb.europa.eu/pub/pdf/scpwps/ecbwp944.pdf) - Euro Area - US `NAWM_EAUS_2008.jl`
- [QUEST3 (2008)](https://www.sciencedirect.com/science/article/abs/pii/S026499930800076X) `QUEST3_2009.jl`
- [Schmitt-Grohé and Uribe (2003)](https://www.sciencedirect.com/science/article/abs/pii/S0022199602000569) - debt premium `SGU_2003_debt_premium.jl`
- [Schorfheide (2000)](https://onlinelibrary.wiley.com/doi/abs/10.1002/jae.582) `FS2000.jl`
- [Smets and Wouters (2003)](https://onlinelibrary.wiley.com/doi/10.1162/154247603770383415) `SW03.jl`
Expand All @@ -103,7 +107,7 @@ The package contains the following models in the `models` folder:
**Perturbation solution order**|1, 2, 3|k|1|1, 2, 3|1, 2, 3|1, 2|1|1|1 to 5|1|1||1 to 5|
**Pruning**|yes|yes||||yes|||yes|||||
**Automatic derivation of first order conditions**|||||||||||yes||
**Handles occasionally binding constraints**||yes|yes|yes|yes||||yes|||yes||
**Handles occasionally binding constraints**|yes|yes|yes|yes|yes||||yes|||yes||
**Global solution**||||yes|yes|||||||yes||
**Estimation**|yes|yes|yes|||||yes|yes|yes|yes|||
**Balanced growth path**||yes|yes||||yes|yes|yes|yes|||||
Expand Down
Loading
Loading