Re: Generalized least squared model with known covariance matrix

Prof Brian Ripley (
Sat, 17 Jan 1998 07:02:58 +0000 (GMT)

Jim Robison-Cox wrote:
> On Thu, 15 Jan 1998, Ba Pham wrote:
> > I try to fit a GLS model in which the responses are correlated with a
> > knonw covariance matrix, hence I need to sandwich the covariance
> > matrix into the normal equation. Wonder how that can be done with the
> > existing procedures in Splus version 3.3 for Windows.
> OLS assumes:
> y = X * b + e where var(e) = sigma^2 * I, an n by n identity
> GLS assumes var(e) = sigma^2 * V where V is symmetric positive
> definite, known.
> We can decompose V into U * U' and take T = inverse of U
> Then var(T * e) = sigma^2 * T * U * U' * T' = sigma^2 * I
> so the transformed model:
> T*y = T * X * b + T * e can be fit with OLS
> There are several ways to find T. One is:

I sent a private reply. As an outline has been posted, I'll point out
publicly that there is code to do this in the on-line answers to V&R2. It
uses the eigen decomposition to find T, which is a little slower then
Choleski, but stabler with ill-conditioned T. Also, most commonly GLS is
given in terms of a weight matrix W, where W = (sigma^2 * V)^{-1}, and
that occurs naturally in several applications. With an eigendecomposition
the extra code needed to allow W or V to be specified is trivial (and our
lm.gls does so).

As a side point, if the sigma^2 is known (which is how I interpret the
question) many of the lm methods (e.g. summary) will use s^2, so will
need alteration.

Brian D. Ripley,        
Professor of Applied Statistics,
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272860 (secr)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595