Analysis of Spatio-Temporal Data - Exercise 06

Christopher Stephan

1. For log(lead) in data set meuse, package sp, compute the variogram cloud (function variogram in package gstat, look up parameter cloud). Plot the variogram cloud.

How many points does this variogram cloud show?

library(sp)
library(gstat)
data(meuse)
coordinates(meuse) = ~x + y
plot(variogram(log(lead) ~ 1, meuse, cloud = TRUE))

plot of chunk unnamed-chunk-1

points = (variogram(log(lead) ~ 1, meuse, cloud = TRUE))
dim(points)
## [1] 6883    6

The cloud contains 6883 points.

How many could it show maximally?

For a single point shown in the variogram cloud, how are the x and y coordinates in the plot computed?

http://www.youtube.com/watch?v=SJLDlasDLEU

Task 2

How is a sample variogram computed from the variogram cloud? Carry this out for the log(lead) variable in meuse.

plot(variogram(log(lead) ~ 1, meuse))

plot of chunk unnamed-chunk-2

Task 3

Fit a variogram model to the log(lead) sample variogram, and carry out an ordinary kriging for this variable, on the grid cells of meuse.grid.

data(meuse.grid)
gridded(meuse.grid) = ~x + y
lead.variogram = variogram(log(lead) ~ 1, meuse)
lead.model = fit.variogram(lead.variogram, vgm(0.6, "Sph", 1000, 0.05))
ok <- krige(log(lead) ~ 1, meuse, meuse.grid, model = lead.model)
## [using ordinary kriging]
spplot(ok["var1.pred"], main = "Ordinary Kriging Predictions")

plot of chunk unnamed-chunk-3

spplot(ok["var1.var"], main = "Ordinary Kriging Variance")

plot of chunk unnamed-chunk-3

Task 4

Explain how the variogram informs about the strength of autocorrelation.

The slope of the model indicates the strength of autocorrelation.

Explain how the variogram informs about the distance up to which autocorrelation is present.

When you look at the model of a semivariogram, you'll notice that at a certain distance, the model levels out. The distance where the model first flattens out is known as the range. Sample locations separated by distances closer than the range are spatially autocorrelated, whereas locations farther apart than the range are not.