I love discourse because you get to learn from experts across fields. This is really nice!.
At the same time, I would like to learn from people with closely aligned work as mine. Thus, I was wondering whether some economists here who solve for value functions, policy functions, and undertake full solution structural model estimation in Julia could post links to their code. Ideally complete code for an article for instance, or that simply illustrates a single complete concept.
Thanks. This could also serve as a beginners guide for others too.
PS: I have googled around for this code, some of this is on my Github page. But it just seems to take forever to find this code. I have so have found only three/four academic articles.
Don’t mind at all, but not entirely sure how useful it would me. My papers are all a little weird! Since “dynamic programming” and “structural estimation” are so brought, I think you need to narrow it down a bit. There are a buzzilion methods and models, with different approaches depending on what field you are working on, whether it is continuous or discrete time, etc.
Thanks everybody. @jlperla, I tend to read anything really to see what I can learn and incorporate into my own stuff. Now I am looking to introduce financial intermediation, financial frictions, and innnovation into my macro-climate models, and also structurally estimate models of electricity generation and wholesale power market clearing.
Other stuff I have found around the web that others may also find useful:
Having a complete codebase for an article or working paper is useful for replication, but may not be ideal for learning. By the time of publication, code for structural empirical work usually contains a lot of accretion (changes to the model, semi-random requests by referees that enrich your appendix in the end, etc) that happened under time pressure and no one had the time or inclination for a clean refactoring (as usual, respect to those who do it anyway).
I usually find solving functional equations (HJB/Euler) the easiest part, and also the least computationally intensive. I use my own library, which is undergoing a refactoring right now (check back in a month or so, I am integrating Smolyak code that I used in a paper):
It is
solving for general equilibrium objects, and
dealing with distributions of heterogeneous agents
that I find tricky. (1) usually requires a good initial guess, homotopy methods, and gradual refinement of crude solutions. I find
useful for homotopy. Keeping the solution for policy functions automatically differentiable from the beginning (and unit testing for this) is very useful.
Dealing with distributions as states usually involves some ad hoc method that I construct based on the properties of the problem (ie I want a good approximation where the mass is). I usually try to get away with a rectangular grid, but when I can’t, I found
useful.
Generally, if you can keep your code automatically differentiable all the way up to a distance metric between simulated and actual data or a log posterior, it is a big win. But for complex models it requires some practice and refactoring.
I know of (but never used) Dolo.jl by @albop (http://www.mosphere.fr/, albop (Pablo Winant) · GitHub) which implements value iteration for economics. I once took his multilinear interpolation routine for my own dynamic programming Python package (because dolo was at first a Python package).
@pkofod. I am certain the code would be very helpful. For instance when modelling powerplant operations in my case. The code could also be helpful in other ways and to other people. So you if you have time please clean it up and post.