Find linear regression equation, y = ax + b. The data of following table gives the weekly maintenance cost (Rupees) to the age (in months) of 5 machines of similar type in a manufacturing...

Find linear regression equation, y = ax + b.

The data of following table gives the weekly maintenance cost (Rupees) to the age (in months) of 5 machines of similar type in a manufacturing company.

Age(X): 5, 15, 30, 50, 60

Cost(Y): 190, 250, 310, 350, 395

Asked on by mr-sajid

2 Answers | Add Yours

kjcdb8er's profile pic

kjcdb8er | Teacher | (Level 1) Associate Educator

Posted on

In statistics, a linear regression refers to finding a model that fits the data to a linear equation. There are several methods for doing this, such as Least Squares, principle component regression, maximum likelihood regression, and many more.

Least squares model is the easiest to explain briefly. In essense, one is finding a trend line that minimizes the the deviation of all of the data points from the line. The value R^2 measures the quality of the fit of the line; the closer to 1, the better the fit. The derivation of the equations for least squares is straight forward calculus, but too long to reproduce here. See the references. For fitting to the linear equation y = ax + b, let n = # data points, X = sum x, X2 = sum x^2, XY = sum xy, etc. Then,

a = (nXY - XY)/(nX2 - (X)^2)

b = (X * X2 - X * XY)/(nX2 - (X)^2)

 

You can also plug your data into Excel, and find a trendline with the corresponding equation since Excel uses least squares. For your data the trend line is:

y = 3.4554x + 188.43
R² = 0.9699

neela's profile pic

neela | High School Teacher | (Level 3) Valedictorian

Posted on

We know that if  y  = ax+b is a linear regression  equation of y on x, then  the sum of the squared deviation , S =  Sigma(Yi - aXi -b)^2. We can minimise this squared diviation by equating the partial derivatives with respect to b and a to zero and solve for x  and b and a .

So dabaS/db = 0 and dabaS/daba a = 0 gives to the normal equations in b and a solving which we can determine the equation Y = aX+b. So the required normal equations are :

summation 2( Yi - a* Xi -sigma b)  = 0 and

Summation2(Yi-aXi-b)Xi = 0. Both these equations could be simplified as:

a* summation Xi + nb = summation Yi

a*summation Xi^2 +b summation Xi = Summation Xi*Yi.

Solving for a  from these two equations we get  a and b.

 

In the given  case we see that the given data could be scaled down like Ui = (Xi- 30)5 and Vi = (Yi - 310)/10. Then

U1 = (5-30)/5= -5 , U2 = (15-30)/5=-3 ....U5 = (60-30)/5 =12.

V1 = (190-310)/10 = -12,  V2 = (250-310)10 = -6,....,V5 = (395-310)/10 = +8.5.

So we can have the table below:

.........   Ui        Vi         Ui^2         Ui*Vi

.........  -5        -12      25              60

.........  -3        -6        09              18

.........  00       00       00               00

.........  04       04       16              16

.........  06       8.5      36               51

---------------------------------------------------

Total: 02       -5.5      86             145

---------------------------------------------------

Therefore the normal equations for Ui and Vi are :

a*sum Ui + nb  = Sum Vi  Or 2Ui+5b = -5.5...................    (1)

a*sum Ui^2+b*sum Ui = Sum Ui*Vi. Or 86a+2b = 145.....(2)

Solving the simultaneous equations(1) and (2) we get:

a = {145*5-(-5.5)*2}/(86*5-2*2) = 736/426 = 1.727699531

b= (-5.5-2a)/5 = -(5.5+2(736/426))/5 =  -1.791079812.

Therefore ,

Vi =  1.727699531Ui - 1.79107912.

Now go back transformation or  replace  Ui by  (Xi-30)/5 and Vi = (Yi-310)/10.

Therefore,

(Yi -310)/10 = 1.727699531(Xi-30)/5  - 1.79107912. Or

Yi = 3.455399062 Xi  + 310 -  1.727699531*30*10/5  -17.9107912

Yi = 3.455399062Xi + 188.4272369 is the required equation by the method of least square..

The estimaied values of Yi 's are: for X= 5, Y = 205.70. Or

(05, 205.70)

(15 , 249.26)

(30 , 292.09)

(50 , 361.20)

(60 , 395.75).

 

 

 

 

We’ve answered 318,991 questions. We can answer yours, too.

Ask a question