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

[Question] A problem with stages #826

Closed
Mv77 opened this issue Aug 28, 2020 · 6 comments
Closed

[Question] A problem with stages #826

Mv77 opened this issue Aug 28, 2020 · 6 comments

Comments

@Mv77
Copy link
Contributor

Mv77 commented Aug 28, 2020

Hi,

I have been working on a new risky asset model with a pension contribution scheme, and have a question about how to implement the agent type's simulation method in the most compatible way with the current tools.

The only relevant characteristic of the model is that, at each time-period, the agent's problem can be broken down into three sequential sub-stages:

  1. Defining the income-deduction scheme going forwards.
  2. Moving assets between the risky (iliquid) and risk-free (liquid) account.
  3. Consuming out of liquid assets.

I have a working solver and am thinking of how to implement the simulate method. Looking at the simOnePeriod(self): from AgentType, it works by calling getStates -> getControls -> getPostStates once. With my setup, it would be useful if I could split the time-period into the three sub-stages and run this sequence three times, with a stage's postStates becoming the next stage's states.

@llorracc suggested this could be achieved with the cycles property, and mentioned the Ski instructor example. Yet, I'm not quite sure how this would be achieved: the Ski instructor makes the same decisions at every stage and just cycles through different parameter values.

So I wanted to ask if this stage-splitting is possible with the current tools, if there is an example you could point me to, or if it'd be better to create the class' own simOnePeriod method with these characteristics.

@Mv77
Copy link
Contributor Author

Mv77 commented Sep 2, 2020

Hi again,

I was revisiting this question with @llorracc today, and he told me I should tag @mnwhite and @sbenthall for the discussion.

We are sure that the Ski instructor example could be adapted in some way to address this period-with-stages kind of problems. One could:
a) Treat every sub-period as a period, so that a Ski instructor that lives for 30 years would have a T_cycle of 30*4. One could then find a way to call a different solve/simulate-onePeriod method at different times (is this already possible?).
b) Write one's own simOnePeriod function which would call sub-functions for every sub-stage.

@llorracc recalled discussions of this kind of features being already built into HARK and just not being documented yet.

So we are still trying to figure out what would be the most backward and forward-compatible way of implementing these types of agents, and were wondering if you could provide some guidance?

@mnwhite
Copy link
Contributor

mnwhite commented Sep 3, 2020 via email

@Mv77
Copy link
Contributor Author

Mv77 commented Sep 7, 2020

Thank you! That makes a lot of sense. I did not know one could have time-varying solveOnePeriod methods.

I'll have a go at adapting my solution to this framework and code up simulation methods soon. I'll post progress/questions here.

@Mv77
Copy link
Contributor Author

Mv77 commented Sep 21, 2020

I've followed @mnwhite 's advice and implemented a time-varying solveOnePeriod version where each sub-stage is treated as a period. It works great! (thank you)

I'm now moving on to the simulation methods. As suggested, since each sub-stage is being treated as a period, I'll code up my own simOnePeriod which will call stage-specific methods. I will keep you posted.

@llorracc
Copy link
Collaborator

llorracc commented Sep 21, 2020 via email

@Mv77
Copy link
Contributor Author

Mv77 commented Sep 24, 2020

#832 now has an explicitly stage-oriented solution and simulation strategy that seems to work and follows @mnwhite 's advice.

I will focus on cleaning up the code and producing a well-calibrated life-cycle example in the following days.

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