Never ending convergence issue

47 views
Skip to first unread message

Martin Lotto Batista

unread,
Jul 3, 2024, 1:03:10 PMJul 3
to R-inla discussion group
Dear INLA community,

I'm running a series of models with a temporal structure, using multiple formulas for explanatory variables. Each model follows the structure outlined below.

for(i in 1:length(explanatory.variables){
  res <- list("f(month, model='rw2', cyclic=TRUE, hyper=list(prec=list(prior='pc.prec', param=c(0.5, 0.01))))",
                    "f(year_ID, model='iid')")

  v <- explanatory.variables[[i]]

  form <- reformulate(c(1, unlist(res), na.omit(v)), response)

  mod <- INLA::inla(form,
                                  family="nbinomial",
                                  offset=log(population/100000),
                                  control.inla=list(strategy='auto',
                                                               int.strategy='eb',
                                                               cmin=0),
                                  control.compute=list(dic=TRUE, config=TRUE),
                                  control.predictor=list(link=1, compute=TRUE),
                                  verbose=TRUE,
                                  data=dt)
}

Most of the models complete in a matter of seconds, but occasionally one gets stuck during convergence (it's never the same model). No matter how long I let it run, it never finishes. I've tried modifying the priors, changing the integration method and strategy, and setting the safe argument to TRUE. I'm using R version 4.4.0 and R-INLA version 24.05.011. 

Attached to this email is the output from the model run, right before it was interrupted. I'll be happy to share any further information if needed.

Any help would be greatly appreciated.

Kind regards,
Martín
inla_output

Helpdesk (Haavard Rue)

unread,
Jul 3, 2024, 1:07:47 PMJul 3
to Martin Lotto Batista, R-inla discussion group
thx.

it seems to go in a cycle which should not happen. can you upgrade to testing
version INLA_24.06.27 and recheck?

if that does not help, if you can share so I could rerun it here, it would be
very helpful

thx
H

On Wed, 2024-07-03 at 08:07 -0700, 'Martin Lotto Batista' via R-inla discussion

> --
> 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/5b6def49-1fa6-4106-9a53-f177f1905e98n%40googlegroups.com
> .

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

Martin Lotto Batista

unread,
Jul 6, 2024, 6:43:30 AMJul 6
to R-inla discussion group
Haavard,

Thanks for the fast response. Switching to the testing version made a big difference. However, when switching to the hpc, the loop crashed, giving this error message:

inla.mkl: tabulate-Qfunc.c:147: GMRFLib_tabulate_Qfunc_core: Assertion `arg->Q->a[0] >= 0.0' failed.
Error in inla.core.safe(formula = formula, family = family, contrasts = contrasts,  :
  The inla-program exited with an error. Unless you interupted it yourself, please rerun with verbose=TRUE and check the output carefully.
  If this does not help, please contact the developers at <he...@r-inla.org>.
The inla program failed and the maximum number of tries has been reached.
Calls: fit_models -> run_mod -> <Anonymous> -> inla.core.safe
Execution halted

The console output is attached.

Any help will be greatly appreciated.

Best wishes,
Martín
output_iteration_crash.txt

Håvard Rue

unread,
Jul 7, 2024, 4:04:21 AMJul 7
to Martin Lotto Batista, R-inla discussion group
I guess you install the proper binary for the HPC, using

inla.binary.install()

?


you can try adding

control.inla=list(cmin=0)

and use a proper prior for the intercept

control.fixed=list(prec.intercept=0.01)

or so




On Sat, 2024-07-06 at 03:43 -0700, 'Martin Lotto Batista' via R-inla discussion
hr...@r-inla.org

Reply all
Reply to author
Forward
0 new messages