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

Luka Honzak luka.honzak at gmail.com
Mon Dec 29 22:40:08 CET 2008


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)




More information about the R-sig-Geo mailing list