Professional Documents
Culture Documents
PS CH1,2,3
PS CH1,2,3
PS CH1,2,3
1 Introduction
In practical statistics, we come across many situations where we often require to
find a relationship between two or more variables.
➔ For example, weight and height of a person, demand and supply, expenditure depends on
income, etc.
These relations, in general, may be expressed by polynomial or they may
have exponential or logarithmic relationship. In order to determine such relationship,
first it is require to collect the data showing corresponding values ofthe variables
under consideration. Suppose
. ... (2.1)
be the data showing corresponding values of the variables x and y under
consideration. If we plot the above data points on a rectangular coordinate system,
then the set of points so plotted fonn a scatter diugram . From this diagram, it is
sometimes possible to visualise a smooth curve approximating the data. Such a
curve is called an approximating curve.
In particular, if the data approximate well to a straight line, we say that a
linear relationship exists between the variables. It is quite possible that the relationship
may be nonlinear. Thus, the general problem offinding a functional relationship of
the fonn y = f (x) between two variables x and y, giving the approximating curve
and which approximately fit the given data (2.1) of x and y, is called curvefitting.
The fitting ofcurves to a set of numerical data is ofconsiderable importance
from theoretical as well as practical statistics point ofview. Theoretically, it is useful
in the study of correlation and regression (lines of regression can be regarded as
fitting oflinear curves to a giveri bivariate frequency or probability distributions). In
practical statistics, curve fitting enables us to represent a close functional relationship
between two variables by polynomials, exponentials or logarithmic functions using
the principle ofleast squares.
43
•
Ch .2 Cu rve Fit ting
res
2. 2 Th e I\f et ho d of L-ea s t Sq ua
st-fit cu ne of a giv en 1:. pe that
ha s the
lea st sq ua res ~s um e-- the be
'I he me th od of en set 01
ns (least sq ua re err or) fro m a gn
the deviatio
mi nim um su m of the sq ua re of
dJ ta.
int s are (x • y1 ). (x 2 • y 2 ) ••. .• Cr,,
• Y11 ) • \\ here
Su pp os e tha t the da ta po 1
L me = a + b:c
•
•·· ... ···· • ··-·· ·
f}; __ _D eviation d.I
~
·-·· ···· ·-- ···- ···- ··· . .••••...••. .
. .. :(x , •\ I J •
• • I
•
• •
•
For the general point (x, , y1 ) , if the vertical distance of this point from the
d '- =v
· I
--f(x.I )=J·I -a-br-
·1 ·
dD 11
-=0 ⇒ -2L (y;-a-bx;)=O,
da i=l
dD 11
- =0 ⇒ -2L x .(y . -a-bx.)=O.
ab .
1=1
l l
I
II II ? ll
L X; Y; =a L X; + b L x.-
1 '
i=l i=l i=l
which implies
n n
L Y; = an+ b L X; , ... (2.2)
i=l i=l
ll n 11 _
L x.I·v.L =a L x,. +b L x.I 2 • ... (2.3)
i=l i=l i=l
Equations (2.2) and (2.3) are known as normal equations or least square
eqr,ations. From these equations, we have
45
d
,
... (2.4)
.. .(2.5)
Exa111ple 2.1
Using method ofleast squares, find the best fitting straight line to the following data.
., I 2 3 4 5
3 5 6 5
Solution
Here.11 = 5. Let Y =a+ bx be the required straight line fit. In order to find a and b,
let us lirsl calculate the following table.
X-
I Y; x.2
X;Y;
I
(x1) 1 (y,) l l 1
(x2 )2 (y2)3 4 6
(X3) 3 (y3) 5 I 9 15
(x4 )4 (y4)6 16 24
(x )5
5 <Ys)S 25 25
L l5
55 71
Using (2.4).
5 5
X; l: X·Y·
. l l
l=l
46
Ch.2 Curve Fitting
<'Vi)(2C, J - (J 5)(7))
~-
(5)(55) - (15) 2
=0.7.
Using (2.5).
b=
(5)( _-i X Y;
t=I
1 -( t
t=l
X; [ _t Y;
t=l
cs{!/)-(t xJ
_ (5)(71)- (15)(20)
(5)(55) - o5)2
= l.l.
Therelore, the best fitted straight line is
y = a+bx = 0.7+1.l.x. Answer
The following Figure 2.2 shows plot of the given data and the corresponding fitted
straight line.
\'
7
y = 0.7+1.lx
6 (4,6)·
5 (3,5) • •(5,5)
3
,,
• (l,l)
X
0 2 3 4 5 6
Figure 2.2
47
■
Ch.2 Curve Fitting
.
2.2. 2 Fitting of a Second Degree Curve Suppose th e equation of a second
-----
degree curve of the form y =a+ bx+ cx2 is to be fitted to then-data points
n n
~ ; Ix. 4 ... (2.8)
/-- ~';:C.'.j;~· =J •=l l •
Example 2.2
l '~i ng method of least squares, find the best fitting second degree curve to the
toJlowing data.
.r l 2 3 4
\' 6 11 18 Zl
Solution
Here, 11 = 4. Let Y =a+ bx+ cx7. b,c.th" • 0
~ ~uired second degree curve. In order t
find a, b, c, Jet us firstcalculatetbc f~table.
48
Ch .2 Curve Fitting
\ \'. 1
I \"- x .3 2
. I . I x.4 X;Y;
I I X; Y;
6 l 1 1 6 6
-1
ll 4 8 16 22 44
·'" 18 9 7J 81 54 162
-+ Tl 16 M 256 100 432
'- 10 (Q X) 100 3.54 lSX) (M
Using t2.6) - (2 .8 ),
62 = 4a +1 0b +3 0c
190 = 10 a+ 30 b+ 100c
64 4 = 30a + 1OOb + 354c
H) pa11ial ph oting pro ced ure , the giv
en system can be rewritten as
30 a + 100b + 354c = 644
1Oa + 30b + 100c = 190
4a + l0b + 30c = 62
Th e aug me nte d matrix is
30 100 354
: 64
10 30 100 : 1904]
[ 4 10
30 : 62
Op era tin g R (1/2), R/1 12 ), R/1 12 ),
1 we get
. [15 50 177 32 2]
~ 5: 15 50 95
2 5 15 31
Operating R /-1 /3 ), R /-2 /15 ), we get
1 1
-
rs
0
\ 50
_1
I] 32 2
_3 7
3 3
0 _1 _ 129 _1 79
3 15 15
Operating R /-l ), we get ·
2
15 50 177 322
0 _i - 9 _3 7
3 3
0 0 2 2
5 5 49
Ch.2 Curve Fitting
By back substitution
-
'
2 2
- c=- ⇒ c=l.
5 5
5 37 5 b 9(1) - - 37
- 3 h - 9c = -3 ⇒ - 3 - - 3
⇒ - 5 b=-~+9
3 3
5 10
⇒ -·- b=--
3 3
⇒ b=2.
., .. (2.9)
50 ... (2.10)
Ch.2 Curve Fitting
From the above equat ions, A, B can be found and conse quent ly
a= anti log A, b = B
log10 e
can be calcul ated, which on substi tuting in the equati on of an expon ential curve
y = aebx , the requir ed best exponential fit to the given data is obtained.
Note One can simila rly fit the curve y = abx.
X; Y; Y; = log 10 Y; x .2 X;Y;
I
0 5.012 0.70 0 0
., IO I 4 2
➔ 31 .62 1.50 16 6
I 6 32 ~ 8
b= B z 0. 2 z 0.46.
log10 e 0.4343
Therefore, the best fitted exponential c_urve is
51
"" C~ h~ .2~ c~ u' -!! .rv ,~ e~ F1
-
~· tt~ in ~g ~- --- --- --- --- --- ---
6
-----
-
Answer
\' = 4.68 e 0 .4 x ·
g of a Ge om etr ic (P~we r) Cu rve Sup pose th e geometric curve of the
2.2.4 Fittin
nd and consequently
From the above equations,A, b can be fou
a= ant ilo gA
ofa and bin the equation of a geometric
can be calculated. Substituting these values
ve = axb , the required bes t geome tric fit to the given data is obtained.
cur y
Ex am ple 2.4
52
j
Ch.2 Cur ve Fitting
Solution the
Here. 11 = 5. Let y = a+ bx be the required straight line fit. Let us first calculate
following table.
X -2() ()5 XI.Y.I
X I. = I
X _2
I
X; •VI
-2 4 -70
2003 ~
-1
- 56 53
2004 56
Ch.2 Curve Fitting
2005 79 0 0 0
XXX> a) 1 I a)
'200"1 «> 2 4 a)
'\'
,_ ~ 0 IO 34
l.J~mg e4uations (2.2) and (2.3),
5a+Ob=290 .,.(i)
Oa+ lOb = 34 ... (ii)
Sol\ ing these equations. we gel
_ 34 _
a = -290 = -58 and b - - - 3.4 .
10
5
Therefore. the best fitted straight line is
y =a+bX =58+3.4X.
Replacing Xby (x-2005), we get
y = 58+3.4(x-2005)=- 6159+3.4x. Answer
2.3 Short Questions
Exa,nple 2. 6
Define curve fitting. [GTU, M ay 2016]
Solution
The process of finding the equation of the curve of best fit to the given data points,
which may be most suitable for predicting the unknown values, is known as curve
fitting. Answer
Example 2.7
Whal is meant by the curve of best fit?
[GTU, June 2017- Comp.]
Solution
The curve of best fit is that curve for which the sum of squares of errors is minimum.
Answer
.
R t·\ ll'W L, • • ,\
.~
r.Xt.'lTIS(.'S
54
Jl
Ch.2 Curve Fitting
U2. I ll •' !>tr.11ght line to the following data. Using this equation find the value of Y
,,. hen x = 2.4.
.\ l 2 3 4 5 6 7
y 05 25 2.0 4.0 35 6.0 55
[GTU, May 2017)
03. It' P 1s the pull required to lift a load W by means of a pulley block, find a linear
approximation of the form P =mW+ c connecting P and W, using the following data.
P 13 18 23 27
iv 51 75 102 119
[GTU, Jttne 2017-Comp.]
~ Fit .t -.econd degree curve to the following data.
x l 2 3 4 5 6 8 7 9
,, 2 6 7 8 10 1111 10 9
05 Fit a least square geometric curve y = a/' to the following data.
x l 2 3 4 5
y 05 2 45 8 125
06. Fit a second degree parabola y =a+ bx+ er
to the following data.
X 1.0 15 2.0 25 3.0 35 4.0
y 12 1.4 1.9 2.4 2.8 3.3 42
[GTU, June 2017 - Comp.]
Answers
Review Exercises
01. _r = l.6+1.2x 02. y=0.0714+0.8392x, y(2.4)=2.0854.
03. P=0.2309 W+0.2186. 04. y = -0.2673x2 + 3.523x-0.9283 05. a= 0.5012, b = l.9977
55