# Re: kriging with gauss.cov

Prof Brian Ripley (ripley@stats.ox.ac.uk)
Thu, 15 Jan 1998 07:41:53 GMT

> To: s-news@utstat.toronto.edu
> Subject: kriging with gauss.cov
>
> Dear colleagues.
>
> Please could anyone suggest where I have gone wrong with the following:
>
> S-PLUS : Copyright 1988, 1995 MathSoft, Inc.
> Version 3.3 Release 1 for MS Windows 3.1 : 1995
> Working data will be in _Data
> > tacia.lon4.krige_krige(ozone~loc(lat.m, height), data=lon4,
>
> covfun=gauss.cov,
> + range=1480, sill=73.75, nugget=0.0)
> Error in .Fortran("ssukrige",: Covariance matrix is not positive definite
> Covariance matrix is not positive definite in: .Fortran("ssukrige", ....
> Dumped
> Error was while calling subroutine "ssukrige"
> >
>
You are using S+SpatialStats, although unhelpfully you did not say so.
I am posting an answer, since I think this is not in the manual but
is of wider interest.

(a) You have coincident points. With your specified covariance, the
observations would have correlation one, and should have identical
values. Omit all by one.

or

(b) You have points so close together compared to the range that the
correlation is numerically one or very close to it. This can easily
happen for a Gaussian, since the correlation is approximately 1 -
(x/r)^/2, and a distance of 1% of the range might do it. The answer in
this case is to first try increasing nc (to 10000, say, as the
covariance is approximated internally and this improves the
approximation) and if that does not suffice, add a small nugget
effect.

The predicted surfaces from a Gaussian covariance are _very_ smooth,
and it would unusual for this to be appropriate. A small nugget effect
amounts to admitting to measurement error.

The S+SpatialStats code appears to be based closely on that in
Venables & Ripley: the same comments apply to my code and there is
even an example of this warning and the fix in our book!

Brian Ripley