The per-fold work shared by crossValidateSpread() (both folds, one job) and crossValidateSpreadOneFold() (one fold, one job – the heldOutFold parameter). The fit's runName (and so its Cache key, see fitSpread()) is suffixed by k, so fold 1, fold 2 and a full fit (plain P(sim)$.runName, no suffix) never share a cache entry.

fitAndScoreFold(sim, covs, fold, k)

Arguments

sim

a simList.

covs

mod$covsX1000.

fold

integer vector, one element per year in names(covs$historicalFires), from cvFolds().

k

integer; the fold (1 or 2) to hold out.

Value

list: sims, this fold's simulated held-out years (fireSenseUtils::simulateFireSizes()), with fold; and fit, the fold's fit as a ledger row (spreadFitLedgerRow()) with all simulateMembers members.