calibrate
Fit constant model parameters to observed time-series data using local or global optimization, enabling model calibration from empirical observations.
Instructions
Fit constant model parameters to an observed time-series — the inverse of simulate. Only constant auxiliaries/flows can be calibrated (stocks are rejected: overriding a stock pins it to a constant rather than setting its initial value). least_squares (default) reports a linearized std_error; differential_evolution is a global, seeded alternative requiring bounds. Observation times must lie within the model window (no extrapolation). Requires the optional pysd dependency (pip install 'stella-mcp[sim]').
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| seed | No | differential_evolution seed (kept non-null for reproducibility) | |
| method | No | Optimizer: least_squares (local, gives std_error) or differential_evolution (global, seeded, needs bounds) | least_squares |
| maxiter | No | differential_evolution generation cap (default 100) | |
| popsize | No | differential_evolution population multiplier | |
| weights | No | Optional positive per-target residual multipliers; inverse-sigma values give normalized residuals and the usual statistical std_error interpretation | |
| max_nfev | No | least_squares function-evaluation cap | |
| model_id | No | Session-scoped model ID. Optional; defaults to the current model for this session. | |
| objective | No | Objective (sum of squared residuals; scale via weights) | sse |
| parameters | Yes | Constant parameters to fit (constant auxiliaries/flows only; stocks are rejected) | |
| observations | Yes | Observed data on one shared time grid: inline {time, targets} or {csv_path} (first CSV column is time) | |
| save_fit_csv | No | Optional path to write a long (time, target, observed, fitted) CSV | |
| return_fit_series | No | Also return the best-fit downsampled series per target |