[R-sig-Geo] distances reported by gstat when cokriging

Edzer Pebesma edzer.pebesma at uni-muenster.de
Fri Mar 16 15:12:42 CET 2012


Tom, right, it is. If you specify nmax=9 for the second variable, you
see the dist values for the second as well. They are indeed not computed
in your case, as the selection can be copied. Apparently these things
mattered when I wrote the code 20 years ago!

When you say, "Is there a way to get the distances for the second
covariate?", do you mean, as R object?

On 03/16/2012 02:53 PM, Tom Gottfried wrote:
> Dear list(en)ers,
> 
> I wonder what the "dist" is, which is in the output of predict.gstat()
> with debug.level=16. I expect it to be the distance between the
> coordinate pair given in the same line and the prediction location. I
> verified this for the coordinates and distances given for "data id: 0"
> in the below example (and its true), but for "data id: 1" it's always
> "dist: 0". Is there a way to get the distances for the second covariate?
> I see it's simple in the example, because data are colocated, but the
> problem arose in a case with non-colocated covariates.
> Here's the example:
> 
> library(gstat)
> data(meuse)
> coordinates(meuse) <- ~x+y
> variog <- variogram(zinc~1, meuse)
> varmod <- fit.variogram(variog, vgm(150000, "Exp", 1000))
> data(meuse.grid)
> coordinates(meuse.grid) <- ~x+y
> g <- gstat(NULL, "z", zinc~1, meuse, model=varmod, nmax=10)
> g <- gstat(g, "dist", I(dist*1000)~1, meuse, nmax=10)
> variog.g <- variogram(g)
> g <- fit.lmc(variog.g, g, vgm(100000, "Exp", 500, 1000))
> meuse.point <- meuse.grid[sample(1:nrow(meuse.grid), 1),]
> predict(g, newdata=meuse.point, debug.level=16)
> 
> Thanks!
> Tom
> 

-- 
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.52north.org/geostatistics      e.pebesma at wwu.de



More information about the R-sig-Geo mailing list