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!  

1 comment:

  1. Try Numba, from Anaconda? I'm just starting to use it for my own research. Looks very promising. [http://numba.pydata.org/ and https://store.continuum.io/cshop/anaconda/]

    ReplyDelete