# Polynomial Fitting

This lesson discusses root mean square error and how to fit a polynomial with the information it provides.

We'll cover the following

In various scientific fields, we often have data that we need to model using a mathematical equation. This is also called curve fitting, and when the mathematical equation of the model is a polynomial, we call it polynomial fitting.

## Root mean square error

One way to quantify the fit between data and a model is to compute the root mean square error. This error is defined as the difference between the observed value and the modeled value. The term ‘error’ is also sometimes known as residual. If the error of data point $i$ is written as $\varepsilon_{i}$, and the total number of observations is $N$, then the sum of squared errors $S$ is:

$S=\sum\varepsilon_{i}^2$

When the total number of observations is $N$, the root mean square error $E$ is computed as:

$E=\sqrt{\frac{1}{N}S}=\sqrt{\frac{1}{N}\sum\varepsilon_{i}^2}$

The root mean square error is an estimate of how well the curve fits and can be computed for any model and any dataset.