AI Glossary / Time series and signal processing / Beginner
Curve fitting
Definition
Curve fitting is the process of choosing parameters of a mathematical function so that the function approximates observed data according to a stated criterion. The function may be a straight line, polynomial or another form. In forecasting, a fitted relationship with time can be extended into future periods, but a close historical fit alone does not establish forecast accuracy.
What it means
A fitted curve provides a concise description of a relationship. It replaces a collection of observations with an estimated mathematical pattern and residual deviations. The name does not require a visibly curved line: fitting a linear trend is also curve fitting.
The purpose matters. A curve used to describe observed measurements, interpolate between them, estimate scientific parameters or extrapolate beyond them faces different demands. A flexible function can match historical data extremely closely and still behave implausibly outside the observed range. The chosen form should therefore reflect the intended use, available information and relevant constraints rather than visual smoothness alone.
How it works
Select a function and an error criterion, then estimate its parameters from the observations. Ordinary least squares minimizes the sum of squared residuals. Weighted fitting can give different observations different influence when a justified weighting scheme is available. Other criteria may be suitable for other error structures.
Some problems have direct algebraic solutions; others require numerical optimization with starting values and parameter constraints. Check whether the estimated parameters are identifiable and whether the optimizer has produced a usable result. Convergence does not guarantee that the assumed function is appropriate.
Inspect residuals and assess performance on observations withheld in a way that matches the intended application. For forecasting, preserve chronological order. Account for uncertainty and distinguish uncertainty about the fitted mean relationship from uncertainty in a new observation. Serially related errors may require a model beyond ordinary independent-error fitting.
Three practical examples
1. Equipment calibration: A laboratory fits a response curve between a known input and sensor readings. It checks the range in which the calibration is supported and avoids assuming accuracy beyond that range.
2. Trend description: A planner fits a straight line to a short historical series as a baseline. Future forecasts are assessed against later observations rather than accepted because the plotted line looks plausible.
3. Growth modeling: An analyst compares a saturating growth curve with an unrestricted polynomial. Domain knowledge and out-of-sample behavior help determine whether the fitted shape is useful.
Think of it this way
Think of placing a mathematical guide through a cloud of plotted points. The guide need not touch every point to be useful. Its shape and fitting rule determine what pattern it represents. Extending it beyond the cloud is a further assumption about how the relationship will continue.
Worked example
Consider an original example with time values 0, 1 and 2 and observations 2, 4 and 7. Fit the line y = a + b times time by ordinary least squares. The mean time is 1 and the mean observation is 13/3. The slope is 5/2 = 2.5, and the intercept is 13/3 - 2.5 = 11/6.
The fitted values are 11/6, 13/3 and 41/6. Observed-minus-fitted residuals are 1/6, -1/3 and 1/6. Their squared sum is 1/36 + 1/9 + 1/36 = 1/6.
Extending the line to time 3 gives 11/6 + 7.5 = 28/3, approximately 9.33. A quadratic can pass exactly through the three observations and would produce a different extrapolation. The line's forecast is a consequence of the chosen form, not an observed future result. Three points are insufficient to demonstrate that either model forecasts reliably.
Illustrative case study
In a fictional case, Meadow Services fits a high-degree polynomial to several months of demand. The curve closely follows the historical points but rises sharply when extended into the next quarter. A reviewer asks whether any operational evidence supports that acceleration.
The team compares simpler trends and alternative models using earlier forecast origins. It keeps the polynomial as a descriptive illustration only until its forecasting behavior is justified. The fictional case illustrates the difference between fitting observed data and making useful predictions. It does not report a real company's model comparison or establish that the simplest model always wins.
Common misconceptions and mistakes
A curve with zero training error is not necessarily the best model. More parameters can improve historical fit while increasing instability or capturing noise. Interpolation, approximation and forecasting are related but distinct tasks.
A fitted association is not automatically causal. Parameter standard errors also depend on assumptions and the quality of the approximation used to calculate them. In nonlinear fitting, different starting values can lead to different solutions, and redundant parameters can make uncertainty estimates unreliable. Finally, extrapolation can be especially sensitive to the function chosen even when several candidate curves fit the observed range similarly well.
Business use
Curve fitting can support calibration, baseline forecasting and communication of a quantitative pattern. Its practical value comes from a relationship that remains useful within a clearly defined operating range, with error small enough for the intended decision.
Record the function, units, fitting criterion, parameter constraints and data window. Check residuals and plausible boundary behavior. Compare alternatives using evaluation appropriate to deployment, and maintain a simple benchmark. When observations arrive over time, monitor whether the fitted relationship changes. Communicate predictions with suitable uncertainty rather than presenting a smooth curve as if it removed measurement noise or future variability.
People also ask
Is a straight line a fitted curve?
Yes. Linear fitting is one important special case.
Must a fitted curve pass through every observation?
No. Approximation methods usually allow residual errors.
Does a high historical fit guarantee a good forecast?
No. Forecasting tests behavior on unseen future observations.
Is every polynomial fit nonlinear in its parameters?
No. Polynomial regression can be linear in its coefficients even when the graph is curved.
Check your understanding
What line is fitted in the worked example?
Answer: Its intercept is 11/6 and its slope is 2.5.
What is the squared residual sum?
Answer: It is 1/6.
Why is the value at time 3 uncertain?
Answer: It extrapolates the selected relationship beyond the observed data.
Related terms
- Least squares
- Residual
- Overfitting
- regression
- interpolation
- extrapolation
- polynomial
- parameter identifiability
Learn next
Learn next how residual diagnostics reveal model inadequacy, how weighted and nonlinear fitting differ from ordinary least squares, and why chronological validation matters for forecasts. Compare uncertainty in the fitted mean with prediction uncertainty for a new observation.
More in Time series and signal processing
- Coefficient of variation - The coefficient of variation, or CV, is the standard deviation divided by the mean.
- Collaborative filtering - Collaborative filtering is a recommendation approach that learns from patterns of interaction between users and items.
- Cumulative forecasting - Cumulative forecasting predicts the total amount of a variable over several future periods.
- Delphi method - The Delphi method is a structured process for collecting and refining judgments from a panel through repeated rounds of questions and controlled feedback.
- Diagnostic checking - Diagnostic checking is the examination of a fitted model for signs that its assumptions or structure are inadequate for the intended use.
- Difference-equation filtering - Difference-equation filtering computes a discrete-time output from weighted current and past inputs and, in recursive filters, past outputs.
Work in finance? Get the free CFO AI Prompt Pack: 7 prompts for finance leaders.
Sources
SciPy developers, curve_fit: https://docs.scipy.org/doc/scipy/reference/generated/scipy.optimize.curve_fit.html . Makridakis, Wheelwright and Hyndman, Glossary of Forecasting Terms: https://robjhyndman.com/mwh3/FG4.pdf . The primary sources were consulted for fitting objectives, parameter uncertainty and forecasting terminology. The historical glossary's favorable wording about higher-order fits is not treated as a general forecasting guarantee. The numerical example is original and independently calculated.
Previous: Curse of horizon in off-policy evaluation Next: Curve-fitting compaction