data(rf.n200.dat)
Y <- rf.n200.dat$Y
coords <- as.matrix(rf.n200.dat[,c("x.coords","y.coords")])
w <- rf.n200.dat$w
n.samples <- 1000
##non-spatial regression
m.1 <- bayesLMRef(lm(Y~1), n.samples=n.samples)
##spatial regression
m.2 <- spLM(Y~1, coords=coords,
starting=list("phi"=0.6,"sigma.sq"=1, "tau.sq"=1),
sp.tuning=list("phi"=0.01, "sigma.sq"=0.05, "tau.sq"=0.05),
priors=list("phi.Unif"=c(0.3, 3), "sigma.sq.IG"=c(2, 1),
"tau.sq.IG"=c(2, 1)),
cov.model="exponential",
n.samples=n.samples, verbose=TRUE, n.report=100)
##compare
print(spDiag(m.1))
print(spDiag(m.2, start=500, thin=2))
Run the code above in your browser using DataLab