[R-sig-Geo] GSTAT - can a spline be used in the drift?

Zev Ross zev at zevross.com
Mon Mar 15 21:46:25 CET 2010


Hi All,

Sorry for the re-post, I didn't get an answer the first time around and 
thought I'd give it another try. I am noticing in GSTAT that if I 
include a spline as part of the drift in an external drift kriging model 
that the prediction, oddly, depends on how many observations I have in 
the "newdata" argument.

Using the meuse data as an example, you'll see that the predictions at 
the same first 5 records will be different if I include just those five 
records (second example below) or a larger dataset that includes those 
five records.

Perhaps using a spline in the drift is not supported and I should use a 
polynomial? Can anyone explain?

Zev


library(splines)
data(meuse)
data(meuse.grid)

coordinates(meuse) = ~x + y
coordinates(meuse.grid) = ~x + y

lznr.vgm = variogram(log(zinc) ~ ns(dist,3), meuse)
lznr.fit = fit.variogram(lznr.vgm, model = vgm(1, "Exp", 300,+ 1))
plot(lznr.vgm, lznr.fit)
preds<-krige(log(zinc) ~ ns(dist,3), meuse, meuse.grid, lznr.fit)
preds[["var1.pred"]][1:5] # these predictions will be different from 
those below

data(meuse.grid)
meuse.grid<-meuse.grid[1:5,]
coordinates(meuse.grid) = ~x + y
preds<-krige(log(zinc) ~ ns(dist,3), meuse, meuse.grid, lznr.fit)
preds[["var1.pred"]][1:5] # these predictions are different from those 
above

-- 
Zev Ross
ZevRoss Spatial Analysis
120 N Aurora, Suite 3A
Ithaca, NY 14850
607-277-0004 (phone)
866-877-3690 (fax, toll-free)
zev at zevross.com



More information about the R-sig-Geo mailing list