# Curve fitting. Least squares regression

## Would you like to know how to fit a point cloud to a function?

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

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

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 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.

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.

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.

Below are several simulations and other educational resources, which can also serve as very illustrative examples. In addition, a selection of books and courses is included to help you broaden your knowledge of this subject.

## 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.

## 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.

### File

###### Mathematics  Maths Essentials  MathTrackX: Polynomials, Functions and Graphs

###### Algebra  College Algebra  Linear Algebra I: Linear Equations