Skip to content

Predict with the fitted terms, not the spread formula's - #28

Merged
eliotmcintire merged 1 commit into
developmentfrom
fix-predict-fitted-terms
Oct 14, 2026
Merged

eliotmcintire merged 1 commit into
developmentfrom
fix-predict-fitted-terms

Conversation

@eliotmcintire

Copy link
Copy Markdown
Collaborator

A hindcast run stopped with "not found in data objects" because the spread formula had a term that the fitted model does not have. The module now predicts with the terms the fit actually has.

Affects: Runs where the formula already matched the fit give identical results; runs whose formula had an extra term now predict instead of stopping.

Technical details

Defect: fireSense_spreadPredict.R:290-305 (spreadProbOneELF) took the single-ELF covariates from sim$fireSense_spreadFormula, while the multi-ELF path (byParams = TRUE) used the fitted terms. In a hindcast the formula is rebuilt on 1985 land cover and can contain treedWetland_agb, which the ledger fit lacks.

Fix: both paths now cut the covariates to the fitted terms and the formula and byParams arguments are gone. A fitted coefficient with no covariate still stops, naming it. The warning for unused covariates is removed because it can no longer fire. No RNG is used here.

Tests: new test-fittedTerms.R (extra formula term, missing formula term, extra covariate column); it errors on the base and passes on the branch. Three old tests that asserted errors on formula terms were removed and one test now expects no warning. Module tests via convertToPackage + test_local, scratch library phase4/lib: base with the new tests 58 tests, 1 error; branch 55 tests, 0 failures.

🤖 Generated with Claude Code

https://claude.ai/code/session_01CwcjqqK59FmTJscyi7xUqv

spreadProbOneELF() (fireSense_spreadPredict.R:290-305) took the covariates from sim$fireSense_spreadFormula for a single ELF, so a formula rebuilt on another year's land cover stopped a hindcast. The single-ELF path now uses the fitted parameters' terms, as the multi-ELF path did.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CwcjqqK59FmTJscyi7xUqv
@eliotmcintire eliotmcintire added bug Something isn't working backwards compatible Existing code and results keep working unchanged labels Oct 14, 2026
@eliotmcintire
eliotmcintire merged commit be32ab9 into development Oct 14, 2026
6 checks passed
@eliotmcintire
eliotmcintire deleted the fix-predict-fitted-terms branch October 14, 2026 13:11
eliotmcintire added a commit that referenced this pull request Oct 14, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CwcjqqK59FmTJscyi7xUqv
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 bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant