Skip to content

Improve stability estimator for unit-root histories - #36

Merged
sergioald merged 1 commit into
mainfrom
improve-unit-root-stability-estimator
Jul 22, 2026
Merged

sergioald merged 1 commit into
mainfrom
improve-unit-root-stability-estimator

Conversation

@sergioald

Copy link
Copy Markdown
Owner

Summary

Improves the optional equivalence-style sinuosity stability estimator so it remains honest on integrated, unit-root-like histories.

Changed

  • ldsfl/stability.py

    • adds a method option to sinuosity_equivalence_stability(...);
    • makes method="increment" the default;
    • keeps the previous least-squares plus Newey-West path available as method="hac";
    • records the selected method in the returned diagnostic dictionary.
  • tests/test_stability_estimator_method.py

    • verifies that the default method is now increment;
    • verifies that unknown methods are rejected;
    • checks exact linear-ramp recovery;
    • checks that the increment interval is wider than the HAC interval on a random-walk history;
    • checks that the HAC method remains available for comparison;
    • checks that no-drift and real-drift random-walk histories are classified in the expected direction.

Why

The previous diagnostic estimated drift with a least-squares slope and Newey-West/HAC uncertainty. That is reasonable for short-memory residuals, but the sinuosity histories we care about can behave like a slow trend plus an integrated random-walk component.

HAC standard errors are inconsistent under a unit root, so the resulting interval can be much too narrow and can overstate stability. The new default estimates drift from per-step increments. Differencing removes the unit-root component, making the uncertainty estimate more appropriate for these histories.

The previous HAC implementation remains available via method="hac" so existing comparisons and sensitivity checks can still be run explicitly.

Validation

python -m py_compile ldsfl/stability.py tests/test_stability_estimator_method.py
python -m pytest tests/test_stability_estimator_method.py
python -m pytest
python -m run_ldsfl --base-dir . --cases 1 --max-steps 100 --no-plots

Notes

This PR changes the optional equivalence-style stability diagnostic behaviour.

It does not change the morphodynamic update algorithm, flow solvers, curvature calculation, CLI interface, GUI interface, output naming, fixture structure, or generated output format.

Because this is a diagnostic-method change, it is intentionally separate from the HAC vectorization, transfer-function validation, periodic-vs-free validation, and reproducibility-fixture PRs.

@sergioald
sergioald merged commit 45dbad5 into main Jul 22, 2026
3 checks passed
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