I need help with some spatio-temporal analysis

Hi Guys,
I am a student of epidemiology and I need to implement a spatio-temporal analysis for the delivery of a test.
I have the models in BUGS and INLA but I would like to do it with greta, is it possible?


BUGs:

model
{
for (i in 1 : regions) {
for (t in 1 : time) {
cases[i,t] ~ dpois(mu[i,t])
log(mu[i,t]) <- log(e[i]) + beta0 + beta1x1[i]+beta2x2[i]+beta3x3[i,t]+phi[i]+nu[i]+delta[t]+omega[t]
rho[i,t] <- exp(beta0 + beta1
x1[i]+beta2x2[i]+beta3x3[i,t]+phi[i]+nu[i]+delta[t]+omega[t]) # RR
rhoadj[i,t]<-exp(phi[i]+nu[i]+delta[t]+omega[t]) # adjusted RR
}
phi[i] ~ dnorm(0,tau.phi)
rhoiadj[i]<-exp(phi[i]+nu[i]) # adjusted RR over all years
}
nu[1:regions] ~ car.normal(adj[], weights[], num[], tau.nu)
delta[1]<-0
omega[1]<-0
rhotadj[1]<-exp(delta[1]+omega[1]) # Adjusted RR in year 1 over all districts
for (t in 2 :time) {
delta[t] ~ dnorm(0,tau.delta)
omega[t]~dnorm(omega[t-1],tau.omega)
rhotadj[t]<-exp(delta[t]+omega[t]) # Adjusted RR in years 2 - 6 over all districts
}
beta0 ~ dflat()
beta1 ~ dnorm(0.0, 1.0E-5)
beta2 ~ dnorm(0.0, 1.0E-5)
beta3 ~ dnorm(0.0, 1.0E-5)
tau.phi ~ dgamma(0.1,0.1)
tau.delta ~ dgamma(0.1,0.1)
tau.omega ~ dgamma(0.1,0.1)
tau.nu ~ dgamma(0.1,0.1)
}

And in INLA:

lepto.model <- cases ~ propto1mw + propfavela + rainmax +
f(regionUns, model = “iid”,
hyper = list(“prec” = list(prior = “loggamma”, param = c(0.5, 0.0005)))) +
f(regionStr, model = “besag”, graph = “rio.graph”,
hyper = list(“prec” = list(prior = “loggamma”, param = c(0.5, 0.0005)))) +
f(timeUns, model = “iid”,
hyper = list(“prec” = list(prior = “loggamma”, param = c(0.5, 0.0005)))) +
f(timeStr, model = “rw1”,
hyper = list(“prec” = list(prior = “loggamma”, param = c(0.5, 0.0005))))

lepto.output <- inla(formula = lepto.model, family = “poisson”,
E = expected, data = lepto2,
control.fixed = control.fixed(mean.intercept = 0, prec.intercept = 0,
mean = 0, prec = 1e-5 ),
control.family = list(hyper = list(
prec = list(
prior = “loggamma”,
param = c(0.5,0.0005)
)
)),
control.compute = list(dic = T))

Hi dr2p,

I see several options:

  1. Spatio-temporal models are (naturally) supported in greta via the extension package greta.gp. This extension uses Gaussian Processes to estimate covariance structure across space / time / whatever. This would however lead to different model than the one you pasted. You could check this forum thread for some infos on how to get started.

  2. You could check this Stan BYM model, that I guess should be possible to translate into greta. The only tricky line there would be:

    target += -0.5 * dot_self(phi[node1] - phi[node2])

Which I am not sure how to do in greta.

Success!
Lionel