Dear there,

I tried to compare idw and gstat in library(gstat). I specified idp as 0.5 in
both functions, I expected identical results, but what I got are different as
shown for the first five samples.  Please help. Thanks.

 

> data(meuse)

> coordinates(meuse) = ~x+y

> data(meuse.grid)

> gridded(meuse.grid) = ~x+y

> x <- idw(zinc~1, meuse, meuse.grid, idp=0.5)

[inverse distance weighted interpolation]

> as.data.frame(x)[1:5,]

  var1.pred var1.var      x      y

1  482.8753       NA 181180 333740

2  487.0065       NA 181140 333700

3  483.9747       NA 181180 333700

4  481.2115       NA 181220 333700

5  494.8720       NA 181100 333660

 

> data(meuse)

> data(meuse.grid)

> meuse.gstat <- gstat(id = "zinc", formula = zinc ~ 1, locations = ~ x + y,

+         data = meuse, nmax = 7, set = list(idp = .5))

> meuse.gstat

data:

zinc : formula = zinc`~`1 ; data dim = 155 x 12 nmax = 7

set idp = 0.5; 

~x + y

> z <- predict(meuse.gstat, meuse.grid)

[inverse distance weighted interpolation]

> z[1:5,]

       x      y zinc.pred zinc.var

1 181180 333740  626.3628       NA

2 181140 333700  645.9319       NA

3 181180 333700  629.7041       NA

4 181220 333700  615.1368       NA

5 181100 333660  682.3401       NA

 

Cheers,

 

Jin

--------------------------------------------

Jin Li, PhD

Spatial Modeller/

Computational Statistician

Marine & Coastal Environment

Geoscience Australia



Ph: 61 (02) 6249 9899

Fax: 61 (02) 6249 9956

email: jin.li@ga.gov.au <mailto:jin.li@ga.gov.au> 

--------------------------------------------




	[[alternative HTML version deleted]]


