Fitting a Straight Line using the Least Squares Method is a statistical technique used to find the line of best fit y=a+bx that minimizes the sum of squared vertical distances (residuals) between sample data points and the line.
It is widely used in trend analysis, linear modeling, and forecasting relationships between an independent variable x and a dependent variable y.
Normal Equations for Straight Line (y=a+bx):
∑y=n⋅a+b∑x
∑xy=a∑x+b∑x2
Where:
n is the number of data point pairs.
a is the y-intercept of the fitted line.
b is the slope coefficient.
Example of Fitting a Straight Line
Given the following dataset of 5 observation pairs:
X
1
2
3
4
5
Y
2
3
5
4
6
Step 1: Calculate Summary Statistics
∑x=15,∑y=20
∑x2=55,∑xy=71
Step 2 & 3: Solve for Coefficients (a,b)
b=5(55)−1525(71)−15(20)=5055=1.1
a=520−1.1(15)=53.5=0.7
Conclusion
y=0.7+1.1x
Therefore, using the Least Squares Method, the straight line of best fit for the given dataset is y = 0.7 + 1.1x.