270 The Basics of financial economeTrics
points on the line. In this case, the sum for a generic a and b can be writ-
ten as:
()()()
()()()
()()
()()
= −−× + −−× + −−×
+ −−× + −−× + −−×
+ −−× + −−×
+ −−× + −−×
S.ab .ab.ab.ab.ab .ab.ab.ab.ab.ab07 0.81 31 .8 11 2.9
17 4.21 65 .5 14 6.7
16 7.41 78 .1
21 9.22 4 10.6
2222222222It is possible to find the value that minimizes the above expression ana-
lytically by equating to zero the partial derivatives of S:
∂
∂=
∂
∂
=
S
aS
b00
However, commercial econometric software uses iterative programs
that find the minimum of S by an iterative searching procedure. For
example, we can perform the above operation in MATLAB using the polyfit
0 2 4 6 8 10 12
00.511.522.5xyFigUre 13.2 Scatterplot of Sample Data and the Plot of the Straight Line
y = 0.05 + 0.1x