Skip to main content

TLS — Total Least Squares

TLS (Total Least Squares) — also called orthogonal regression — handles the case where both the regressors XX and the dependent variable YY contain measurement error (errors-in-variables). Whereas OLS only minimizes error along the YY direction, TLS minimizes the orthogonal distance from each data point to the regression line.

When to use

Use TLS when XX is measured with error. OLS then yields coefficients biased toward zero (attenuation bias); TLS mitigates this.


Intuition

OLS minimizes (YiY^i)2\sum (Y_i - \hat{Y}_i)^2 (along the YY axis); TLS minimizes the sum of squared perpendicular distances from each point (Xi,Yi)(X_i, Y_i) to the regression line.


Model specification

For the errors-in-variables model Yi=β0+β1Xi+εiY_i = \beta_0 + \beta_1 X_i^{*} + \varepsilon_i where we only observe Xi=Xi+uiX_i = X_i^{*} + u_i (with noise uiu_i), TLS estimates β\beta via the singular value decomposition (SVD) of the augmented data matrix [XY][X \mid Y].


Running in EcoLab

  1. Modeling module → Classical linear regression family → TLS.
  2. Select YY and the XX variables suspected of measurement error.
  3. Run and compare coefficients with OLS to see the attenuation correction; export the replication code.

Replication code

* ---- TLS / Errors-in-Variables Regression ----
* Load data (illustrative)
use "measurement_data.dta", clear

* Errors-in-variables regression
* r(x1 0.9) means reliability ratio of x1 is 0.9
eivreg y x1 x2, r(x1 0.9)

* Compare with OLS (shows attenuation bias)
regress y x1 x2

Limitations

  • Requires an assumption about the error-variance ratio between XX and YY.
  • If a good instrument is available, IV/2SLS is a common alternative for errors-in-variables.

Video tutorial

Video Tutorial: Running TLS in EcoLab

See also