Aggvars in ptype parameters#70
Open
MichaelTiemann wants to merge 78 commits intovfitoolkit:masterfrom
Open
Conversation
This function does VFI with grid interplayer for the case of no d variable using sparse matrix in Howard improvement. Also other changes, see forum.
…-postGI Added function ValueFnIter_postGI_sparse_nod_raw
The principle change is to bring across the gridvals changes implemented in commit 347366c. After implementing those changes in `ValueFnIter_FHorz_RiskyAsset_nod1_semiz_raw` and `ValueFnIter_FHorz_RiskyAsset_EpsteinZin_nod1_semiz_raw`, a few incongruities emerged from `StationaryDist_FHorz_RiskyAssetSemiExo` regarding the contents of `refine_d` and/or `l_dsemiz`. Please check that the new test I've put in is sensible. Finally, after running this lifecycle test, it reveals the Out-Of-Memory (OOM) errors mentioned in the comments. Reverting to the commented-out code (which is less aggressive in the use of gpuArray) keeps things within the limits of a 32GB GPU.
I have added ValueFnIter_postGI_sparse_raw to do Howards sparse for the case of d variable. Moreover, I have improved the existing function ValueFnIter_Refine_postGI_raw using Claude code. The trick was to replace interp1 with matrix multiplication: gives 25% speed-up, quite consistent across versions and computers
…-postGI Added two new functions
This is my best guess at extending the pattern to support 3 other assets and an experience asset. I have used this code to successfully run a modified OLG14 with an experience asset that produces results I expected. If this is correct, it should be adapted to the other ExpAsset cases.
Support the noz case as well.
…-n_a-eq-4 Support ExpAsset with length(n_a)==4
Fix a few typos and spell ordinals (1st, 2nd, 3rd, 4th) with proper suffixes.
Howards-greedy does not work with non-finite return values. Rather than testing whether we get any such and warning, we move the test inside the loop so that errors can be flagged closer to their initial appearance. This makes understanding and fixing such errors easier when debugging.
…tection_for_nonfinite_retvals Relocate error message concerning non-finite return values
…s_PType_improvements Ignored PTypes now listed with proper ordinal suffixes
When evaluating agents in PType structures (such as firms and households), it happens that we can inject just-calculated AggVars into the Parameter lists of to-be evaluated PType structures, increasing the power and generality of using PTypes. Also update `HeteroAgentStationaryEqm_Case1_PType_subfn` to handle CustomModelStats.
When evaluating agents in PType structures (such as firms and households), it happens that we can inject just-calculated AggVars into the Parameter lists of to-be evaluated PType structures, increasing the power and generality of using PTypes. Also update `HeteroAgentStationaryEqm_Case1_PType_subfn` to handle CustomModelStats.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The change makes AggVars visible to downstream PType structures as they are revealed from upstream computations. A clever user can order their PTypes so that AggVars flow downstream to be used as parameters by later PTypes. This does require pre-loading AggVar parameters used in this way (not much different than pre-loading GE price guesses).
While we're at it, complete the functionality for CustomModelStats, which I was working on at the same time.