Skip to content

Parameterize the steady-state initial guesses for b and n - #1227

Merged
jdebacker merged 1 commit into
PSLmodels:masterfrom
arihantlodha-cmd:parameterize-ss-guesses
Sep 26, 2026
Merged

jdebacker merged 1 commit into
PSLmodels:masterfrom
arihantlodha-cmd:parameterize-ss-guesses

Conversation

@arihantlodha-cmd

Copy link
Copy Markdown
Contributor

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 when use_zeta is 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: 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), each defaulting to the previous hardcoded value.
  • 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.

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 both use_zeta settings): the guesses come from the parameters and change when a parameter is changed. The existing test_initial_guesses still passes, along with tests/test_parameters.py (16 passed). ruff check and ruff format --check are clean.

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-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 75.19%. Comparing base (9baa4b2) to head (01722e2).

Additional details and impacted files

Impacted file tree graph

@@            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              
Flag Coverage Δ
unittests 75.19% <100.00%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
ogcore/SS.py 79.23% <100.00%> (+0.17%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@jdebacker
jdebacker merged commit 985c24a into PSLmodels:master Sep 26, 2026
7 checks passed
@jdebacker

Copy link
Copy Markdown
Member

@arihantlodha-cmd Thanks for addressing this outstanding issue.

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.

Adding flexibility to the initial guesses of b_sp1 and n

3 participants