Generalized Least Squares (GLS)

Statistics
Introduced by
Alexander Craig Aitken
Year
1935
Type
Linear estimator

What does it do?

Generalized Least Squares (GLS) is a linear regression estimator that extends ordinary least squares to settings where the error terms are correlated or have non-constant variance (heteroscedasticity).

The estimator is associated with Alexander Craig Aitken's 1935 work; under a correctly specified error covariance matrix it is the Best Linear Unbiased Estimator (BLUE), obtained by weighting observations according to their precision. It also provides a theoretical link between OLS and linear mixed models.

The intuition behind the method

Ordinary least squares treats every observation equally, minimising the plain sum of squared residuals. When some observations are noisier than others, or when errors in different observations move together, equal weighting is inefficient and the usual standard errors can be misleading. GLS corrects for this by down-weighting observations that carry more noise and by accounting for dependence among errors. Put simply, a noisy measurement should pull the fitted line less than a precise one. When the full error covariance matrix is known, GLS has the smallest variance among linear unbiased estimators, which is why it is the reference point for linear estimation under a non-scalar error structure.

History

The estimator is named after Alexander Craig Aitken (1895–1967), a mathematician at the University of Edinburgh, and is often called the Aitken estimator. It is usually credited to his work on least squares and linear combinations of observations in the 1930s. The generalised Gauss–Markov theorem, which underlies the BLUE property, extends the ordinary Gauss–Markov result to a non-scalar error covariance matrix. Feasible GLS followed once it was recognised that Ω usually has to be estimated from data.

When to use it

Consider GLS when residuals from an initial OLS fit show non-constant error variance (heteroscedasticity) or serial correlation, as indicated by diagnostic tests or residual plots. It suits time-series regression with autocorrelated errors, panel data with group-specific variances, and settings where each observation's variance is known up to a common scale. Do not use it when the dependence arises from random effects that are better modelled directly; linear mixed models or random-effects estimators are then more appropriate. Nor should GLS be used when the error structure cannot be reasonably specified, since FGLS would then rest on an arbitrary Ω. The key assumptions are: (1) the model is correctly specified and linear in parameters; (2) Ω is known or consistently estimable; and (3) X has full column rank. BLUE status requires only the mean and covariance assumptions, not normality; exact small-sample t and F inference additionally assumes normally distributed errors. FGLS needs large samples for reliable inference, because estimating Ω adds uncertainty.

Limitations and considerations

  • Efficiency gains depend on Ω being correctly specified; a wrong covariance structure can make GLS perform worse than OLS in finite samples.
  • Feasible GLS adds an estimation stage: estimating Ω consumes degrees of freedom and makes the resulting standard errors depend on how Ω was estimated, which reduces the efficiency gains in small samples.
  • GLS is linear in parameters; by itself it does not handle nonlinear regression, binary or count outcomes, or strongly non-normal errors without further modification.
  • Inverting Ω, an n×n matrix for n observations, can be computationally demanding when the sample is large.

Source conditions do not replace independent scientific review or validation by an analysis engine.

Strengths

  • Attains the lowest variance among linear unbiased estimators when Ω is correctly specified, improving on OLS under non-spherical errors.
  • Gives valid standard errors under heteroscedastic or autocorrelated errors once the covariance structure is modelled, whereas OLS standard errors computed under the spherical assumption are not valid in those settings.
  • Nests several familiar estimators: weighted least squares (diagonal Ω), AR-corrected time-series regression and random-effects panel GLS all follow from the same general formula.
  • Provides the conceptual basis for linear mixed models, in which the covariance of the response is structured through random effects.

Applications

  • Time-series regression with autocorrelated errors (for example AR(1)), estimated with feasible GLS procedures for serial correlation.
  • Panel data with group-specific variances or cross-sectional dependence, where a block-structured Ω captures the grouping.
  • Regression with known unequal error variances, for example grouped or averaged data where each observation's variance is known up to a common scale, handled as weighted least squares with diagonal Ω.
  • Financial econometrics: regression of returns with heteroscedastic residuals, using variance-weighted estimation.
  • Meta-regression, where study-level variances are known or estimated and each study is weighted by its inverse variance.

How it works

How it works

1

GLS starts from the linear model y = Xβ + ε, but relaxes the OLS assumption that errors are independent and identically distributed. It allows Var(ε) = σ²Ω, where Ω is a known, or estimable, positive-definite matrix. Its diagonal captures heteroscedasticity (unequal error variances), and its off-diagonal elements capture serial or cross-sectional correlation.

Formula
\mathbf{y} = \mathbf{X}\boldsymbol{\beta} + \boldsymbol{\varepsilon}, \quad \mathrm{E}[\boldsymbol{\varepsilon}] = \mathbf{0},\quad \mathrm{Var}(\boldsymbol{\varepsilon}) = \sigma^2 \boldsymbol{\Omega}
2

If Ω is factored as PP′, multiplying the model by P⁻¹ gives a transformed model whose errors have covariance σ²I, which satisfies the spherical-error assumption under which OLS applies. GLS is therefore OLS applied to a re-expressed version of the data, and the factorisation is the step that makes this possible.

Formula
\boldsymbol{\Omega} = \mathbf{P}\mathbf{P}^\top \implies \mathbf{P}^{-1}\mathbf{y} = \mathbf{P}^{-1}\mathbf{X}\boldsymbol{\beta} + \mathbf{P}^{-1}\boldsymbol{\varepsilon}
3

