warning: Parameter 2 to gmap_gmap() expected to be a reference, value given in /home/spatiala/public_html/book/includes/module.inc on line 497.

# Fig. 5.8: Variogram for original variable, and regression residuals.

Tags: ```...
# fit a variogram (original variable):
zinc.svar <- variogram(log1p(zinc)~1, meuse)
plot(zinc.svar)
# initial variogram:
zinc.ivgm <- vgm(nugget=0, model="Exp", range=sqrt(diff(meuse@bbox["x",])^2 + diff(meuse@bbox["y",])^2)/4, psill=var(log1p(meuse\$zinc)))
zinc.vgm <- fit.variogram(zinc.svar, model=zinc.ivgm)
zinc.vgm
zinc.vgm.plt <- plot(zinc.svar, zinc.vgm, pch="+", pl=TRUE,  col="black", main="log1p(zinc)")
# residuals:
zinc.rsvar <- variogram(residuals(step.zinc)~1, meuse.ov)
zinc.ivgm <- vgm(nugget=0, model="Exp", range=sqrt(diff(meuse@bbox["x",])^2 + diff(meuse@bbox["y",])^2)/4, psill=var(residuals(step.zinc)))
zinc.rvgm <- fit.variogram(zinc.rsvar, model=zinc.ivgm)
zinc.rvgm
zinc.rvgm.plt <- plot(zinc.rsvar, zinc.rvgm, pc="+", pl=FALSE, col="black", main="Residuals")
# synchronize the two plots:
zinc.rvgm.plt\$x.limits <- zinc.vgm.plt\$x.limits
zinc.rvgm.plt\$y.limits <- zinc.vgm.plt\$y.limits
print(zinc.vgm.plt, split=c(1,1,2,1), more=TRUE)
print(zinc.rvgm.plt, split=c(2,1,2,1), more=FALSE)
dev.off()
```