[R-sig-Geo] GSTAT - singular in meters not km

Edzer Pebesma edzer.pebesma at uni-muenster.de
Thu Dec 11 15:24:07 CET 2008


Zev, if you do a

v.fit<-fit.variogram(v, vgm(0.0005, "Sph", 40000, 0.00001),debug.level=32)

you'll see that the X matrix of the Gauss-Newton iteration with the 
derivatives of the parameters to the error sum of squares is nearly 
singular. The condition number of this matrix is so large that it makes 
the problem ill-conditioned. If you add argument fit.ranges=FALSE it 
will not be singular anymore.

In the end, this problem is similar to e.g. regression of polynomials on 
coordinates without standardizing the coordinates.

I'll add a warning message to fit.variogram to suggest the two 
solutions, for this case.
--
Edzer

Zev Ross wrote:
> Edzer (and all),
>
> I don't think that it's related to an unrealistic range. I've tried a 
> lot of different realistic and non-realistic values and get singular 
> results each time. If I divide the X and Y coordinates by 10, 100, 
> 1000 or 10000 I don't get singularity. Using Lat and Long works fine. 
> Code is below and I included a link to a workspace with the "pol" data 
> set at the bottom.
>
> Zev
>
> polA<-pol
> coordinates(polA)<-~x+y
> v<-variogram(pollutant~1, data=polA)
> v.fit<-fit.variogram(v, vgm(0.0005, "Sph", 40000, 0.00001))
> attributes(v.fit)$singular # TRUE
>
> polB<-pol
> polB$x<-polB$x/1000
> polB$y<-polB$y/1000
> coordinates(polB)<-~x+y
> v<-variogram(pollutant~1, data=polB)
> v.fit<-fit.variogram(v, vgm(0.0005, "Sph", 40, 0.00001))
> attributes(v.fit)$singular #FALSE
>
> polC<-pol
> coordinates(polC)<-~longitude+latitude
> v<-variogram(pollutant~1, data=polC)
> v.fit<-fit.variogram(v, vgm(0.0005, "Sph", .4, 0.00001))
> attributes(v.fit)$singular # FALSE
>
> http://www.zevross.com/temp2/singular_or_not.RData
>
> Edzer Pebesma wrote:
>> Hi Zev, it is hard to see what happens without seeing your data or R 
>> commands.
>>
>> Is it possible that you passed an unrealistic value for the range 
>> parameter, as starting value for the variogram model argument of 
>> fit.variogram?
>> -- 
>> Edzer
>>
>> Zev Ross wrote:
>>> Hi All,
>>>
>>> I'm fitting variograms in GSTAT with fit.variogram and I was 
>>> surprised to find that all my fits were singular. I experimented 
>>> with converting the data to unprojected data (decimal degrees) and 
>>> with dividing my X and Y coordinates, which are in meters, by 1000 
>>> (to get KM). In both cases the fitting procedure worked with no 
>>> singularity. Based on the numbers of pairs the bins appeared to be 
>>> about the same so it appears to be a matter of the coordinates 
>>> themselves.
>>>
>>> I'd prefer not to have to convert the coordinates back and forth 
>>> between meters and KM, any suggestions?
>>>
>>> Zev
>>>
>>> _______________________________________________
>>> R-sig-Geo mailing list
>>> R-sig-Geo at stat.math.ethz.ch
>>> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>>
>

-- 
Edzer Pebesma
Institute for Geoinformatics (ifgi), University of Münster
Weseler Straße 253, 48151 Münster, Germany. Phone: +49 251
8333081, Fax: +49 251 8339763 http://ifgi.uni-muenster.de/
http://www.springer.com/978-0-387-78170-9 e.pebesma at wwu.de




More information about the R-sig-Geo mailing list