Kriging

Kriging is related to trend surface analysis except (as Venebles and Ripley show), an explicit "covariance structure" of the residuals of the model is included in the model specification in the surf.gls() function, where the form of the covariance structure is determined by inspecting the spatial correlogram and variogram of the variable being contoured.

# Kriging
library(spatial)

oldpar <- par(mfrow = c(2, 2))

# variogram and covariogram ls
fit.ls1 <- surf.ls(2, ctrl.data)
sar <- 0.7
nl <- 25
correlogram(fit.ls1, nl)
xd <- seq(0, 8, 0.1)
lines(xd, expcov(xd, sar))
variogram(fit.ls1, nl)

# variogram and covariogram gls
d <- 0.7
fit.gls1 <- surf.gls(2, expcov, ctrl.data, d=0.7)
nl <- 25
correlogram(fit.gls1, nl)
xd <- seq(0, 8, 0.1)
lines(xd, expcov(xd, d))
variogram(fit.gls1, nl)

# model fitting and contouring
ctrl.data <- data.frame(x, y, z)
fit.kr2 <- surf.gls(4, expcov, d=50.0, ctrl.data, nx=100)
interp.kr2 <- trmat(fit.kr2, -124.5000, -116.8333, 42.0000, 46.1667, 30)
plot(latitude ~ longitude, main="Kriging", type="n")
contour(interp.kr2, add=T)
points(latitude ~ longitude)

par(oldpar)

 

[back to topics and examples] [Geog 4/517] [Geog. 4/517 lectures]