Hi,
thank you - I will try out the inla.spde2.pcmatern function tomorrow. My code for the model construction is the following:
# Contruct mesh:
ana.mesh<-inla.mesh.2d(loc = coordinates(MS.loc[c(new.control.stations, predict.station)]),
loc.domain = coordinates(LDN.union@polygons[[1]]@Polygons[[1]]),
max.edge = c(50*1000))
# Mesh to spde
matern.alpha<-1.5
ana.spde <- inla.spde2.matern(mesh = ana.mesh, alpha = matern.alpha)
# A
ana.A <- inla.spde.make.A(mesh=ana.mesh,
loc=coordinates(MS.loc[data.ana$code]),
group=data.ana$time2,
n.group = max(data.ana$time2))
# Produce indices
ana.indices<-inla.spde.make.index("field", n.spde=ana.spde$n.spde, n.group = max(data.ana$time2))
# Prepare data stack for inla:
ana.stack <- inla.stack(tag='ana',
data=list(logNOX=data.ana$
nox.na),
A=list(ana.A,1),
effects=list(c(list(intercept = rep(1, ana.mesh$n)),ana.indices),
list(ws=data.ana$ws,
solar = data.ana$solar,
rain = data.ana$rain,
temp=data.ana$temp,
bp = data.ana$bp,
rhum = data.ana$rhum,
code = data.ana$code,
trend = data.ana$trend,
i = data.ana$ID)))
inla.data.ana<-inla.stack.data(ana.stack, SPDE = ana.spde)
# Generate summary list
model.simp<-list()
#Simple Model without covariates (except station specific intercept):
model.simp$formula <- logNOX ~ 0 + code + f(field, model= SPDE, group=field.group, control.group=list(model="ar1")) + f(i, model = "iid")
model.simp$inla <- inla(model.simp$formula,
data = inla.data.ana ,
family = "gaussian",
control.fixed=list(expand.factor.strategy='inla'),
control.predictor=list(A=inla.stack.A(ana.stack), compute = T),
control.family = list(hyper = list(theta = list(param=c(1,20), fixed = T))),
debug = F,
verbose = T)