Skip to content

Add the "powerLaw" spread link - #31

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
Collaborator

Lets the spread prediction use fits made with the new power-law link, so a fit and its prediction agree. It is off unless the fit used that link.

Affects: Fits made with spreadLink = "powerLaw" are predicted with that link; every other ledger row, including all existing ones, predicts as before.

Depends-on: PredictiveEcology/fireSenseUtils#167

Technical details

spreadProbOneELF() (fireSense_spreadPredict.R) always called spreadProbFromCovs() with the default link, so a power-law row would have been predicted as a logistic. New ledgerPowerLawGamma() reads the row's spreadLink and powerLawGamma_spread (written by fireSense_spreadFit's ledger row) and passes them as link = "powerLaw" and powerLawGamma; the one function the fit uses, spreadProbFromCovs(), then gives the same p (the fit's maxAsymptote is p_c). A power-law row without a valid gamma stops. It also outputs fireSense_SpreadPowerLaw (pc, gamma, floor; a vector with one ELF, a 3-layer raster blended like fireSense_SpreadSD with several; NULL for other links) so that fireSense_burn can add the year effect to the linear predictor as the fit does (PredictiveEcology/fireSense_burn, follow-up PR); the earlier warning is gone.

Tests: new test-powerLaw.R (hand-computed values for one and several ELFs, other links unchanged, missing gamma, the new output). The fit-to-ledger-to-predict round trip is covered in two halves, because the modules' test environments are separate: the fit module's test checks the row it writes, this one builds a row with the same fireSenseUtils column constants and checks the prediction. Module suite (scratch library, fireSenseUtils from that PR, locally numbered 0.2.3.9107): 199 pass, 0 fail on this branch; 168 pass, 0 fail on development, where the new test file errors at its first line. reqdPkgs floor is fireSenseUtils@development (>= 0.2.3.9107); no version bump.

🤖 Generated with Claude Code

https://claude.ai/code/session_014G18Mik3fH4z5M5CyMSUS6

fireSense_spreadFit: spreadLink = "powerLaw", powerLawGamma, p_c bounds, ledger columns.
fireSense_spreadPredict: reads the row's link and gamma and applies powerLawLink via spreadProbFromCovs.
Floor fireSenseUtils (>= 0.2.3.9107).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014G18Mik3fH4z5M5CyMSUS6
@eliotmcintire eliotmcintire added enhancement New feature or request backwards compatible Existing code and results keep working unchanged labels Oct 19, 2026
…t to x; drop the warning

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014G18Mik3fH4z5M5CyMSUS6
@eliotmcintire
eliotmcintire merged commit 2bf2d9a into development Oct 19, 2026
9 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