Enter the observed and predicted values into the calculator to determine the least square error. This calculator helps in assessing the accuracy of a model by comparing the predicted values to the actual observed values.

Least Square Error Formula

The following formula is used to calculate the least square error (LSE):

LSE = (1/n) * Σ(observed - predicted)²

Variables:

  • LSE is the least square error
  • n is the number of data points
  • observed is the array of observed values
  • predicted is the array of predicted values

To calculate the least square error, subtract each predicted value from the corresponding observed value, square the result, and sum all the squared differences. Then, divide the sum by the number of data points.

What is Least Square Error?

Least square error is a measure used in statistical models to quantify the difference between the values predicted by a model and the values actually observed from the environment that is being modeled. It is a common measure of the overall 'fit' of a model, with lower values indicating a better fit.

How to Calculate Least Square Error?

The following steps outline how to calculate the Least Square Error.


  1. First, list the observed values and the predicted values. Ensure that the number of observed values matches the number of predicted values.
  2. Next, subtract each predicted value from the corresponding observed value and square the result to find the squared error for each data point.
  3. Sum all the squared errors to get the total squared error.
  4. Divide the total squared error by the number of data points (n) to get the least square error (LSE).
  5. Use the calculator above to check your calculations.

Example Problem : 

Use the following variables as an example problem to test your knowledge.

Observed values = 2, 4, 6, 8

Predicted values = 3, 5, 7, 9