Least Squares Calculator
The Least Squares calculator that helps to find the line of best fit of the form
What Is Least Squares Calculator?
The Least Squares method is a statistical regression analysis method used to find the line of best fit of the form 'y = mx + b' for a given set of data. Cuemath's 'Least Squares calculator' is a free online tool that finds the line of best fit for a given data set within a few seconds.
How to Use the Least Squares Calculator?
Follow the steps mentioned below to find the line of best fit.
- Step 1- Enter the data points in the respective input box.
- Step 2- Click on "Calculate" to find the least square line for the given data.
- Step 3- Click on "Reset" to clear the fields and enter a new set of values.
How to Calculate Least Squares?
The least-squares method is used to find a linear line of the form y = mx + b. Here, 'y' and 'x' are variables, 'm' is the slope of the line and 'b' is the y-intercept.
Here, the value of slope 'm' is given by the formula, m = (n ∑ (XY) - ∑ Y ∑ X) / (n ∑ (X2) - (∑ X)2) and 'b' is calculated using the formula b = (∑ Y - m∑ X) / n
Let us look at an example on how to find the least square line for a given data set.
Solved Example :
Find the least square line for the data shown below.
|∑ X = 15||∑ Y = 25||∑ XY = 88||∑ X2 = 55|
Find the value of m.
m = (n ∑ (XY) - ∑ Y ∑ X) / (n ∑ (X2) - (∑ X)2)
= ( 5(88) - (15 × 25) ) / ( 5(55) - (15)2 )
Find the value of b.
b = (∑ Y - m∑ X) / n
= (25 - (1.3 × 15)) / 5
So, the required equation of least squares is y = (1.3)x + 1.1
Now, use our online Least Squares calculator and find the Least Squares Line for the given data points