## 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
M <- tmp$M
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.
sample.eta(100, ND, EV, Q, UL = 1000, f)
Run the code above in your browser using DataLab