Generic selectors
Exact matches only
Search in title
Search in content
Post Type Selectors

Curve fitting. Least squares regression

Would you like to know how to fit a point cloud to a function and discover the least squares regression method?

Online curve fitting simulations on this page help us to understand how to fit a point cloud and show us some of the most common techniques such as least squares regression.

What is curve fitting

Curve fitting is a technique used in data analysis to find a mathematical function that fits a set of points. The goal is to find a smooth curve that passes close to all the points and represents the relationship between the variables of interest accurately.

Curve fitting applications

Curve fitting is used in a wide range of fields, such as physics, statistics, economics and engineering. It is especially useful when you have a set of data and you want to obtain a function that describes them adequately. This can be useful for predicting future values, interpolating between known points, or better understanding the relationship between variables.

Curve fitting methods

There are several methods for curve fitting, the most common being linear fitting and polynomial fitting. Linear fitting is used when data are expected to follow a linear relationship, while polynomial fitting allows more complex relationships to be represented by higher degree polynomials. These methods are based on minimizing the difference between the values predicted by the fitted function and the actual data values.

Another popular approach is curve fitting using exponential, logarithmic or trigonometric functions, depending on the shape of the data and the expected relationship between the variables. These models can capture nonlinear patterns and provide a better approximation in some cases.

Least squares regression method

The least squares regression method is a mathematical technique used to find the most accurate relationship between a set of data and a function by minimizing the sum of the squares of the differences between the observed values and the values predicted by the model. This method is fundamental in curve fitting, since it allows determining the curve that best fits the experimental data, optimizing its representation and reducing prediction errors. It is widely used in statistics, physics, engineering and other disciplines to analyze trends and make predictions based on observed data.

Limitations of curve fitting

It is important to note that curve fitting is not always appropriate, as it can lead to overfitting or underfitting. Overfitting occurs when the fitted function over-fits the training data and performs poorly on new data, while underfitting occurs when the function does not adequately capture the relationship between variables.

Curve fitting simulations

Fitting the curve


With the mouse, drag the data points and their error bars, and see the best fit of the polynomial curve that instantly updates. You can choose the type of fit: linear, quadratic, or cubic. The reduced chi-square statistic shows you when the fit is good. Or you can try to find the best fit manually by adjusting the parameters.


Licencia de Creative Commons

Least squares regression


Create your own scatter plot or use real-world data and try to create a line of fit. Explore how individual data points affect the correlation coefficient and trend line.


Licencia de Creative Commons

STEM education equipment

Mathematics courses

You may also be interested

You may also be interested