Skip to content

Add the "powerLaw" spread link - #167

Merged
eliotmcintire merged 2 commits into
developmentfrom
powerlaw-link
Oct 19, 2026
Merged

eliotmcintire merged 2 commits into
developmentfrom
powerlaw-link

Conversation

@eliotmcintire

@eliotmcintire eliotmcintire commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Adds a third way to turn the fitted covariates into a spread probability, built from a percolation calibration. Under it a wet or dry year can no longer push every fire past the percolation threshold. It is off by default.

Affects: Nothing changes unless link = "powerLaw" is asked for; the default link gives the same numbers and the same cache keys as before.

Technical details

Before this, the year random effect was added on the logit of the final p (objFunSpread.R, objFunInner()), which lets a year take p past the percolation threshold. New exported powerLawLink() (helpers.R) is p = pc - (pc - floor) * exp(-x / gamma) with x the linear predictor, pc in the maxAsymptote slot (fitted), floor = lowerSpreadProb, gamma fixed (spreadPowerLawGamma = 1.9, not fitted because it is confounded with the coefficient scale), and p < 0 set to 0. logisticAll(link = "powerLaw", gamma) calls it, so spreadProbFromCovs(), .objfunSpreadFit(), spreadProbGates(), spreadFitValidationData() and runDEoptim() take link = "powerLaw" and powerLawGamma; with it the year effect is added to x. powerLawOmitArgs() leaves powerLawGamma out of runDEoptim()'s cache key and re-score arguments unless the link is "powerLaw". New constants: spreadFitPowerLawGammaTxt (ledger column), "powerLaw" in spreadLinkOptions, spreadPowerLawPcBounds (0.14 to 0.35, the bounds of pc; runaway simulations on five real ELF landscapes put the threshold at 0.258-0.288, so spreadProbCeiling 0.276 would bind). Combining it with climateRef stops.

Tests: new test-powerLaw.R (link values, "ceiling" unchanged and bit-identical, year effect constant on x and not on the logit, gates, validation, runDEoptim() arguments and keys); the toy fixture of test-climateOutside.R moved to helper-spreadLinkFixture.R to share it. test-powerLaw.R fails on development (no powerLawLink, unused argument powerLawGamma). Full suite: 2136 pass, 0 fail on this branch; 2094 pass, 0 fail on development. R CMD check --no-manual: 0 errors, 0 warnings, 0 notes. Scratch library only.

🤖 Generated with Claude Code

https://claude.ai/code/session_014G18Mik3fH4z5M5CyMSUS6

powerLawLink() is called by logisticAll(link = "powerLaw"), so spreadProbFromCovs(), the objective, the gates,
the validation and runDEoptim() all take link = "powerLaw" and powerLawGamma. The year effect is added to x.
The default link and its cache keys are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014G18Mik3fH4z5M5CyMSUS6
@codecov

codecov Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.47%. Comparing base (e655536) to head (9edea3f).

Additional details and impacted files
@@               Coverage Diff               @@
##           development     #167      +/-   ##
===============================================
+ Coverage        89.44%   89.47%   +0.03%     
===============================================
  Files               51       51              
  Lines             4451     4466      +15     
===============================================
+ Hits              3981     3996      +15     
  Misses             470      470              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

…288, above spreadProbCeiling

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014G18Mik3fH4z5M5CyMSUS6
@eliotmcintire
eliotmcintire merged commit ad0c12f into development Oct 19, 2026
16 checks passed
@eliotmcintire
eliotmcintire deleted the powerlaw-link branch October 19, 2026 01:19
eliotmcintire added a commit that referenced this pull request Oct 19, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014G18Mik3fH4z5M5CyMSUS6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backwards compatible Existing code and results keep working unchanged enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant