Skip to content

Keep lognormal fixture income in levels - #642

Closed
hmgaudecker wants to merge 2 commits into
mainfrom
fix/lognormal-fixture-income-levels
Closed

hmgaudecker wants to merge 2 commits into
mainfrom
fix/lognormal-fixture-income-levels

Conversation

@hmgaudecker

Copy link
Copy Markdown
Member

Summary

The lognormal process draws income in levels while every other process in the test fixture draws log income, but the shared wealth transition exponentiated the state for all of them. The lognormal variant therefore added exp(exp(z)) to wealth, reaching seven orders of magnitude past its wealth grid of 1 to 5. Its value test could only be bounded loosely against an analytic recurrence with a relative tolerance of 1e-4.

The fixture now selects a level transition and constraint for the lognormal process. The lognormal variant is then the normal variant with the exponential moved into the process: same value function, same panel with income exponentiated.

  • tests/test_models/processes.py: get_wealth_functions and get_initial_income pick the level variants for lognormal; both the single-regime and the multi-regime fixture use them. A DistributionType alias replaces the repeated Literal, which also lets the cross-regime test drop its ty suppressions.
  • tests/test_lognormal_fixture_parity.py: pins value equality with the normal fixture at rtol 1e-12 and panel equality with income exponentiated.
  • tests/test_processes.py: the analytic recurrence, its 1e-4 bound and the dedicated tail test are gone; the regression test compares lognormal values to solution_normal.pkl.
  • tests/data/processes/random-v1/: panels regenerated at float64 on CPU. Only the lognormal panel changes in content; the other four are byte-different serializations of identical frames and are regenerated together so the provenance record describes every file in the directory.

Verification

tests/test_processes.py and the parity test in the branch's locked tests-cpu environment, --precision=64, CPU: 768 passed, 0 failed. prek run --all-files passes.

https://claude.ai/code/session_01LAZ63AjbZFLweWuJyPUs6S

hmgaudecker and others added 2 commits November 5, 2026 09:13
The lognormal process draws income in levels while every other process
draws log income, but the shared wealth transition exponentiated the
state for all of them. The lognormal variant therefore added exp(exp(z))
to wealth, reaching seven orders of magnitude past its wealth grid, and
its value test could only be bounded loosely against an analytic
recurrence. The fixture now selects a level transition and constraint
for the lognormal process, so it is the normal fixture with the
exponential moved into the process: same value function, same panel
with income exponentiated. A parity test pins that, and the regression
test compares the lognormal values to the normal solution pickle.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LAZ63AjbZFLweWuJyPUs6S
Only the lognormal panel changes in content; the other four are
byte-different serializations of identical frames, regenerated together
so the provenance record describes every file in the directory.
Generated at float64 on CPU with jax 0.12.0.1.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LAZ63AjbZFLweWuJyPUs6S
@read-the-docs-community

Copy link
Copy Markdown

Documentation build overview

📚 pylcm | 🛠️ Build #35665241 | 📁 Comparing 17bb4dc against latest (0fb5567)

  🔍 Preview build  

4 files changed
± beta-delta/index.html
± epstein-zin/index.html
± iskhakov-et-al-2017/index.html
± tiny-example/index.html

@hmgaudecker

Copy link
Copy Markdown
Member Author

Superseded: cherry-picked onto #636 (6bb9f21, df375f5), which is where the fixture's extrapolation turned red. Main receives it through the stack.

@hmgaudecker hmgaudecker closed this Nov 5, 2026
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.

1 participant