# NOT RUN {
# }
# NOT RUN {
# generate a simple surface
x <- matrix(1:10, nrow=10, ncol=10, byrow=FALSE)
y <- matrix(1:10, nrow=10, ncol=10, byrow=TRUE)
z1 <- x + 3*y
z2 <- 2*x - y
# look at patterns
par(mfrow=c(1,2))
image(z1)
image(z2)
# analyze the pattern of z across space
z1 <- as.vector(z1)
z2 <- as.vector(z2)
z1.d <- distance(z1, "eucl")
z2.d <- distance(z2, "eucl")
space <- cbind(as.vector(x), as.vector(y))
space.d <- distance(space, "eucl")
# take partial correlogram of z2 on the residuals of z1 ~ space.d
z.pmgram <- pmgram(z1.d, space.d, z2.d, nperm=0)
par(mfrow=c(1,1))
plot(z.pmgram, pval=0.1)
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab