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

Iterated expectations in RiskyContrib #1058

Merged
merged 10 commits into from
Oct 14, 2021

Conversation

Mv77
Copy link
Contributor

@Mv77 Mv77 commented Aug 10, 2021

There is a speed-up trick that can be used in portfolio problems when income is independent of the risky return. This is already incorporated in ConsPortfolio, but I had not applied it to RiskyContrib.

The trick is to use iterated expectations when computing the expectation of value (and derivatives) next period. The idea is to create a function that interpolates E[f(income, R)|R] and then integrate it over R, instead of jointly integrating over income and R. Turns out that---in this model---this change makes the solution 3x-5x faster.

This PR introduces this trick into RiskyContrib's solver. I left the general solver for cases where income and returns are correlated as an option.

  • Tests for new functionality/models or Tests to reproduce the bug-fix in code.
  • Updated documentation of features that add new functionality.
  • Update CHANGELOG.md with major/minor changes.

@Mv77
Copy link
Contributor Author

Mv77 commented Aug 10, 2021

Since the REMARK has now been published, I took the opportunity to edit the file header and link to it.

@Mv77
Copy link
Contributor Author

Mv77 commented Aug 10, 2021

Massive thanks to @alanlujan91, as I decided to implement this trick after reviewing his code for the housing project.

@codecov-commenter
Copy link

codecov-commenter commented Aug 18, 2021

Codecov Report

Merging #1058 (fd6e6b2) into master (7592b71) will increase coverage by 0.13%.
The diff coverage is 97.18%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1058      +/-   ##
==========================================
+ Coverage   71.71%   71.85%   +0.13%     
==========================================
  Files          66       66              
  Lines        9989    10042      +53     
==========================================
+ Hits         7164     7216      +52     
- Misses       2825     2826       +1     
Impacted Files Coverage Δ
HARK/ConsumptionSaving/ConsRiskyContribModel.py 79.42% <96.72%> (+1.64%) ⬆️
...sumptionSaving/tests/test_ConsRiskyContribModel.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7592b71...fd6e6b2. Read the comment docs.

@sbenthall
Copy link
Contributor

@mnwhite are you able to review this?

@llorracc llorracc merged commit d59269d into econ-ark:master Oct 14, 2021
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

Successfully merging this pull request may close these issues.

4 participants