Parameterize the steady-state initial guesses for b and n - #1227
Merged
jdebacker merged 1 commit intoSep 26, 2026
Merged
Conversation
Closes PSLmodels#1007. The initial guesses for the household savings and labor-supply distributions in the steady-state solve were hardcoded in SS_initial_guesses (0.0055 and 0.4 when use_zeta is True, 0.07 and 0.35 otherwise, the latter with an explicit TODO to remove the hardcode). This moves all four values into the model parameters so users can supply guesses better suited to their calibration. - default_parameters.json: add initial_guess_b_SS / initial_guess_n_SS (used when use_zeta is True) and initial_guess_b_SS_no_zeta / initial_guess_n_SS_no_zeta (used otherwise), defaulting to the previous hardcoded values. - SS.py: SS_initial_guesses reads the guesses from the parameters. The b_val / n_val arguments are kept (now defaulting to None) so an explicit override still works; when None, the value comes from the parameters. Defaults reproduce the previous guesses exactly, so a baseline SS still solves to r = 0.0628. Adds a test that the guesses come from the parameters and change when a parameter is changed, for both use_zeta settings.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1227 +/- ##
==========================================
+ Coverage 75.17% 75.19% +0.01%
==========================================
Files 24 24
Lines 6031 6035 +4
==========================================
+ Hits 4534 4538 +4
Misses 1497 1497
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
jdebacker
approved these changes
Sep 26, 2026
Member
|
@arihantlodha-cmd Thanks for addressing this outstanding issue. |
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.
What this does
Closes #1007. The initial guesses for the household savings and labor-supply distributions in the steady-state solve were hardcoded in
SS_initial_guesses(0.0055 and 0.4 whenuse_zetais True, 0.07 and 0.35 otherwise, the latter with an explicit# TODO: remove hardcode). This moves all four values into the model parameters so users can supply guesses better suited to their calibration.Changes
default_parameters.json: addinitial_guess_b_SS/initial_guess_n_SS(used whenuse_zetais True) andinitial_guess_b_SS_no_zeta/initial_guess_n_SS_no_zeta(used otherwise), each defaulting to the previous hardcoded value.SS.py:SS_initial_guessesreads the guesses from the parameters. Theb_val/n_valarguments are kept (now defaulting toNone) so an explicit override still works; whenNone, the value comes from the parameters.Behavior and compatibility
Defaults reproduce the previous guesses exactly, so default behavior is unchanged: a baseline SS still solves to r = 0.0628.
Testing
Adds
test_initial_guesses_from_params(for bothuse_zetasettings): the guesses come from the parameters and change when a parameter is changed. The existingtest_initial_guessesstill passes, along withtests/test_parameters.py(16 passed).ruff checkandruff format --checkare clean.