Skip to content

New parameter spreadCovariates: "none" gives the null spread formula ~ 1 - #104

Merged
eliotmcintire merged 2 commits into
developmentfrom
spread-intercept-only
Nov 16, 2026
Merged

eliotmcintire merged 2 commits into
developmentfrom
spread-intercept-only

Conversation

@eliotmcintire

Copy link
Copy Markdown
Collaborator

This adds a switch to prepare a spread fit with no covariates, only an intercept. That "null" model is the baseline that fits with covariates have to beat.

Depends-on: PredictiveEcology/fireSenseUtils#236

Affects: nothing by default. With the new setting, the spread formula is ~ 1.

Technical details

New parameter spreadCovariates ("all" default, "none"). The formula is built in prepare_SpreadFit() (fireSense_dataPrepFit.R ~line 1045, spreadFormula(RHS, Par$spreadIntercept)): with "none" the RHS is empty and spreadFormula() (R/spreadFormula.R) returns "~ 1". With "all" the strings are byte-identical to before (~ 0 + ..., ~ 1 + ...), so cache keys that hold the formula do not move. Init() calls the new checkSpreadCovariates(), which stops on a value other than "all"/"none" and on "none" with spreadIntercept = FALSE.

The covariate tables are still built under "none": spreadFit derives its ranges from them, and the hindcast and ignition steps need the climate tables. Only the formula changes. A hindcast of a null fit must set spreadCovariates = "none" too (.globals); a hindcast that reuses a null ledger row and still prepares spread covariates would otherwise build a formula with covariates.

Reuses: spreadFormula() (generalised in place for an empty RHS), fireSenseUtils::spreadDesignCols() in the test, the formula-building statements of test-spreadFormulaYoungAgeOnce.R; new: checkSpreadCovariates() (nothing validates a spread parameter combination; it is the one place for both checks).

Tests (test-spreadIntercept.R): spreadFormula(character(), TRUE) is "~ 1", checkSpreadCovariates() cases, the parameter and its default, and prepare_SpreadFit()'s formula for "none"/"all" with and without intercept. They fail on the base (no such function or parameter). Test stubs that run Init() now carry the parameter; test-metadata.R lists it. Full suite (convertToPackage() + test_local()): branch 0 failed, 0 errors, 1 skipped, 514 passed; base 0 failed, 0 errors, 1 skipped, 497 passed (the skip is the opt-in DPF_EQUIVALENCE_FIXTURE test, which needs a real study area and Drive; same on both). Libraries: the FireSenseTesting dev library read-only; nothing installed.

🤖 Generated with Claude Code

https://claude.ai/code/session_014G18Mik3fH4z5M5CyMSUS6

eliotmcintire and others added 2 commits November 16, 2026 09:55
…bs carry it; metadata test lists it

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 Nov 16, 2026
@eliotmcintire
eliotmcintire merged commit 79d94b7 into development Nov 16, 2026
9 checks passed
@eliotmcintire
eliotmcintire deleted the spread-intercept-only branch November 16, 2026 18:13
eliotmcintire added a commit that referenced this pull request Nov 16, 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