Linear Regression Numerical Using Least Squares Method
Linear Regression Numerical Using Least Squares Method
Linear regression is one of the most fundamental techniques in statistics and data science. It is used to model the relationship between two variables and to predict future values based on past data. In this article, we will solve a complete numerical problem using the Least Squares Method in a detailed, step-by-step manner.
Introduction to Linear Regression
Linear regression establishes a relationship between:
Independent variable (x)
Dependent variable (y)
It assumes that this relationship can be represented by a straight line:
Where:
a is the intercept (value of y when x = 0)
b is the slope (rate of change of y with respect to x)
Least Squares Method
The Least Squares Method is used to determine the best-fit line. It minimizes the sum of squared differences between the observed values and the predicted values.
Problem Statement
Fit a straight line using linear regression and find the value of y when x = 11.
Given Data:
x | y |
|---|---|
2 | 3 |
3 | 4 |
4 | 7 |
5 | 4 |
8 | 10 |
9 | 15 |
Step 1: Formula
We use the following formulas:
Where n is the number of observations.
Step 2: Create Calculation Table
x | y | x² | xy |
|---|---|---|---|
2 | 3 | 4 | 6 |
3 | 4 | 9 | 12 |
4 | 7 | 16 | 28 |
5 | 4 | 25 | 20 |
8 | 10 | 64 | 80 |
9 | 15 | 81 | 135 |
Step 3: Calculate Summations
Step 4: Calculate Slope (b)
This means:
For every 1 unit increase in x, y increases by approximately 1.515
Step 5: Calculate Intercept (a)
Step 6: Form the Regression Equation
Step 7: Predict Value for x = 11
Final Result
The predicted value of y when x = 11 is approximately:
Conclusion
Linear regression using the Least Squares Method provides a systematic way to model relationships between variables and make predictions. By carefully calculating sums, applying formulas, and forming the regression equation, we can accurately estimate unknown values. This method forms the foundation of many advanced techniques in data science and machine learning.
