How-to guides
Fit constants to measurements
Updated 3 November 2026 · 3 min read
Fit to Data finds the values of the constants you choose that make the model match your measurements as closely as it can, and tells you how sure it is of each one. You need at least one data series first.
Run a fit#
- Open Fit to Data in the side panel.
- Under Calibrate, tick the constants you want found. Leave the rest unticked: they keep their values.
- Press Fit 1 constant to data (the button counts what you ticked).
- 1The fitted value and its ± range, in the constant’s unit.
- 2How much of the variation in the data the model now explains.
The fitted values are written into the constants and the model reruns with them. If you don’t like the result, Undo puts the old values back.
Choose what to fit#
Tick only what you genuinely don’t know and can’t measure. Every constant you add makes the match look better and each value less certain, and past a point the data can’t tell the values apart at all.
- Fit one constant first. See how far it gets you, and look at the diagnostic charts, before adding a second.
- Set honest ranges. The fit searches only between each constant’s Lowest and Highest. A range that is too narrow traps it; one that is far too wide lets it wander into values that make no physical sense.
- Start near a sensible value. The search starts from the constant’s current value, moved in from the ends of its range. A start on a bound can’t move off it, which is why the builder never starts there.
Read what comes back#
| You see | It means |
|---|---|
| A value with ± | The fitted value, and how far the scatter in the data leaves it uncertain: about 95% of the time the truth is within that range |
| R² near 1 | The model follows the data closely |
| R² near 0, or negative | The model does no better than a flat line at the average of the data |
| A wide ± | The data can’t pin that value down. Fit fewer constants, or find data that depends on it |
| The history can’t pin this down | The fit couldn’t work out a range at all: the data barely depend on that constant |
| Stopped at its highest (or lowest) allowed value | The best answer may lie beyond the range. Widen it if that is believable, and fit again |
Several constants at once#
With two or more constants ticked, the search also starts from two other points spread across the ranges and keeps whichever match is best. That makes a fit of several constants take two to three times as long, and makes it much less likely to stop in a dip that only looks like the bottom.
Auto-fit#
The Auto-fit switch refits a moment after every change you make to the model, so the fitted values follow your edits. It is useful while you explore a model’s structure. For a slow fit, leave it off and press Fit when you are ready.
Fitting several series#
If a model has more than one data series, the fit matches all of them at once. Each series’ differences are divided by its tolerance first, so a series in ppm and another in °C count fairly against each other, and each gets its own R².
See also
- Fit to DataLsqcurvefit: the constants that make the model match the measurements best.
- Calibration, uncertainty and validationWhat a fit can and can't tell you, and how to test a model on data it hasn't seen.
- Fitting an outbreak to case dataImport daily case counts, let Fit to Data find the contact rate, and judge how far to trust it.
- Import measurements from a CSVGet a column of measurements into the model, drawn as dots against the line it should follow.