Reference: components
Fit to Data
Updated 3 November 2026 · 2 min read
Fit to Data runs SepalSolver’s Lsqcurvefit to find the values of the constants you tick that make the model match its data series best, and reports each with a ± and each series with an R².
The tab#
| Part | What it does |
|---|---|
| Data series | The model’s measurements, and Add measurements from a CSV |
| Calibrate | Every constant with a box to tick for fitting, and its current value |
| Auto-fit | Refits a moment after every change to the model |
| Fit n constants to data | Runs the fit |
What the fit does#
- It runs the model from the measured start to the last measurement, with the ticked constants as unknowns.
- It compares the model with each series at the measured times, dividing each difference by the series’ tolerance.
- Lsqcurvefit moves the unknowns, within their Lowest and Highest, to make the sum of the squared differences as small as it can. It works in scaled units, so constants of very different sizes move fairly, and stops after 40 iterations at most.
- With two or more unknowns, it also starts from two points spread across the ranges and keeps the best result.
- It works out each value’s standard error at the answer, writes the fitted values into the constants, and reruns the model.
Each search starts at the constant’s current value, moved at least 1% of its range in from either end: a search that starts on a bound can’t move off it.
The result#
| Shown | Means |
|---|---|
| value ± range | The fitted value, and 1.96 standard errors: about 95% of the time the true value lies within it, if the model is right |
| The history can’t pin this down | The data hardly depend on this constant, so no range could be worked out |
| R² series | How much of each series’ variation the model now explains |
| Stopped at its highest (or lowest) allowed value | The fit ran into the range’s end; the best value may lie beyond it |
How the standard errors are worked out, and the three ways they can mislead, is in Calibration, uncertainty and validation.
Time#
A fit runs the model many times, so it takes longer than a run: about a second for one constant on a small model, several seconds for three with their extra starts. Like any run, it must finish within 30 seconds.
See also
- Fit constants to measurementsChoose what to fit, run the fit, and read the ± and R² that come back.
- Calibration, uncertainty and validationWhat a fit can and can't tell you, and how to test a model on data it hasn't seen.
- Data seriesMeasurements over time, compared with a stock or variable.
- LimitsHow long a run may take, how often you may run, and other bounds.