|Part of a series on
In statistics, generalized least squares (GLS) is a method used to estimate the unknown parameters in a linear regression model. It is used when there is a non-zero amount of correlation between the residuals in the regression model. GLS is employed to improve statistical efficiency and reduce the risk of drawing erroneous inferences, as compared to conventional least squares and weighted least squares methods. It was first described by Alexander Aitken in 1935.
It requires knowledge of the covariance matrix for the residuals. If this is unknown, estimating the covariance matrix gives the method of feasible generalized least squares (FGLS). This however provides fewer guarantees of improvement.
In standard linear regression models, one observes data on n statistical units with j-1 predictor values and one response value each.
The response values are placed in a vector,
The model assumes that the conditional mean of given to be a linear function of and that the conditional variance of the error term given is a known non-singular covariance matrix, . That is,
If is a candidate estimate for , then the residual vector for is . The generalized least squares method estimates by minimizing the squared Mahalanobis length of this residual vector:
The GLS estimator is unbiased, consistent, efficient, and asymptotically normal with:
Main article: Weighted least squares
A special case of GLS, called weighted least squares (WLS), occurs when all the off-diagonal entries of Ω are 0. This situation arises when the variances of the observed values are unequal or when heteroscedasticity is present, but no correlations exist among the observed variances. The weight for unit i is proportional to the reciprocal of the variance of the response for unit i.
Ordinary least squares can be interpreted as maximum likelihood estimation with the prior that the errors are independent and normally-distributed with zero mean and common variance. In GLS, the prior is generalized to the case where errors may not be independent and may have differing variances. For given fit parameters , the conditional probability density function of the errors are assumed to be,
where has been substituted for , and the optimization problem has been re-written using that the logarithm is a strictly increasing function and the property that the argument solving an optimization problem is independent of terms in the objective function which do not involve said terms.
If the covariance of the errors is unknown one can get a consistent estimate of , say , using an implementable version of GLS known as the feasible generalized least squares (FGLS) estimator.
In FGLS, modeling proceeds in two stages:
Whereas GLS is more efficient than OLS under heteroscedasticity (also spelled heteroskedasticity) or autocorrelation, this is not true for FGLS. The feasible estimator is asymptotically more efficient, provided the errors covariance matrix is consistently estimated, but for a small to medium size sample, it can be actually less efficient than OLS. This is why some authors prefer to use OLS, and reformulate their inferences by simply considering an alternative estimator for the variance of the estimator robust to heteroscedasticity or serial autocorrelation. However, for large samples FGLS is preferred over OLS under heteroskedasticity or serial correlation. A cautionary note is that the FGLS estimator is not always consistent. One case in which FGLS might be inconsistent is if there are individual specific fixed effects.
In general, this estimator has different properties than GLS. For large samples (i.e. asymptotically) all properties are (under appropriate conditions) common with respect to GLS, but for finite samples the properties of FGLS estimators are unknown: they vary dramatically with each particular model, and as a general rule their exact distributions cannot be derived analytically. For finite samples, FGLS may be less efficient than OLS in some cases. Thus, while GLS can be made feasible, it is not always wise to apply this method when the sample is small. A method used to improve accuracy of the estimators in finite samples is to iterate, i.e., to take the residuals from FGLS to update the errors' covariance estimator and then update the FGLS estimation, applying the same idea iteratively until the estimators vary less than some tolerance. But this method does not necessarily improve the efficiency of the estimator very much if the original sample was small.
A reasonable option when samples are not too large is to apply OLS, but discard the classical variance estimator (which is inconsistent in this framework):
and instead use an HAC (Heteroskedasticity and Autocorrelation Consistent) estimator. In the context of autocorrelation, the Newey–West estimator can be used, and in heteroscedastic contexts the Eicker–White estimator can be used instead. This approach is much safer, and it is the appropriate path to take unless the sample is large, where "large" is sometimes a slippery issue (e.g. if the error distribution is asymmetric the required sample will be much larger).
The ordinary least squares (OLS) estimator is calculated by:
and estimates of the residuals are constructed.
For simplicity, consider the model for heteroscedastic and non-autocorrelated errors. Assume that the variance-covariance matrix of the error vector is diagonal, or equivalently that errors from distinct observations are uncorrelated. Then each diagonal entry may be estimated by the fitted residuals so may be constructed by:
It is important to notice that the squared residuals cannot be used in the previous expression; an estimator of the errors' variances is needed. To do so, a parametric heteroskedasticity model or nonparametric estimator can be used.
Estimate using using weighted least squares:
The procedure can be iterated. The first iteration is given by:
This estimation of can be iterated to convergence.
Under regularity conditions the FGLS estimator (or the estimator of its iterations, if a finite amount of iterations are conducted) is asymptotically distributed as:
where n is the sample size, and:
where p-lim means limit in probability.