Compare crop-yield methods with chronological validation

Description

Hyperparameters are learned from tuning years. Interval widths use a separate calibration block when configured, otherwise tuning errors. Each prediction is rolling-origin: the response for year 't' is predicted using response data strictly before 't'. The package's automatic method is selected by tuning RMSE, never by the later evaluation scores.

Usage

compare_crop_models(
  data,
  config = crop_model_config(),
  last_yield_year = NULL,
  predict_through = NULL,
  verbose = TRUE
)

Arguments

data

A 'crop_yield_data' object.

config

A [crop_model_config()] object.

last_yield_year

Final observed year allowed in model development. Defaults to the latest finite response year.

predict_through

Final weather year for final fitted predictions. Defaults to the latest year in the panel.

verbose

Print progress messages.

Value

An auditable 'crop_model_comparison' object containing candidate grids, selected hyperparameters, row-level predictions, metrics, splits, final fitted models, and input provenance.

Examples

wheat <- read_crop_data(poland_example_path(), "wheat", 7)
# A full six-method comparison is intentionally not run during package checks.

comparison <- compare_crop_models(
  wheat,
  crop_model_config(methods = c("trend", "hierarchical")),
  last_yield_year = 2018,
  predict_through = 2019,
  verbose = FALSE
)
comparison


[Package yieldlag version 0.3.0 ]