Hi all,
I am trying to run a spatiotemporal barrier model to predict salinity in a bay area. I successfully ran it on a spatial example without issue. I don't think it is a memory issue because I have 64GB of RAM on a Windows virtual machine. My data includes monthly observations of salinity for 1 year (so 12 time periods). I've also attached a text file with the error message and verbose = T output.
Here is the relevant portions of my code:
pr = min(c(diff(range(mesh$loc[, 1])), diff(range(mesh$loc[, 2])))) /5
prior.range = c(pr, 0.9)
prior.sigma = c(1.5, 0.1)
prior.prec <- list(prec = list(prior = "pc.prec", param = c(1.5, 0.1)))
barrier.model = inla.barrier.pcmatern(mesh, barrier.triangles = barrier.triangles, prior.range = prior.range, prior.sigma = prior.sigma)
indexs <-inla.spde.make.index("s", n.spde =barrier.model$f$n, n.group = 12)
A <- inla.spde.make.A(mesh = mesh, loc =cbind(d$x, d$y), group = d$time, n.group = 12);dim(A)
stk.e <-inla.stack(
tag = "est",
data = list(y=d$logv),
A = list(1, A),
effects = list(data.frame(m = rep(1, nrow(d))), s = indexs)
)
rprior <- list(theta = list(prior = "pccor1", param = c(0, 0.9)))
formula <- y ~ -1 + m + f(s, model = barrier.model, group = s.group, control.group = list(model = "ar1", hyper = rprior))
start.time <- Sys.time()
ressubset <- inla(formula,
data = inla.stack.data(stk.e),
control.predictor = list(
compute = TRUE, link = 1,
A = inla.stack.A(stk.e)),
family="gaussian",
control.family = list(hyper = prior.prec),
control.inla= list(strategy="adaptive",int.strategy = "eb"),
control.compute=list(cpo=TRUE),
num.threads = "4",
verbose = TRUE
)
end.time <- Sys.time()
time.taken <- end.time - start.time
time.taken
Thanks,
Michael