Fit one statistical crop-yield model

Description

This is the direct fitting interface. It does not tune parameters and does not estimate a prediction interval, which prevents accidental claims that an in-sample fit has been validated. Use [compare_crop_models()] for rolling-origin tuning, interval calibration, and later evaluation.

Usage

fit_crop_model(data, method = "hierarchical", parameters = NULL, robust = TRUE)

Arguments

data

A [prepare_crop_data()] or [read_crop_data()] result.

method

One base method. Ensembles require the comparison workflow.

parameters

Named list of method parameters. 'NULL' uses documented, fixed defaults rather than selecting them from the supplied response. For 'stress_lag', parameters are 'lambda', 'smooth_ratio', 'threshold', and optional 'temperature_variable'/'precipitation_variable' labels. Defaults are 100, 10, and 0.75, with compound terms disabled. Optional 'components' selects a subset of 'linear', 'upper_tail', 'lower_tail', and 'compound_hot_dry'; 'linear' is required. 'regional_effects = FALSE' removes regional intercept/trend deviations for a controlled ablation. Defaults retain all components and deviations.

robust

Whether to use robust fitting where supported.

Value

A 'crop_yield_model' object.

Examples

wheat <- read_crop_data(poland_example_path(), "wheat", 7)
trend <- fit_crop_model(wheat, method = "trend")
predict(trend, wheat$panel[1:3, ])

[Package yieldlag version 0.3.0 ]