Re: [S] S+ Spatial stats question

Prof Brian Ripley (
Wed, 14 Oct 1998 09:01:03 +0100 (BST)

On Tue, 13 Oct 1998, Steven I . Pousty wrote:

> Dear S+ians
> Can you please help me decipher, and hopefully correct, the following
> message...
> > elev.krige.gaus <- krige(Z~loc(X,Y), data = elev, covfun=gauss.cov,
> + range = 90, sill = 115)
> Error in .Fortran("ssukrige",: Covariance matrix is not positive
> definite
> Dumped
> Warning messages:
> Covariance matrix is not positive definite in: .Fortran("ssukrige",
> ..
> .
> I can get krige to work for a spherical model, but not for the
> gaussian. Is this a problem with a large matrix (over 900 elements in
> the elev data set) in S+?

I don't think so. It is a problem with the data configuration. The
Gaussian covariance has high-order contact at the origin, so for small
distances the correlation is very near one. This can easily result in a
covariance matrix that is numerically singular. There is an example of
this in V&R, and the solution is also there, to add a small nugget effect.

The current V&R spatial library tries harder than module spatial to avoid
this problem (AFAIK about krige) and certainly succeeds in some problems
where krige fails. However, the error is indicating a failure of the
assumptions behind the method, and either the Gaussian model is
inappropriate or you have essentially duplicated observations. A nugget
effect corresponds to allowing for measurement error.

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

----------------------------------------------------------------------- This message was distributed by To unsubscribe send e-mail to with the BODY of the message: unsubscribe s-news