The least-squares procedure discussed in Section 5.2 was based on the assumption that all the uncertainty could be assigned to one parameter, the "dependent" parameter. If the dependent and independent variables are interchanged, the resulting fit to a set of measurements will be different in most cases. This distinction becomes particularly important for the "regression" analyses to be discussed in the next chapter. However, it is often desirable to consider two measurements on an equal basis, e.g., when comparing two similar instruments without assuming either is the standard.
The following fit procedure will determine the best-fit line that minimizes the distance of a set of measurements, in a least-squares sense. Figure 5.1 shows the distance to be minimized. The following assumes for simplicity that the uncertainties are the same for the two instruments; if that is not the case, these formulas can still be used for new variables scaled to make the uncertainties equal.

If the line is described by y=y0+bx, the distance from point (xi,yi) to the line is
| (5.58) |
Proof: See Fig. 5.2. Let A be the vector with components
( xi,yi-y0).
If the slope of the line is b, the unit vector B perpendicular
to the line has components (
,
),
[note 7/7/2000: error here, last radical should be \sqrt{b^2+1}, not \sqrt{b^2-1}]
as can be verified by checking that the dot product of this vector with
a vector (1,b) along the line is zero. The distance d of
a point (xi,yi) from the line is then
A
B,
giving (5.58).

The appropriate chisquare function then is
| (5.59) |
or, if
and
,
| (5.60) |
where
.
The least-squares fit then satisfies the requirement that
| (5.61) |
or
| (5.62) |
However, by their definitions,
and
are zero, so the best-fit value is
.
Then,
| (5.63) |
or
| (5.64) |
| (5.65) |
In (5.65), if
,
b = 0 (unless
,
in which case all values of b provide equally good fits). This suggests
defining new coordinates
and
,
rotated from
and
by an angle
selected to give
and hence
.
For a rotation by
,
| (5.66) |
| (5.67) |
Then
| (5.68) |
or
| (5.69) |
so that the required rotation angle
is specified from
| (5.70) |
Because in these coordinates
=0,
b=tan(
),
so (5.70) determines the slope of the best-fit line.
In applications, an ambiguity arises because
,
so there are multiple solutions to (5.70) differing by
.
As a result, there are two solutions for b corresponding to
and
.
An easy way to resolve this ambiguity is to choose the value of b
with the same sign as the correlation coefficient for correlation between
x and y.
With respect to the original coordinates, the result is that the best-fit line is specified by
| (5.71) |
where
| (5.72) |
and
| (5.73) |
Bevington, P. R., 1969: Data Reduction and Error Analysis for the Physical Sciences. McGraw-Hill, New York, 336 pp.
Brownlee, K. A., 1965: Statistical Theory and Methodology in Science and Engineering. John Wiley and Sons, New York, 590 pp.
Press, W. H., Brian P. Flannery, S. A. Teukolsky, and W. T. Vetterling, 1992: Numerical Recipies in C. Second Edition, Cambridge University Press, Cambridge, 735 pp.