Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

solve_hjb() and solve_kfe() #110

Closed
azev77 opened this issue Nov 11, 2020 · 3 comments
Closed

solve_hjb() and solve_kfe() #110

azev77 opened this issue Nov 11, 2020 · 3 comments

Comments

@azev77
Copy link

azev77 commented Nov 11, 2020

Hi and thank you for this package.

Is it possible to provide simple examples of how to use solve_hjb() and solve_kfe()>

The code is similar to Ben Moll's, so perhaps minimal examples like:
Lifecycle (note)
Huggett_diffusion
Huggett_diffusion_pe
Aiyagai_diffusion (Julia version)
Aiyagari_diffusion_transition
RBC_diffusion

@chenwilliam77
Copy link
Collaborator

Hi azev77,

We haven't worked on continuous-time methods in a while, and we are currently busy with other projects. As a result, it is unlikely in the near term that we can provide as many examples as Ben Moll has.

However, we do have a continuous-time implementation of Krusell Smith that uses solve_hjb and solve_kfe. Note though that these two functions are not "exhaustive" approaches for solving the HJB and KFE, and depending on the nature of the problem at hand, you may need to use a different numerical approach.

@azev77
Copy link
Author

azev77 commented Nov 11, 2020

@chenwilliam77, thanks for your response.

  1. The continuous-time Krusell Smith example in tests gives an error.
    test/models/heterogeneous/krusell_smith_ct/krusell_smith_ct.jl
julia> m = KrusellSmithCT()
ERROR: UndefVarError: SteadyStateParameterArray not defined
  1. Ofcourse I don't expect as many examples as Moll's website.
    I mean one very simple, working example such lifecycle...

@chenwilliam77
Copy link
Collaborator

This is our bad; we forgot to update the name of a type from one of our other packages ModelConstructors.jl. If you switch every instance of SteadyStateParameterArray to SteadyStateParameterGrid in src/models/heterogeneous/krusell_smith_ct/krusell_smith_ct.jl (there should only be a few), then the model should be instantiate correctly. I've made this fix on a dev branch, but there are other extant changes that have been made to that branch which cannot be merged just yet into the main package, so I can't just make a new release with this bug fix at the moment.

FYI, the test script appears to use other deprecated functions from ModelConstructors.jl, so you should test the model works by simply calling in REPL

using DSGE
m = KrusellSmithCT()

During instantiation, the steady state should be solved.

If you also want to linearize, then you'll need to add using ForwardDiff, BasisMatrices to the src/DSGE.jl script. Unfortunately, it looks like the developers on DSGE.jl who implemented KrusellSmithCT didn't fully implement the linearization code and thus forgot to add these two dependencies. Running

T, R, C = solve(m)

will deliver the linearization, where

ds_t = (T * s_t) * dt + R * dW_t + C

Let me know if this works, and I can close the issue if it does.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants