# Calculating overall error from fit when considering the error of the individual data points

Suppose I have several datapoints and each datapoint has an error $$E_i$$. I then perform a fit on the data to a model (say, $$y=mx+c$$ for example) using a computer program. The program gives me a covariance with the fit and from this covariance I can calculate an overall error $$E$$ with the program (it takes the square root of the diagonalization of the covariance matrix - not that I understand what that means!). My question is, do the individial errors of the datapoints $$E_i$$ need to be considered in turn and combined with $$E$$ to give the total overall error? Or, does the covariance represent these small errors in the form of the extent to which the errors deviate from the fitted model.

If you fit the model $$\hat y_i = m x_i + c$$ to your dataset $$\{y_i\}$$, the error of the model is given by $$\epsilon_i = y_i - \hat y_i$$ Hence, if our dataset contains $$n$$ data points the errors are given by a $$n$$-dimensional vector, $$\vec \epsilon = (\epsilon_1, \epsilon_2, \ldots, \epsilon_n)$$.
In contrast, the variance of a model is a scalar quantity, which quantifies the (square of the) average standard deviation. It is given by $$\frac{1}{n-1}\sum_i \epsilon_i^2 = \frac{1}{n-1} \sum_i (y_i - \hat y_i)^2$$. Most fits determine the "best fit coefficients" by minimising the variance of the model. If you check how the covariance matrix of the fit looks like, you will see that the diagonal elements are the terms of the variance expression -- except the constant prefactor.