# [R] gstat package. "singular" attibute

Edzer J. Pebesma e.pebesma at geo.uu.nl
Fri Jan 5 13:12:08 CET 2007

```Javier, consider two examples. First:

> library(gstat)
> 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).
--
Edzer

> 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
>
> .- 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
>
>
>

```