lOMoARcPSD|52130014
Fitting OF Curve Notes - Module 3
Statistics (University of Calicut)
Scan to open on Studocu
Studocu is not sponsored or endorsed by any college or university
Downloaded by Samridhi Puri (samridhipuri11@[Link])
lOMoARcPSD|52130014
FITTING OF CURVES/ CURVE FITTING
Fitting of curve to a given bivariate data refers to finding the most appropriate
curve which fits the given data. Such a curve is called the curve of best fit. The
curve of best fit is obtained using the principle of least squares.
The principle of least squares states that the sum of squares of errors between the
observed values and the expected values should be minimum.
Consider a bivariate data (x₁,y₁) ,(x₂,y₂),...... (xₙ,yₙ). We are interested in finding
out an equation of a curve y = f(x) which shows the approximate relation between
x and y values so that the sum of squares of errors is minimum. Here x is the
independent variable and y is the dependent variable.
In the data yᵢ represents the observed value of the variable y corresponding to the
value of x , say xᵢ , i = 1,2...n .Let ye be the expected value of y .Then the error eᵢ =
yᵢ-ye , i = 1,2...n
The sum of squares of errors is given by S = 𝚺(yᵢ- ye)²
By the method of calculus S is minimum if its first derivative is 0 and the second
derivative is greater than 0. By equating the first derivative to 0 , we can find the
unknown constants in the equation y = f(x) and hence find the equation of the
curve of best fit.
Fitting of straight line
Consider the problem of fitting a straight line of the form y= ax + b to a given
bivariate data. Here we have to find out the constants a and b.
The two normal equations for finding the unknown constants a and b is obtained
using the principle of least squares.
𝑑𝑆 𝑑𝑆
By equating = 0 and = 0 we get two normal equations
𝑑𝑎 𝑑𝑏
The normal equations are
Σyᵢ = aΣxᵢ + nb
Σxᵢyᵢ = aΣxᵢ2 + bΣxᵢ
Downloaded by Samridhi Puri (samridhipuri11@[Link])
lOMoARcPSD|52130014
By solving these two normal equations we can find out a and b and hence the line
of best fit to the given data.
Fitting of parabola
Consider the problem of fitting a parabola of the form y= ax² + bx + c to a given
bivariate data. Here we have to find out the constants a ,b and c.
The three normal equations for finding the unknown constants a, b and c are
obtained using the principle of least squares.
𝑑𝑆 𝑑𝑆 𝑑𝑆
By equating =0, = 0 and = 0 we get three normal equations
𝑑𝑎 𝑑𝑏 𝑑𝑐
The normal equations are
Σyᵢ = aΣxᵢ² + bΣxᵢ + nc
Σxᵢyᵢ = aΣxᵢ³ + bΣxᵢ² + cΣxᵢ
Σxᵢ²yᵢ = aΣxᵢ⁴ + bΣxᵢ³ + cΣxᵢ²
By solving these three normal equations we can find out a ,b and c and hence the
parabola of best fit to the given data.
Problems
Q) Fit a straight line to the given data
x: 1 2 3 4 5
y : 14 13 9 5 2
Q) Fit a straight line of the form y = a + bx to the given data
x: 1 2 3 4 5
y : 35 68 100 138 170
[ Hint : Here the normal equations are
Downloaded by Samridhi Puri (samridhipuri11@[Link])
lOMoARcPSD|52130014
Σy = na + bΣx
Σxy = aΣx + bΣx2 ]
Q) Fit a parabola to the following data
X: 0 1 2 3 4
Y : 1 5 10 22 38
Fitting of curves of the form 𝒚 = 𝒂𝒃𝒙
Consider the equation
𝑦 = 𝑎𝑏 𝑥
Taking log
𝑙𝑜𝑔𝑦 = 𝑙𝑜𝑔(𝑎𝑏 𝑥 )
𝑙𝑜𝑔𝑦 = 𝑙𝑜𝑔𝑎 + 𝑙𝑜𝑔𝑏 𝑥
𝑙𝑜𝑔𝑦 = 𝑙𝑜𝑔𝑎 + 𝑥𝑙𝑜𝑔𝑏
Put 𝑙𝑜𝑔𝑦 = 𝑌 , 𝑙𝑜𝑔𝑎 = 𝐴 , 𝑙𝑜𝑔𝑏 = 𝐵
Then the equation becomes
Y= A + Bx
This is of the form of a linear equation. The normal equations for finding A and B
are given by
𝛴𝑌ᵢ = 𝑛𝐴 + 𝐵𝛴𝑥ᵢ
𝛴𝑥ᵢ𝑌ᵢ = 𝐴𝛴𝑥ᵢ + 𝐵𝛴𝑥ᵢ²
Solving these two normal equations we can find A and B
Then a = Antilog(A) and b = Antilog (B)
Substituting the values of a and b in the equation of the curve , we will get the
curve of best fit.
Downloaded by Samridhi Puri (samridhipuri11@[Link])
lOMoARcPSD|52130014
Fitting of curves of the form 𝒚 = 𝒂𝒙𝒃
Consider the equation
𝑦 = 𝑎𝑥 𝑏
Taking log
𝑙𝑜𝑔𝑦 = 𝑙𝑜𝑔(𝑎𝑥 𝑏 )
𝑙𝑜𝑔𝑦 = 𝑙𝑜𝑔𝑎 + 𝑙𝑜𝑔𝑥 𝑏
𝑙𝑜𝑔𝑦 = 𝑙𝑜𝑔𝑎 + 𝑏𝑙𝑜𝑔𝑥
Put 𝑙𝑜𝑔𝑦 = 𝑌 , 𝑙𝑜𝑔𝑎 = 𝐴 , 𝑙𝑜𝑔𝑥 = 𝑋
Then the equation becomes
Y= A + bX
This is of the form of a linear equation. The normal equations for finding A and B
are given by
𝛴𝑌ᵢ = 𝑛𝐴 + 𝑏𝛴𝑋ᵢ
𝛴𝑋ᵢ𝑌ᵢ = 𝐴𝛴𝑋ᵢ + 𝑏𝛴𝑋ᵢ²
Solving these two normal equations we can find A and b
Then a = Antilog(A)
Substituting the values of a and b in the equation of the curve , we will get the
curve of best fit.
Fitting of curves of the form 𝒚 = 𝒂𝒆𝒃𝒙
Consider the equation
𝑦 = 𝑎𝑒 𝑏𝑥
Taking log
𝑙𝑜𝑔𝑦 = 𝑙𝑜𝑔(𝑎𝑒 𝑏𝑥 )
Downloaded by Samridhi Puri (samridhipuri11@[Link])
lOMoARcPSD|52130014
𝑙𝑜𝑔𝑦 = 𝑙𝑜𝑔𝑎 + 𝑙𝑜𝑔𝑒 𝑏𝑥
𝑙𝑜𝑔𝑦 = 𝑙𝑜𝑔𝑎 +𝑏𝑥𝑙𝑜𝑔𝑒
𝑙𝑜𝑔𝑦 = 𝑙𝑜𝑔𝑎 + (𝑏𝑙𝑜𝑔𝑒)𝑥
Put 𝑙𝑜𝑔𝑦 = 𝑌 , 𝑙𝑜𝑔𝑎 = 𝐴 , 𝑏𝑙𝑜𝑔𝑒 = 𝐵
Then the equation becomes
Y= A + Bx
This is of the form of a linear equation. The normal equations for finding A and B
are given by
𝛴𝑌ᵢ = 𝑛𝐴 + 𝐵𝛴𝑥ᵢ
𝛴𝑥ᵢ𝑌ᵢ = 𝐴𝛴𝑥ᵢ + 𝐵𝛴𝑥ᵢ²
Solving these two normal equations we can find A and B
𝐵
Then a = Antilog(A) and b = 𝑙𝑜𝑔𝑒
Substituting the values of a and b in the equation of the curve , we will get the
curve of best fit.
Problems
1. Fit a curve of the form 𝑦 = 𝑎𝑏 𝑥 to the following data
x 1 2 3 4 5 6 7 8
9.1
y 1.0 1.2 1.8 2.5 3.6 4.7 6.6
2. Fit a curve of the form 𝑦 = 𝑎𝑥 𝑏 to the following data
x 1 2 3 4 5 6 7
Downloaded by Samridhi Puri (samridhipuri11@[Link])
lOMoARcPSD|52130014
y 87 97 113 129 202 195 193
Estimate y , when x = 8
3. Fit a curve of the form 𝑦 = 𝑎𝑒 𝑏𝑥 to the following data
x 1 2 3 4 5 6
y 1.6 4.5 13.8 40.2 125 300
Downloaded by Samridhi Puri (samridhipuri11@[Link])