Least Square Line
Least Square Line
Example:
Consider the linear function 𝑦 = 1.6𝑥 + 8.6 approximating the data
(−1,10), (0,9), (1,7), (2,5), ( 3,4), (4,3), (5,0), 𝑎𝑛𝑑 (6, −1) as shown in the
following table:
𝑥 𝑦 𝑓(𝑥 ) = −1.6𝑥 + 8.6 |𝑒 | |𝑒 |
𝑥 𝐴+ 𝑥 𝐵= 𝑥 𝑦
𝑥 𝐴 + 𝑁𝐵 = 𝑦
Proof:
Consider
𝐸(𝐴, 𝐵) = (𝐴𝑥 + 𝐵 − 𝑦 ) = 𝑑
where 𝑑 are the squared vertical distances of data points from the
corresponding points on least-squares line.
𝐸(𝐴, 𝐵) being function of the variables 𝐴 and 𝐵 can be minimized by putting
( , ) ( , )
and equal to zero.
i.e.
𝜕𝐸(𝐴, 𝐵)
= 2(𝐴𝑥 + 𝐵 − 𝑦 )(𝑥 ) = 2 (𝐴𝑥 + 𝐵𝑥 − 𝑥 𝑦 ) = 0
𝜕𝐴
𝜕𝐸(𝐴, 𝐵)
= 2(𝐴𝑥 + 𝐵 − 𝑦 ) = 2 (𝐴𝑥 + 𝐵 − 𝑦 ) = 0
𝜕𝐵
and
𝐴 𝑥 + 𝑁𝐵 − 𝑦 =0
Example:
Consider the data points (−1,10), (0,9), (1,7), (2,5), (3,4), (4,3), (5,0), (6, −1)
that are to be approximated by the least-squares line 𝑦 = 𝑓(𝑥) = 𝐴𝑥 + 𝐵. To
determine the coefficients A and B, following is the required table:
𝑥 𝑦 𝑥 𝑥 𝑦
-1 10.0 1 -10
0 9.0 0 0
1 7.0 1 7
2 5.0 4 10
3 4.0 9 12
4 3.0 16 12
5 0.0 25 0
6 -1.0 36 -6