Linear regression most often uses mean-square error (MSE) to calculate the error of the model. MSE is calculated by:
measuring the distance of the observed y-values from the predicted y-values at each value of x;
squaring each of these distances;
calculating the mean of each of the squared distances.
Linear regression fits a line to the data by finding the regression coefficient that results in the smallest MSE.