Line Fitting
Let
 |
(4.99) |
be the explicit equation of the line, with all measurement error assumed to lie along the
axis.
With error along the
axis, the cost function to be minimized is
 |
(4.100) |
The solution is the point at which the gradient of
with respect to
and
is zero:
 |
(4.101) |
that is:
 |
(4.102) |
where
is the mean of the samples
(the same notation is used for the other quantities).
The line passes through the point
, the centroid of the distribution.
This result can easily be adapted to minimize the deviation along the
rather than the
, or to represent the line equation in implicit form.
Paolo medici
2026-10-19