## Use the Meuse River dataset from the package 'gstat'
library(sp)
library(gstat)
data(meuse.all)
coordinates(meuse.all) <- ~ x + y
X <- scale(coordinates(meuse.all))
tmp <- make.M(X)
EV <- tmp$M.eigen$values
V <- tmp$M.eigen$vectors
Y <- scale(log(meuse.all$zinc))
Q <- crossprod(Y, V)
ND <- nrow(X) - 3
f <- function(x) -x ## log-prior for exponential distribution for the smoothing parameter
## Draw 100 samples from the posterior of eta given the data y.
ETA <- sample.eta(100, ND, EV, Q, f, UL = 1000)
DELTA <- sample.delta(ETA, ND, EV, Q, pars = c(0.001, 0.001))
NU <- sample.nu(Y, ETA, DELTA, EV, V)
Run the code above in your browser using DataLab