Fits a hierarchical Bayesian in-season model using STAN based on inputs prepared from prepare_inseason_inputs(). Supports optional autocorrelation in weekly dynamics.

fit_inseason_model(inputs)

Arguments

inputs

A list generated by prepare_inseason_inputs(), containing data, initial values, and flags for covariate/autocorrelation structure.

Value

A stanfit object from the rstan package containing the fitted model results and posterior samples.

Details

This function compiles and runs the appropriate STAN model using the rstan package. It automatically selects between two model variants (with and without autocorrelation) and monitors a predefined list of parameters.

STAN settings: 3 chains, 2000 iterations, and all monitored parameters are included in the return object.