Skip to content

Predict with fuel x climate interaction coefficients - #43

Merged
eliotmcintire merged 2 commits into
developmentfrom
spreadInteractions
Nov 17, 2026
Merged

eliotmcintire merged 2 commits into
developmentfrom
spreadInteractions

Conversation

@eliotmcintire

@eliotmcintire eliotmcintire commented Nov 16, 2026 •

Copy link
Copy Markdown
Collaborator

A fitted spread model that has fuel x climate terms can now be used to predict fire spread. The prediction multiplies the fuel and the climate the same way the fit did.

Affects: nothing for existing fits; fits made with fuel x climate terms predict with them.

Depends-on: PredictiveEcology/fireSenseUtils#242

Technical details

Gap. spreadProbOneELF() required a covariate column for every fitted coefficient name (fireSense_spreadPredict.R:525) and selected exactly those columns (:537), so a coefficient CMD:dom_agb_Pice_mar stopped with "no covariate".

Fix. It needs the data columns of the fitted terms (fireSenseUtils::spreadSourceCols(): the main covariates and the covariates an interaction multiplies), and passes the fitted terms as the design columns (:550). fireSenseUtils::spreadProbFromIntegerCovs(), which the fit uses, forms the product after each covariate is rescaled and centred with the row's covCentre_spread, 0 where youngAge cleared the fuel,. So the linear predictor is the fit's. A row without interactions takes the same path as before (tested: the existing suite is unchanged).

Reuses: fireSenseUtils::spreadSourceCols(), spreadProbFromIntegerCovs(), spreadProbFromCovs(), youngAgeExclusiveCols(); new: nothing (a 4-line change in spreadProbOneELF()).

Tests. New tests/testthat/test-spreadInteractions.R: prediction equals the hand-built linear predictor; with an intercept and a centre that includes the interaction; a missing covariate stops naming it; a parity test computes the fit's spread probability for the same covariates with fireSenseUtils::spreadProbFromIntegerCovs() + spreadProbFromCovs() (fuel logged, cleared where youngAge is 1, interaction cleared too) and requires the prediction to equal it. On base the file has 3 errors; full suite (convertToPackage() + test_local()): branch 0 failures, 0 errors, 0 skipped, 358 passed; base 0 / 0 / 0 / 350. Scratch library only.

Floors: the reqdPkgs floor on fireSenseUtils is raised after PredictiveEcology/fireSenseUtils#242 merges and is bumped.

🤖 Generated with Claude Code

https://claude.ai/code/session_014G18Mik3fH4z5M5CyMSUS6

…roduct of its covariates

Co-Authored-By: Claude Sonnet 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 Nov 16, 2026
…ared the fuel

Co-Authored-By: Claude Sonnet 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