Spatiotemporal barrier model fails to run

125 views
Skip to first unread message

Michael Desjardins

unread,
Apr 5, 2021, 7:06:36 PM4/5/21
to R-inla discussion group
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








error.txt
barrier_region.jpeg

Helpdesk

unread,
Apr 6, 2021, 12:53:38 AM4/6/21
to Michael Desjardins, R-inla discussion group

The error msg does not say much.

I see you run on R-3.6, I would recommend to upgrade R to 4.0 as its
unclear if running under 3.6 on a package built with 4.0 can cause
trouble. Anyway, I do not think this is the issue here.

Windows is know to not run well for larger models, and running R/INLA in
the WSL, like

https://fedoramagazine.org/wsl-fedora-33/

have been reported to run much better.

to check further, I have to rerun it here. please email to
he...@r-inla.org files and data if you want me to do that.

Best
H
> --
> You received this message because you are subscribed to the Google
> Groups "R-inla discussion group" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to r-inla-discussion...@googlegroups.com.
> To view this discussion on the web, visit
> https://groups.google.com/d/msgid/r-inla-discussion-group/7c9d49df-1965-4763-be2d-fb54d5a80d10n%40googlegroups.com
> .

--
Håvard Rue
he...@r-inla.org

Michael Desjardins

unread,
Apr 6, 2021, 10:52:57 AM4/6/21
to R-inla discussion group
Hi Håvard,

Thanks for your prompt response.  I will send over the files and see if you can run it.  Would really appreciate it.

Will also look into WSL, since I will eventually run the model on 10 years of data.

Best,

Michael  

Reply all
Reply to author
Forward
0 new messages