Sunday, February 17, 2013

Dynamic programming with credit constraints

I am looking for simple examples of economic models with occasionally binding credit constraints.  I would like to find the most straightforward example possible, and then bludgeon it into submission with my various numerical algorithms...suggestions are much appreciated!

Wednesday, February 13, 2013

Solving a deterministic RBC model

Taking a short break from marking undergraduate economic essays and decided to write a bit of Python code to solve a deterministic RBC model using value function iteration.  Code to replicate the result can be found here.  Below are plots of the optimal policy functions (I included some of the iterates of the policy functions as well).

Again the code is mind-numbingly slow (possibly due to the interpolation scheme I am currently using) and takes roughly 8-10 minutes to finish. Any suggestions for speeding up the code (perhaps by using fancy indexing to avoid the for loop!) would greatly appreciated!

Assaulting the Ramsey model (numerically!)

Everything (and then some!) that you would ever want to know about using dynamic programming techniques to solve deterministic and stochastic versions of the Ramsey optimal growth model can be found in this paper.

I wrote up a quick implementation of the most basic version of the value function iteration described in the paper (vanilla value iteration with a good initial guess and cubic spline interpolation).  Below is a graphic I produced of the optimal value and policy functions as well as every 50th iterate (to give a sense of the convergence properties).

The Python code is slowish (takes several minutes to compute the above functions).  Suggestions on ways to speed up the code are definitely welcome!

Back to the grind of marking essays...enjoy!