-
Notifications
You must be signed in to change notification settings - Fork 21
Home
MichelJuillard edited this page May 12, 2022
·
14 revisions
This Wiki is for discussing design issues about DynareJulia
- A simple and intuitive modeling language used in many papers and projects (see Macroeconomic Model Data Base, model collections such as Johannes Pfeifer at (https://github.com/JohannesPfeifer/DSGE_mod) and many more)
- Help for replication
- A very efficient preprocessor (including symbolic derivation)
- Fast algorithms
- A unique environment for several connected tasks:
- Solution of the model
- Simulation
- Estimation (Bayesian, ML, methods of moments)
- Forecasting
- Optimal policy
- Occasionally binding constraints
- Markov-Switching VAR
- Simple time series operations
- Reporting results
- A lively community (forum, Summer school, Dynare conferences)
- Fast correction of bugs
- Has been adopted for teaching
- Too much concern about memory footprint
- selecting variables present with leads or lags,
- in perfect foresight algorithm: triangularizing the Jacobian matrix of the stacked system period by period, instead of using sparse matrix code (corrected since).
- partly due to hardware limitations in mid-1990
- Ignoring time series nature of data (partly corrected with dseries)
- Absence of block for calibrating parameters
- Absence of a documented API for the main numerical functions.
- Difficulties in handling contributions
- Estimation of models with zero lower bound
- Support for heterogeneous agents models
- Global solution
Discussion of some of the algorithms used for solving the model and estimating its parameters can be found here
- More than 20 years of development layers
- Two language problem: fast code must be written in C, C++ or Fortran
- Matlab doesn't have an ecosystem or a community of open source developers
- Matlab price tag is a deterrent for many users and Octave is too slow
- meant for scientific computing
- JIT compiling
- solves the two language problem
- user defined types, no classes, multiple dispatch
- rich collection of existing packages
- lively community
- efficient package management
- powerful metaprogramming
- Different packages for numerical algorithms and for interpretation of Dynare modeling language
- Re-using Dynare C++ preprocessor with special output for Julia
- Insist on modularity
- Homogeneous coding style
- Leveraging existing Julia packages (NLsolve, Plots, PrettyTables)
- Dynare.jl
- ExtendedDates.jl
- FastLapackInterface.jl
- GeneralizedSylvesterSolver.jl
- KalmanFilterTools.jl
- KroneckerTools.jl
- LinearRationalExpectations.jl
- PolynomialMatrixEquations.jl
- QuasiUpperTriangular.jl
- TimeDataFrame.jl
- Deals with Dynare instructions
- The preprocessor is the same executable as for Dynare Matlab/Octave
- The state of computations is kept in
context
as structure ofContext
type
struct Context
symboltable::SymbolTable
models::Vector{Model}
modelfileinfo::ModFileInfo
results::Results
work::Work
end
- Instructions are extracted from
./<MODFILENAME>/model/json/modfile.json
that is written by the C++ preprocessor
- Solves model of the form
latex E_t \{ A y_{t+1} + B y_t + C y_{t-1} + D u_t + e\} = 0
- The deterministic steady state of the model is defined as
latex \bar y = -(I - A - B - C)^{-1}e
- The solution takes the form
latex y_t - \bar y= G_y (y_{t-1} - \bar y) + G_u u_t
-
G_y
is the solution of the polynomial matrix equationlatex A G_y G_y + B G_y + C = 0
andlatex G_u = -(A G_y + B)^{-1}Du_t
Two different algorithms are provided:
- generalized Schur decomposition (\cite{klein_using_2000, sims_solving_2002, soderlind_solution_1999}(
- cyclic reduction (\cite{bini_numerical_2012})
- the package provides functions to reduce the problem size by eliminating static variables.
- Multiplication and linear system solution for upper quasi triangular matrices
- Useful for handling real generalized Schur decomposition
- Kalman filter
- Monitored Kalman filter
- Fast Kalman filter (\cite{herbst_using_2012})
- Kalman smoother
- Diffuse filter/smoother (\cite{durbin_time_2012})
- Univariate filter/smoother
- A data frame where the first column represents dates
- Extension of dates in Julia to Year, Semester, Quarter, Month, Week, Day and Undated
- Each frequency is represented by an integer starting at some epoch (January 1st of year 1970)
- See also TimeDataFrames
- Pre-allocate workspace for some Lapack function
- LU decomposition and solution of linear systems
- QR decomposition
- Schur decomposition
- Chains of Kronecker products
\begin{align*}
c &= (Ip \otimes A \otimes Iq)*b\\
c &= (Ip \otimes AT \otimes Iq)*b\\
c &= (A \otimes A \otimes ... \otimes A)*b\\
d &= (AT \otimes AT \otimes ... \otimes AT \otimes B)*c\\
C &= A * (B \otimes B \otimes .... \otimes B)\\
D &= A * B * (C \otimes C \otimes .... \otimes C)\\
D &= AT * B * (C \otimes C \otimes .... \otimes C)\\
E &= AB(C \otimes D \otimes ... \otimes D)
\end{align*}
- Implements algorithms in \cite{kamenik_solving_2005}
### GeneralizedSylvesterSolver.jl
solves
```latex
a x + b x (c \otimes c \otimes ... \otimes c) = d
by using
(I + c^T \otimes c^T \otimes ... \otimes c^T \otimes b)x = d
calib_smoother
check
deterministic_trends
histval
initval
-
perfect_foresight_setup
(only some options) -
perfect_foresight_solver
(only some options) planner_objective
ramsey_model
shocks
steady
-
stoch_simul
(only order=1, no moments)
- Estimation of linear(-ized) models
- Address \emph{time to first result} problem
- Mixed complementarity problems
- Forecasting
- Making existing packages production grade (tests, documentation, benchmarking)
- Dynare-Julia documentation
-
$k$ -order approximation - Multiple models
- Linear models with occasionally binding constraints
- Nonlinear estimation - particle filters
- Nonlinear estimation - simulated methods of moments
- Markov-Switching DSGE models
- Global sensitivity analysis
- Global methods of approximation
- Limited rationality