Mathwords logoMathwords

Orthogonal Regression — Definition, Formula & Example

Orthogonal regression is a way to fit a straight line to paired data by making the perpendicular distances from the points to the line as small as possible. It treats x and y symmetrically, so it suits data where both variables contain measurement error.

For data (x1,y1),…,(xn,yn)(x_1, y_1), \dots, (x_n, y_n), the orthogonal regression line y=β0+β1xy = \beta_0 + \beta_1 x minimizes the sum of squared Euclidean distances from the points to the line, ∑i=1n(yi−β0−β1xi)21+β12\sum_{i=1}^{n} \frac{(y_i - \beta_0 - \beta_1 x_i)^2}{1 + \beta_1^2}. The minimizing line passes through (xˉ,yˉ)(\bar{x}, \bar{y}). Its direction is the eigenvector of the scatter matrix (SxxSxySxySyy)\begin{pmatrix} S_{xx} & S_{xy} \\ S_{xy} & S_{yy} \end{pmatrix} for the largest eigenvalue, and the minimum sum equals the smallest eigenvalue. For a line in two variables, this method is the same as total least squares and the same as Deming regression with an error-variance ratio of 1.

Key Formula

β^1=Syy−Sxx+(Syy−Sxx)2+4Sxy22Sxy,β^0=yˉ−β^1xˉ\hat{\beta}_1 = \frac{S_{yy} - S_{xx} + \sqrt{(S_{yy} - S_{xx})^2 + 4S_{xy}^2}}{2S_{xy}}, \qquad \hat{\beta}_0 = \bar{y} - \hat{\beta}_1 \bar{x}
Where:
  • SxxS_{xx} = Sum of squared deviations of x: ∑(xi−xˉ)2\sum (x_i - \bar{x})^2
  • SyyS_{yy} = Sum of squared deviations of y: ∑(yi−yˉ)2\sum (y_i - \bar{y})^2
  • SxyS_{xy} = Sum of cross-products: ∑(xi−xˉ)(yi−yˉ)\sum (x_i - \bar{x})(y_i - \bar{y}), assumed nonzero
  • β^1,β^0\hat{\beta}_1, \hat{\beta}_0 = Slope and y-intercept of the orthogonal regression line
  • xˉ,yˉ\bar{x}, \bar{y} = Means of the x-values and the y-values

Worked Example

Problem: Both variables in the data (1, 3), (2, 4), (3, 5), (4, 10), (5, 8) were measured with error. Find the orthogonal regression line. Then compare its total squared perpendicular distance with that of the ordinary least-squares line.
Step 1: Find the means. Then find the three sums of deviations. The y-deviations are −3,−2,−1,4,2-3, -2, -1, 4, 2.
xˉ=3,yˉ=6,Sxx=10,Syy=34,Sxy=16\bar{x} = 3,\quad \bar{y} = 6,\quad S_{xx} = 10,\quad S_{yy} = 34,\quad S_{xy} = 16
Step 2: Substitute into the slope formula. Then use the centroid to find the intercept.
β^1=24+242+4(16)22(16)=24+4032=2,β^0=6−2(3)=0\hat{\beta}_1 = \frac{24 + \sqrt{24^2 + 4(16)^2}}{2(16)} = \frac{24 + 40}{32} = 2, \qquad \hat{\beta}_0 = 6 - 2(3) = 0
Step 3: The vertical gaps from the line y=2xy = 2x are 1,0,−1,2,−21, 0, -1, 2, -2. Divide their squared total by 1+β121 + \beta_1^2 to get the squared perpendicular distances. The result, 2, equals the smaller eigenvalue of the scatter matrix. The least-squares line y^=1.2+1.6x\hat{y} = 1.2 + 1.6x gives a larger perpendicular total, about 2.36.
1+0+1+4+41+22=2vs.8.41+1.62≈2.36\frac{1 + 0 + 1 + 4 + 4}{1 + 2^2} = 2 \qquad \text{vs.} \qquad \frac{8.4}{1 + 1.6^2} \approx 2.36
Answer: The orthogonal regression line is y=2xy = 2x. Its sum of squared perpendicular distances is 2, the smallest possible for any line. Its slope of 2 lies between the y-on-x least-squares slope (1.6) and the slope implied by regressing x on y (34/16=2.12534/16 = 2.125).

Why It Matters

Labs use orthogonal (Deming) regression in method-comparison studies. For example, a lab may check whether a new blood-glucose meter agrees with a reference instrument, and both instruments have measurement error. Ordinary least squares would underestimate the slope in that setting. The orthogonal line also points along the first principal component, so it is the two-variable case of principal component analysis.

Common Mistakes

Mistake: Applying orthogonal regression when x and y are in different units, such as inches and pounds, and treating the result as unit-free.
Correction: Perpendicular distance mixes the two units, so the fitted line depends on the scales you choose. Switching x from inches to feet changes the line itself, not just how its slope is labeled. Use the method when both variables share units and have similar error sizes. Otherwise, standardize the variables first or use Deming regression with a known error-variance ratio.

Related Terms