Re: [R] gstat package. "singular" attibute

From: Edzer J. Pebesma <>
Date: Fri 05 Jan 2007 - 12:12:08 GMT

Javier, consider two examples. First:

 > library(gstat)
Loading required package: sp

 > data(meuse)
 > coordinates(meuse)=~x+y
 > variogram(log(zinc)~1,meuse,width=100,cutoff=200)
   np      dist     gamma dir.hor dir.ver   id
1  52  77.01898 0.1299659       0       0 var1
2 263 156.23373 0.2091154       0       0 var1
 > v = variogram(log(zinc)~1,meuse,width=100,cutoff=200)  > vm = fit.variogram(v, vgm(1, "Exp", 100, 1)) Warning: singular model in variogram fit  > attr(vm, "singular")
[1] TRUE Here I try to fit a three-parameter model to two data (semivariance) points. Can't be done, infinite number of solutions, indicated by the singularity flag. Second example: bad initial value for range:

 > v = variogram(log(zinc)~1,meuse,width=100,cutoff=1000)  > vm = fit.variogram(v, vgm(1, "Sph", 10, 1)) Warning: singular model in variogram fit  > attr(vm, "singular")
[1] TRUE Starting with a range of 10, any combination of nugget and partial sill that fit the total sill improve the fit equally, indicated by the singularity. A larger value of the range (try 800) will lead to a good, non-singular fit.

fit.variogram does usually a non-linear regression, so any problem in that area is potentially present. You may want to consider fixing certain parameters to avoid certain problems; look at the fit.sills and fit.ranges arguments of fit.variogram.

In some cases, a singular model does fit the sample variogram nicely, e.g. where you use spherical or exponential models to effectively fit a linear semivariogram model: two parameters can be identified (nugget, slope) but three are fitted. The problem is to tell such a case from the two above, without looking at plots (i.e., automatically).


javier garcia-pintado wrote:

> Hello,
> I'm using the gstat package within R for an automated procedure that
> uses ordinary kriging.
> I can see that there is a logical ("singular") atrtibute of some
> adjusted model semivariograms:
> .- attr(*, "singular")= logi TRUE
> I cannot find documentation about the exact meaning and the implications
> of this attribute, and I dont know anything about the inner calculations
> of model semivariograms.
> I guess that the inverse of some matrix need to be calculated , and
> this matrix is singular, but I also see that the model semivariogram is
> calculated anyway.
> Could you briefly tell me something about the significance of this
> attribute and if I should not use these model semivariograms when the
> "singular" attibute is true?
> Thank you very much and best regards,
> Javier
______________________________________________ mailing list PLEASE do read the posting guide and provide commented, minimal, self-contained, reproducible code.
Received on Sat Jan 06 00:26:46 2007

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Fri 05 Jan 2007 - 13:30:25 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.