Professional Documents
Culture Documents
Regression Models: Dr. Amar Singh Professor, School of Computer Applications Lovely Professional University
Regression Models: Dr. Amar Singh Professor, School of Computer Applications Lovely Professional University
Experience Salary
4 20000
6 24000 If Experience = 5 Years then what
7 28000 would be the salary
9 32000
Machine Learning :: Dr. Amar Singh
2 14400
Linear Relationship between variables
∑𝒏
𝒊 𝒙𝒊 𝒙
𝟐 ∑𝒏
𝒊 𝒙𝒊 𝒙
𝟐
𝒏 𝟏 𝒏 𝟏
∑𝒏
𝒊 𝒚𝒊 𝒚
𝟐
𝒏 𝟏
Covariance of X, Y
∑𝒏
𝒊 𝒙𝒊 𝒙 ∗ 𝒚𝒊 𝒚
=
𝒏 𝟏
𝟏 𝟎 𝟏
Regression coefficient ( ), Regression slope ( )
𝒊 𝒊 𝒊
• 𝟏 𝟐
𝒊 𝒊
1 95 85 17 8 136 289
2 85 95 7 18 126 49
3 80 70 2 -7 -14 4
4 70 65 -8 -12 96 64
5 60 70 -18 -7 126 324
SUM 390 385 (Resuduals) (Resuduals) 470 730
MEAN 78 77
0.644
Regression equation is: ŷ = 0.644x + 26.768
Predicting the output
• for x = 80 predicted value ŷ is computed as follows:
• ŷ = b0 + b1x
• ŷ = 26.768 + 0.644x
= 26.768 + 0.644 * 80
= 26.768 + 51.52
= 78.288
• Warning: When you use a regression equation, do not use values for the independent
variable that are outside the range of values used to create the equation. That is
called extrapolation, and it can produce unreasonable estimates.
• In this example, the aptitude test scores used to create the regression equation ranged
from 60 to 95. Therefore, only use values inside that range to estimate statistics grades.
Using values outside that range (less than 60 or greater than 95) is problematic.
Linear Regression
• Dependent Variable Y can be calculated as:
• Y = b0 + b1.X
Where is b0 intercept and b1 is Slope.
b3
X3
…..
….. b4
X1
b = (X'X)-1X’Y
where (X'X)-1X'X = I, the identity matrix.