[R-sig-Geo] Different variogram fitting results from gstat in R than from standalone gstat

Edzer Pebesma edzer.pebesma at uni-muenster.de
Tue Dec 30 12:05:29 CET 2008


Luka, this is hard to tell from here. The first thing I would try to 
find out is whether the sample variograms from both approaches are 
_exactly_ the same or not. For one thing, the X=x&y&xy in gstat 
stand-alone does standardize coordinates, the formula approach in 
R/gstat does not.

Maybe follow-up on the gstat-info list?
--
Edzer

Luka Honzak wrote:
> Hi everyone,
>
> I am trying to move my work from standalone gstat to R and I found
> that variogram fitting gives different results in R than in standalone
> gstat, while variograms are the same.
> I want to know if I have done something wrong in R and what.
>
> *gstat:
> -set fit = 7; 6.56882 Nug(0) + 584.336 Sph(27110.8)
> -set fit = 1; 156.687 Nug(0) + 444.965 Sph(35817.8)
> *R:
> -fit.method=7
>  model      psill    range
> 1   Nug   3.027124     0.00
> 2   Sph 593.518692 27282.76
> -fit.method=1
>  model    psill    range
> 1   Nug 287.9900     0.00
> 2   Sph 354.8136 55421.58
>
>
>
> *gstat commandline file:
> data(RR): 'gstat_2000_5_NV.txt', x=1, y=2, v=4, X=x&y&xy;
> variogram(RR): 70 Nug(0) + 600 Sph(30000);
> set fit = 7;
> set cutoff = 150000;
> set width = 6000;
>
>
> *R code:
> library(gstat)
> table=read.table("gstat_2000_5_NV.txt")
> colnames(table)<-c("x","y","z","RR")
> g <- gstat(id = "test", formula = RR~x+y+x*y, locations = ~x+y, data = table)
> m <- vgm(600, "Sph", 30000, 70)
> v.fit <- fit.variogram(variogram(g), m, fit.method=7)
>
> _______________________________________________
> 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