Best Fit Line Calculation Examples
Best Fit Line Calculation Examples
a11st1cs
492
v A = log, o a and B = logiob.
where Y = log,o · .' are given by
The nonna I equation - ·
5
iY = mA + B'iX, i
I 14 I 14
2 27 4 54
3 40 9 120
4 55 16 220
5 68 25 340
I x;= 15, L Y; = 204, I x/ = 55 and L, X;Y; = 748
Substituting these values in (2), we get
15a1 + 5a0 = 204
55a1 + I5a0 = 748
following table.
r
--
.....-
T L T2
TL
493
20 800.3 400 -
~
160()()
800.4 -
30 <JOO
240I ~
~
40 800.6 1600
~
32024
50 800.7 2500 40035
60 800.9 3600 48054
70 80 1.0 4900 56070
2
IT=2 70 L L = 4803.9 L T = 13900 ITL = 216201
\\"e haw the nomial equations
0 0
0 I
4 10
2 5
25 60
5 12
49 1-W -
7 20
7X y .\r == ~
I0
LX 14 LY 36 L x2 -
u~ing
norm al equations, we obtain
4 ao + 14u = 36
1
..• ( I )
and ... (2 )
14a0 +78 a1 = 2 10
5 5 4 5 4 3 4 3 3
- , o. ~
11
-
.
r
-
. 1 he equati on ol the straight Iine is Y = ax + h
J
Solution ·
Nnrma l equati ons ;lre :
Lr - aLx -I nb .. . ( I )
.Y :c ' y xy
6 36 s 30
7 49 5 35
7 49 4 28
8 64 5 40
8 64 4 32
8 64 3 24
9 81 4 36
9 81 3 27
10 100 3 30
Lr = 72 I Ix1 = 588 LY= 36 LXY = 282
Substituting these values in ( l ) and (2), we obtain
36 = 72a + 9b ... (3)
282 = 588a + 72b ... (4)
(3) Y 8 - (4) gives
6 = - I 2a ⇒ <1 = 0. 5
From (3), 72(- 0.5) t 9h = 36 ⇒ 9b = 72 or b = 8
:. The req uired line is y = -0.5x + 8.
. ,,
E>.ampk 5: A ch . . l t11ll'
em1ca\ company, wishin g to study the effec t ol. t':\•(r':l(\lll
• .
l
: blt'·
. . .
the cl I1c1ency o ,· an extraction
. . 111 1
operation, obtained the data shown .Ill t he fo\lO'' Ill:-lSi' ~,~ ti
lJNTU 200.i scpI .
Extraction time minutes (x)
27 45 41 19 3 31
39 19 49 15
Eniciency (}1)
57 64 80 46 62 72 57 68
S2 77
Fit a stra ight line to the given data by the method of least squares.
495
the least squares o r strai ght line of yon y is y _
l'I. Le 1 / - Clo+ a,x
~I equation s are
· 113
JIS J1l)f l
. ~r : : Non + a, L \'
")
,1nd - ·
q 'l' :::: aoL + o,rx-
X y x2 XY
27 57 729 1539
45 64 2025 2880
41 80 168 1 3280
19 46 36 1 874
3 62 9 186
39 72 152 1 2808
19 52 36 1 988
49 77 240 1 3773
15 57 225 855
31 68 961 2 108
288 635 10274 1929 1
a0 I.x; + o 1L..Yi = ,.
- ., ... (2)
L.,\·;.r;
Substinitin g the above values in (
I) and (2) , we get
Sa0 + 10a1 = 16.9 ... (3)
1000 + 3001 = 47. \ ... (4)
Solving (3) and (4) , we get a =
0 0.72 and a 1 = 1.33
Thus the line of best fit is y = a
0 + a 1x
i.e. y = 0.72 + I .33x
.,
XI Y; xi X; Y;
0 12 0 0
5 15 25 75
10 17 100 170
15 22 225 330
20 24 400 480
25 30 625 750
75 120 1375 1805
To fi1t a stra 1.g ht 1·me o1· t I1c 1·orm y = a + bx, we have the nonn 111
al [Link] as fotll ~·
L Y, = 11a + b I, x;
... ( \ )
,
L, X;.\'; = {I L X; + b L ·< ... (2)
fittin9
curie
6a , 75h - 120
r11us ... (3)
75a+ 1375/J = 1805
Jn 1 55h = 72.2
... (4)
. lving these equations, we get
t)n ~<' ....
J J .2862 and b = 0.697 1
0
. The fitted linear fom1 is y = 11 .2862 + 0.697 lx
iiWO@I: Fit a straight line to the data given below :
- X 1
..,
J 5 7 9
- \' 1.5 2.8 4.0 4.7 6.0
-
IJNTU 2008S, (K)Jun e 2009 (Set No.3)1
Solution: Let the required straight line be y = a + a x .
0 1
5 4.0 25 20.00
~t !'o. 4)1 7 4.2 49 29.4
9 6.0 81 54
T
)
,, l II
\'I \'I-. \JI·
) 0.4 25 -2
-., ~
- 0. 1 9 - 0.3
I - 0.2 I 0.2
0 - O.J 0 0
I - OJ I - 0.3
2 0. 1 4 0.2
4 0 .4 16 0. 16
- -
rI 2 Ir-
• I
0 LX~
I
= 56 LXI-Y,-
I 2.04
~-
7o0 2a 1 = 0
... ( I )
2u0 -1 56 a1 = - 2.04
... (2)
- 2.04
Solving, u0 == -
194
= - 0.0 105
,:1nd 7
- (uo)
2
0.036~
·.1 ht· line' of bt'!>I Ii i i~ v "o I "i r
I \[Link]: IO : 0.0 I 05 0.0368 (x).
I i11ll rhc hi:~, li1t i11g strai ght line 10 th e data :
' I1~0.!II
IJNTU(A) Juue 200IJ (~"iC i,
1
!>.Ju1iu11 : I. cl J " " "1, he lhc lca, 1 "' Ilia re Iine . Ht're "' = 7 ·
l J1t' normal 1:qua 11011 !) cH\;
,,.
I
In the following table we comput e the terms req uired in nonnal equations.
r,
-
x,
- ,
•
I 'I r r, ,.,
' -
() 10 0 ()
5 14 _1"
) 70
10 19 100
--
190
15 25 225
-375-
:w 31 400 620
-
25 36 625 900
1--
-
30 39 900 11 70
-700a, = - 7I5
715
:::) u1 = - = I .02 14 .,
700 -'
(IJ::::, 7uo = 174 - IOSa, = 174 - 105(1.0 2 143) = 174 - 107.25 = 66. 75
66.75
0
o~- - - = 9.5357
7
· 1s
· The line · y = a x + a i.e., y = 9.5357 1- 1.02 1-D x
1 0
l
o
[/ \"'
ii '-l.·, +a ~ 2
I L.. x, == LX )I
' '
Fittin9
~~ . . 501
. t,·ng these values m norm al equations we ol'lt .
subsuru ' aIll
0 + I 398a2 = I 00, 80a0 + I 398a 1 + 26270
5t10 + 80 1 " 2 = 1684 ·,
+ 2627001 + 52 120202 = 30648
!398Oo
_ . 0 these equations, we get
SO 1\II 0 ::;
0
== - 8.72790 114 ~ a, = 3.009927929
n
a == - 0.0694955 14
:in d ,
The required equation is y = - 0.695x 2 + 3.0 lx - 8.728.
[,ampk 13 : Fit a second degree polynomial to the following data by the method or
least squares :
X 0 1 2 3 4
y 1 l.8 1.3 2.5 6.3
IJNTU 2008, 2008S, 2009, Nov.2009S, (A) May 2012, (K) Dec. 2015 (Set No. J)I
Solution : Let the required polynomial equation is y ::::: ar1;2 + ai-'" + a0 . The nonnal
equations are
L ·\Y; = a0 L x; + a1L x; 2 + a2 Z: x/
I, x/y; = a0 Z: x/ + a :Z:x/ + a2 Z: x/ 1
The above values are calculated by means of the fo ll ow ing table.
- )
3 4 X;-Y;
XI· X·2 X; X;Y ;
Y; I
X;
0 0
0 I 0 0 0
1.8 1.8
I 1.8 I I I
2.6 5.2
2 1.3 4 8 16
7.5 22.5
3 2.5 9 27 81
-LX; 4
:::: 10
6.3
LY;
16
Ii x/ L X;
64
3
LX;
256
4
25.2
~.\"; _\',
::: J7. l
~
100.~
- -
~ .\"I ~ .I'I
== 1JO.>
- 12.9 30 )00 - 354 -
Example 14:
l3 y ihc mdhocl nr lcasl squares fit a parabo la o f the fonn
I IJ.\" + (T · r1r the foll mvin
(
- ,..,u da ta :
:'\ . 'l -1 6 8 10
.. -
v: 3.0 7 12.X5 J 1.4 7 57. 38 ') 1.29
~
-
l,JN1ll2008,{H).Junc2011, (K).J une20 15 (SctNo. )1
4
2
Solution : 7-1,c '"'PqLiation
~
o f the 1rnrabola is Y = a + hx + c:x ... ( 1)
Norm:il equa ti ons are
I ,, = mo + h LX _._ c "i.x ~ .. . (2)
L X\' - al:.,· + h'f.x~ + cLr' .. . (3)
L.\' ~ \' = (I L\'~
, + b LX 1 + C LX4 ... (4)
y
,
.,1· -
X x~ x' Xl -~V
2 ~ 8 16 3.07 6. 14 12.28
-1 16 64 256 I 2.85 5 1.4 205.6
6 36 216 1296 3 1.4 7 188.82 1132.92
8 64 512 4096 57.38 459.04 36 72.32
10 100 1000 10000 9 1.29 9 12.9 9129
Y't = 30 ~x~ = 220 LX 1 = 1800 LX4 = 15664 Ly = 196.06 LX\' = 16 18.3 >r2 v = 141 52.12
Substituting 1he above values in (2 ), (3) and (4), we obtain
196.06 = 5a + 30b + 220c ... (5)
161 8.3 = 30a + 220b + 1800c ... (6)
141 52. 12 = 220a + 1800b + 15664c .. . ( 7)
(5) / 6 ~ 30a + 180/J + 1320c = 1176.36
(6) / I ~ 30a + 220h + 1800c = 1618.3
Subtracting -40b - 480c = - 441 .94
... (8)
(6) , _ 7.333 ~ 220a + 16 13.26/, + 13 199.4c = 11 866.99
(7) / I ~ 220a + 18001> t 15664c = 14 152. 12
79.r + 0_9922x2
Thus equation of the parabola is y == 0.7026 - 0.85
nd degree to the data noi · ·
Example IS: Fit a poly nomial of seco , . 111sg,vcn rn the folio"--
111g1,1hk:
X 0 1.0 2.0
\' 1.0 6.0 17.0 l,JNTU ( A) Dec. 20 11 , May 20 12 (Set No. -4)!
Solution : We require the qua ntitics I X;,L I x/ ,I x/, LY,. I x,v, and
2
X; ,
0 I 0 0 0 0 0
6 1 I I 6 6
1
17 4 8 16 34 68
2
1
rx. LX~ J
LX~I L.\"'·/.V·I I..r:-I . \'·I
LY; I Lr=-I I
= 9 = 17 = 40 = 7-+
= 3 ::: 24 = 5
Lsing norm al equations, we get the equations
170~ = 7-i
30u + 3a + 5a = 24 ; 3a + 5a1 + 9a 2 = 40; Sao + 9a, +
1 02
and a~ = 3 ·
Solving these equations, we get a 0 = I, a 1 = 2
· . . . . , -2 From the gi ven data pomts
Th = I + 2., + -'·' ·
.. e required polyno1111al 1s then give n by y
II rs seen th h.1s polynomial fi tting as "exact .
"
at t
• • - - • t n ~ w the foli o,, ing da1:1
• 1 h., · -
b.:11npt1: J<, • f 11 a paraboh ot the lorm \I - "
' 5 6 7
-
I 2 J 4
X )4. ➔
X V X x2 x1 X -t Xy X 2y -
1 2.3 -J 9 - 27 81 6 .9 20.7
y = a + hX + cX 2 = a + b (x - 4) + c (x - 4 )~
2
= cx -I x (b- 8c) + (a - 4b 1- t 6c)
I; I I 23
1
s2
2
Sotutio L
35.3 32.4
~ et the required polyn omta 1 e .l - •
29.2
b , - "
26. l
+ bx 1
- .
c,
.,
- ·
23.2
-
then 0
1lnal equati ons are
ty -
; - tna + bI. x . + CL x?
I I
----
~
, \" I I
X;
100 1.000 10,000 353 3,530
10 35.J
225 3,375 50,625 486 7,290
IS 32.4
400 8,000 16,000 584 11 ,680
20 29.2
625 15,625 3,90,625 652.5 .16.3 12.5
r
_) 26. 1
900 27,000 8 1,000 696 . 20,880
30 23.2
225 42,875 15,00,625 7 17.5 4,612.5
35 20.5
~
=1570.5-3877.825 = -2307.375
-2307.3 75
⇒ b= 3375 =-0.683 7
Substituting b, c in equation ( I ), we get
6a = 166. 7 - 135 (- 0.6837) + 2475 (- 0.0 )
1532
= 166.7 + 92.2995 - 37.917 =:.. 22 l.0825
⇒ a= 36.847 1
Subtracting,
- 2 10 a = - 150
a =0.7 14
Probability ~
sos ario .
J~
6 :> 42. 84 -t IO h - 6
<,O ( ().7 14) • I O />
V,.84 -> h 3.68 4
---> JOh
I - I I
u I 0
-
")
-1
0
I ")
0 0 0
I
I I ...,
'
-1
-I
4
-1
8
L-' -'1 L.1 s LX~ -6 lo ~ lb
-
~ .
- I Oh - I Oc = _ 19
> I ()/, ♦ I Uc- = 19
.... (4)