-
-
Notifications
You must be signed in to change notification settings - Fork 199
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
Conversation
Since the REMARK has now been published, I took the opportunity to edit the file header and link to it. |
Massive thanks to @alanlujan91, as I decided to implement this trick after reviewing his code for the housing project. |
Codecov Report
@@ 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
Continue to review full report at Codecov.
|
@mnwhite are you able to review this? |
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 toRiskyContrib
.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 overR
, instead of jointly integrating overincome
andR
. 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.