[R-sig-Geo] Residual variogram from known trend

Tom Gottfried tom.gottfried at wzw.tum.de
Mon Apr 4 14:02:45 CEST 2011


Dear list,

is there a way in gstat to calculate a variogram from residuals of a known trend (that can not be 
estimated from the data) without passing the residuals to variogram() or gstat()? I tried the 
arguments trend.beta respectively beta. The first one gives an error, the second gives the same 
result as when I do not give it:

library(gstat)
data(meuse)
# trying with variogram(..., trend.beta=...)
var1 <- variogram(zinc~sqrt(dist), ~x+y, meuse)
var2 <- variogram(zinc~sqrt(dist), ~x+y, meuse, trend.beta=c(1000, -1000))

# trying with gstat(..., beta=...)
coordinates(meuse) <- ~x+y
meuse1 <- gstat(NULL, "zinc", zinc~sqrt(dist), meuse)
var1 <- variogram(meuse1)
meuse2 <- gstat(NULL, "zinc", zinc~sqrt(dist), meuse, beta=c(1000, -1000))
var2 <- variogram(meuse2)
identical(var1, var2) # both variograms are identical

I see it's possible to calculate the residuals with

residuals(lm(zinc~sqrt(dist), meuse))

and pass them directly. But I wonder whether a more convenient direct passing of the trend 
coefficients is possible.

Thanks!
Tom

-- 
Technische Universität München
Department für Pflanzenwissenschaften
Lehrstuhl für Grünlandlehre
Alte Akademie 12
85350 Freising / Germany
Phone: ++49 (0)8161 715324
Fax:   ++49 (0)8161 713243
email: tom.gottfried at wzw.tum.de
http://www.wzw.tum.de/gruenland



More information about the R-sig-Geo mailing list