Below is code that shows how to estimate a spatial model without using the
spatial.exp function in an equivalent way to using that function (assuming
kappa=1). Can someone show me BUGS code that is equivalent to the
spatial.unipred function? Thanks.
model
{
### Likelihood Definition
for (i in 1:N)
{
### Stochastic Component
Y[i] ~ dnorm(mu[i], tau.resid)
### Deterministic Component
mu[i] <- beta + S[i]
}
### Spatial
for (i in 1:N)
{for (j in 1:N) {H[i,j] <- sigma.spatial.sq * exp(-phi * d[i,j])}}
S[1:N] ~ dmnorm(muS[], Omega[,])
for (i in 1:N) {muS[i] <- 0}
Omega[1:N,1:N] <- inverse(H[,])
### Euclidean Distance
d[1,1] <- 0
for (i in 2:N)
{
d[i,i] <- 0
for (j in 1:i-1)
{
d[i,j] <- sqrt(pow(Longitude[i] - Longitude[j], 2) +
pow(Latitude[i] - Latitude[j], 2))
d[j,i] <- d[i,j]
}
}
### Precision, Residual
tau.resid <- pow(sigma.resid, -2)
sigma.resid ~ dunif(0, 100)
sigma.resid.sq <- 1 / tau.resid
### Precision, Spatial
tau.spatial <- pow(sigma.spatial, -2)
sigma.spatial ~ dunif(0, 100)
sigma.spatial.sq <- 1 / tau.spatial
### Priors for Regression Effects
beta ~ dnorm(0.0, 1.0E-4)
### Priors for Rate of Spatial Decay
phi ~ dunif(0, 10)
}
-------------------------------------------------------------------
This list is for discussion of modelling issues and the BUGS software.
For help with crashes and error messages, first mail [log in to unmask]
To mail the BUGS list, mail to [log in to unmask]
Before mailing, please check the archive at www.jiscmail.ac.uk/lists/bugs.html
Please do not mail attachments to the list.
To leave the BUGS list, send LEAVE BUGS to [log in to unmask]
If this fails, mail [log in to unmask], NOT the whole list
|