The GLS estimator β̂_GLS = (X′Ω⁻¹X)⁻¹X′Ω⁻¹y is a weighted version of the OLS formula, with Ω⁻¹ acting as the weight matrix. Observations with lower error variance receive more influence, and correlated errors are discounted through the off-diagonal terms of Ω⁻¹. When Ω = I, the formula reduces to the OLS estimator.

Formula
\hat{\boldsymbol{\beta}}_{\mathrm{GLS}} = (\mathbf{X}^\top \boldsymbol{\Omega}^{-1} \mathbf{X})^{-1} \mathbf{X}^\top \boldsymbol{\Omega}^{-1} \mathbf{y}
4

The variance–covariance matrix of the GLS estimator is σ²(X′Ω⁻¹X)⁻¹. It is used to construct standard errors, confidence intervals and tests for the coefficients. Under the same Ω, the variance of the OLS estimator, σ²(X′X)⁻¹X′ΩX(X′X)⁻¹, is never smaller in the positive semidefinite sense; this is the efficiency result behind GLS.

Formula
\mathrm{Var}(\hat{\boldsymbol{\beta}}_{\mathrm{GLS}}) = \sigma^2 (\mathbf{X}^\top \boldsymbol{\Omega}^{-1} \mathbf{X})^{-1}
5

In practice Ω is rarely known. Feasible GLS (FGLS) replaces it with a consistent estimate Ω̂, usually built from OLS residuals: for example, by modelling the variance as a function of regressors, or by fitting an AR(1) process to residuals to handle serial correlation. FGLS is asymptotically equivalent to true GLS under suitable conditions, but its finite-sample behaviour depends on how well the error structure is specified and estimated.

Formula
\hat{\boldsymbol{\beta}}_{\mathrm{FGLS}} = (\mathbf{X}^\top \hat{\boldsymbol{\Omega}}^{-1} \mathbf{X})^{-1} \mathbf{X}^\top \hat{\boldsymbol{\Omega}}^{-1} \mathbf{y}

Common pitfalls

  • Specifying Ω incorrectly, for example assuming homoscedastic errors when the variance clearly changes with a regressor. Inspect residual plots and run diagnostics on the OLS fit before choosing the error structure. Common choices are the Breusch–Pagan or White test for heteroscedasticity and the Durbin–Watson or Breusch–Godfrey test for serial correlation. Heteroscedasticity points to a variance function (diagonal Ω), and serial correlation to an autocorrelation model such as AR(1).
  • Trusting FGLS standard errors in small samples. They can be too small because the estimated Ω is treated as if it were known; bootstrap or sandwich-type standard errors are worth considering.
  • Confusing GLS with heteroscedasticity-consistent (HC) standard errors: HC corrects the standard errors of the OLS estimates without re-weighting observations, whereas GLS changes the point estimates themselves.
  • Using GLS when the source of correlation is a random effect rather than a fixed error structure. Linear mixed models or random-effects panel estimators are more appropriate in that case.
  • Treating survey sampling weights as GLS precision weights. Design weights call for design-based variance estimation, not the GLS covariance formula.

Frequently asked questions

What is the difference between GLS and OLS?

OLS minimises the unweighted sum of squared residuals and is BLUE when errors are independent and identically distributed. GLS minimises a sum weighted by Ω⁻¹, which accounts for the full error covariance matrix Ω, and is BLUE whenever Ω is correctly specified. When Ω is a scalar multiple of the identity, GLS and OLS produce identical estimates. In general GLS is at least as efficient as OLS, and in some non-spherical cases the two coincide depending on the regressors.

What is Feasible GLS and when should I use it instead of true GLS?

True GLS requires knowing Ω exactly, which is rarely the case in practice. Feasible GLS (FGLS) estimates Ω from OLS residuals, either by modelling variance as a function of covariates or by fitting an autocorrelation structure to the residuals, and then substitutes the estimate into the GLS formula. Under suitable conditions FGLS is consistent and asymptotically efficient, but its finite-sample properties depend on how well Ω is estimated. Use FGLS when the sample is large enough to estimate Ω reliably and there is a defensible model for the error structure.

Is GLS the same as Weighted Least Squares?

Weighted Least Squares (WLS) is a special case of GLS in which Ω is diagonal, meaning errors are uncorrelated but have different variances. GLS is the more general form, which also handles correlated errors through the off-diagonal elements of Ω. Every WLS estimate is a GLS estimate, but not every GLS estimate is a WLS estimate.

How does GLS relate to linear mixed models?

Linear mixed models (LMMs) extend the GLS idea by structuring the covariance of the response through random effects. The marginal form of an LMM is a GLS-type model in which Ω is determined by the random-effects design. GLS is therefore a conceptual starting point for the mixed-model framework, although mixed-model estimation involves steps beyond the GLS formula given on this page.

Related methods

Sources

  1. Aitken, A. C. (1935). IV.—On least squares and linear combination of observations. Proceedings of the Royal Society of Edinburgh, 55, 42–48.

    Open DOI reference
  2. Greene, W. H. (2003). Econometric Analysis (5th ed.). Prentice Hall.

    ISBN: 978-0131108493
  3. Wooldridge, J. M. (2010). Econometric Analysis of Cross Section and Panel Data (2nd ed.). MIT Press.

    ISBN: 978-0262232586