Dynare for Julia

Thanks to the great help by QuantEcon, my main programming language for (macro)economic analysis has almost moved from Matlab to Julia.

However, when it comes to business cycle analysis with a DSGE model, I still heavily use Dynare with Matlab as before.

It’s very annoying for me to use two languages in a single paper. Is there any Julia package that substitutes Dynare? (Dynare.jl does not seem to work in any version of Julia.)

Precisely, what I want is tools for non-linear deterministic (perfect foresight) simulations and stochastic simulations with approximate solutions.

(Hopefully, it’s nice to run in v.0.5.2.)

Dolo.jl is able to do what you have in mind. I don’t think the documentation is ready yet (I think this is coming soon though), but @spencer.lyon has a few examples in different places on github.


Thank you @cc7768, I’ll try Dolo.jl.

For perfect foresight simulation, I could find this test as an example.

Hey @Shunsuke-Hori good question. @cc7768 good answer.

I do have a notebook (here) where I replicate the experiments in chapter 11 of Ljungqvist and Sargent using the python version of dolo. Note that these experiments are perfect foresight experiments

Things aren’t exactly the same in the Julia version of Dolo, but the necessary functionality to solve the model and do the perfect foresight experiment should be there.

If you have questions or get stuck please ask questions either here or on the Dolo.jl issue list.

cc @pablo.winant

@Shunsuke-Hori: I second @cc7768 and @spencer.lyon’s comment. Don’t hesitate to ask for any help.

The pf code is fairly new (and under dev.) on the Julia side. I’ll open an issue to replicate the RMT11 chapter.
You can also use Dolo.jl, to do perturbation analysis, so it might cover the other usecase you describe (stochastic sims).

Even though Dynare.jl is not maintained actively, I’m a bit surprised it doesn’t work at all. It is actually tested with 0.5. This should also cover your needs. I know first hand there are other plans from the Dynare team to produce a more complete Julia version, but it is not ready for consumption yet.


Thank you @spencer.lyon and @pablo.winant!! The python notebook is really helpful and I’m looking forward to a Julia version notebook.

Regarding Dynare.jl, I took a closer look and found that the bug is fixed in its master branch but the fixed version is not registered in the METADATA. By moving to the master branch, everything works well. Thank you again @pablo.winant.

Let me ask one more. Can we set arbitrary initial state values in Dolo.jl? So far, it seems that the perfect foresight simulations in Dolo.jl (and Dynare.jl) must start from a steady state under initial exogenous variables. It is one common case but other starting values would be useful.

@shunsuke-hori : it should be very easy to add the option to supply a
non-equilibrium initial state when doing perfect-foresight simulations, so
consider it as done (modulo a few days).
Here is the issue: https://github.com/EconForge/Dolo.jl/issues/83

@pablo.winant For now, I am satisfied with the existing functionalities. I do not mean to hurry you.

Anyway, thank you for the (upcoming) features!! I am sure that many people feel happy about Dolo as an alternative to Dynare!!

1 Like

@pablo.winant @spencer.lyon I am teaching masters students a monetary class in Julia, and wanted to check in on your thoughts of the stability and documentation of Dolo.jl at this point.

Is this ready for prime-time for relatively straightforward linearized DSGE models (no occasionally binding constraints or anything crazy)? Is the documentation and error messages clean enough for people who may be programming newbies?

Alternatively, has anyone been able to construct a workflow for running Dynare itself without matlab? Maybe Dynare++ output loaded into Julia using the https://github.com/JuliaIO/MAT.jl to load the output?

Hi @jlperla,

Thanks for your interest on Dolo! Honnestly, user interface is still a bit rough around the edges, especially when it comes to provide errors for misspecified models (doc and julia api are rather stable and up-to-date). So I wouldn’t advice to use it with a big class of non-technical students. But if you or some of them feel adventurous please get in touch, we’ll be happy to help.

There isn’t a workflow yet to run the matlab version of dynare from Julia. If you are in control of the infrastructure you could use MATLAB.jl to create a trivial wrapper around the main dynare command, and load output from files to make plots. Such a piece of software could actually be quite useful.

There is also a prototype I wrote last year Dyno.jl, which can load any modfile, using Dynare preprocessor, and compute a basic, first order solution from Julia, that you can then examine and plot. This option doesn’t require Matlab and if you want to give it a try I’m happy to give a hand, update the installation process and/or iron out some bugs.

When is your course happening ?



Thanks so much. The class is going on right now (and I wanted to get them playing around with Dynare-style models next week). I would love to avoid Matlab to prove my point that it isn’t necessary.

It is a joint PhD/MA class, so I will have the PhD students (and keen masters students) use Dolo.jl (and post issues/discussions as required).

For the masters students, a few more questions:

  • Is Dolo.jl working on v0.6? It looks like the Travis build works, but that is only meaningful if you think you have good coverage. Should I expect it to work on juliabox.com?
    • Do you have an example of using Dolo.jl that does typical Dynare style graphs and output from the results? If so, I would love to provide this to my students as a starting point. They could modify the .yaml and not mess around too much with the underlying output.
  • So my hope of Dynare++ spitting out a matlab output files (which are then read in Julia) isn’t really possible? Is Dynare++ not maintained, and out of date?
  • I tried out Dyno.jl and had some issues running the example (on Julia v0.6.2). Might try more later. Would you expect it to work on JuliaBox.com with v0.6.2?


To answer your questions:

  • Dolo builds on 0.6 (and does not with 0.5 anymore). I know it works with the old version of JuliaBox but haven’t tried with the new one.
  • Same is true for Dyno. I updated it to work with recent version of Dynare and it can now be installed on JuliaBox, old version.
    • I couldn’t make it work with the new version and would be curious to know how to make it work.
  • Doing IRFS with dolo should be as easy as: response(model, dr, :e) but you are absolutely right that there should be an example somewhere. I’ll add it very soon. For simulations, there is an example notebook here: https://github.com/EconForge/dolo_models/blob/master/RBCS/Dolo_Process_RBC_AR1.ipynb

I will try to make the other needed adjustment by Friday so, hopefully you will be able to use it next week.