Trend surfaces

Trend surfaces are developed by fitting low-order polynomial functions of the location variables, and then evaluating the resulting model over a grid of points.  The smoothness of the resulting surface is controlled by the order of the polynomial.  This analysis can be conveniently done using the spatial library of Venebles and Ripley

# use Venables and Ripley spatial library
library(spatial)
x <- ortann$longitude
y <- ortann$latitude
z <- ortann$elevation

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

# second-order trend surface
ctrl.data <- data.frame(x, y, z)
fit.sfc2 <- surf.ls(2, ctrl.data)
interp.sfc2 <- trmat(fit.sfc2, -124.5000, -116.8333, 42.0000, 46.1667, 30)
plot(latitude ~ longitude, main="second-order", type="n")
contour(interp.sfc2, add=T)
points(latitude ~ longitude)

# third-order trend surface
ctrl.data <- data.frame(x, y, z)
fit.sfc3 <- surf.ls(3, ctrl.data)
interp.sfc3 <- trmat(fit.sfc3, -124.5000, -116.8333, 42.0000, 46.1667, 30)
plot(latitude ~ longitude, main="third-order", type="n")
contour(interp.sfc3, add=T)
points(latitude ~ longitude)

# fourth-order trend surface
ctrl.data <- data.frame(x, y, z)
fit.sfc4 <- surf.ls(4, ctrl.data)
interp.sfc4 <- trmat(fit.sfc4, -124.5000, -116.8333, 42.0000, 46.1667, 30)
plot(latitude ~ longitude, main="fourth-order", type="n")
contour(interp.sfc4, add=T)
points(latitude ~ longitude)

# fifth-order trend surface
ctrl.data <- data.frame(x, y, z)
fit.sfc5 <- surf.ls(5, ctrl.data)
interp.sfc5 <- trmat(fit.sfc5, -124.5000, -116.8333, 42.0000, 46.1667, 30)
plot(latitude ~ longitude, main="fifth-order", type="n")
contour(interp.sfc5, add=T)
points(latitude ~ longitude)

par(oldpar)

 

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