VB correction divergence warnings in spatial binomial model - should I be concerned?

33 views
Skip to first unread message

Brian

unread,
Sep 6, 2025, 10:14:45 AM (2 days ago) Sep 6
to R-inla discussion group
Hello, I'm fitting a spatial binomial model using INLA and consistently getting the following warnings:

```
***[1] warning *** iterative process seems to diverge, 'vb.correction' is aborted
*** Please (re-)consider your model, priors, confounding, etc.
***[3] warning *** iterative process seems to diverge, 'vb.correction' is aborted  
*** Please (re-)consider your model, priors, confounding, etc.
```

What exactly does the VB correction failure mean in practical terms? and are there specific model adjustments I should consider (different priors, mesh refinement, etc.)? 

The model produces sensible posterior distributions and reasonable spatial predictions, but I want to ensure I'm not missing potential issues with model fit or inference quality.

Code:

``
spde <- inla.spde2.pcmatern(
  mesh = mesh,
  alpha = 2,
  prior.range = c(r0, .01),  
  prior.sigma = c(1, .01)  
)

stk.e1 <- inla.stack(
  tag = 'point',
  data = list(y = dm2$n, numtrials = dm2$N),
  A = list(A, 1, 1),
  effects = list(
    s = indexs,
    rr = 1:length(dm2$improved_water),
    b0 = rep(1, nrow(dm2))
  )
)

stk.p1 <- inla.stack(
  tag = "pred",
  data = list(y = NA, numtrials = NA),
  A = list(Ap, 1, 1),
  effects = list(
    s = indexs,
    rr = (length(pred$improved_water) + 1):(length(pred$improved_water) + nrow(pred)),
    b0 = rep(1, nrow(pred))
  )
)
stk.full <- inla.stack(stk.e1, stk.p1)

# Binomial model
binomial_nn <- inla(
  formula =  y ~ 0 + b0 + f(s, model = spde),
  family = "binomial",
  Ntrials = numtrials,
  data = inla.stack.data(stk.full),
  control.family = control.family(link = 'logit'),
  control.predictor = list(
    compute = TRUE,
    link = 1,
    A = inla.stack.A(stk.full)
  ),
  control.fixed = list(mean = 0, prec = 1),
  control.compute = list(config = TRUE, return.marginals.predictor = TRUE, cpo = T, waic = T, dic = T),
  num.threads = 7,
  verbose = F
)`

```

INLA help

unread,
Sep 6, 2025, 10:19:05 AM (2 days ago) Sep 6
to R-inla discussion group, Brian
Are u using the most recent testing version?

Haavard Rue
--
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, visit https://groups.google.com/d/msgid/r-inla-discussion-group/3d60043d-bd41-46de-906b-eda850faacc2n%40googlegroups.com.

Brian

unread,
Sep 6, 2025, 11:27:48 AM (2 days ago) Sep 6
to R-inla discussion group
No, I am using this version

> inla.version()
R-INLA version ..........: 25.04.16
Date ....................: 2025-04-16
Maintainers .............: Havard Rue <hr...@r-inla.org>
                         : Finn Lindgren <finn.l...@gmail.com>
                         : Elias Teixeira Krainski <el...@r-inla.org>
Main web-page ...........: www.r-inla.org
Download-page ...........: inla.r-inla-download.org
Repository ..............: github.com/hrue/r-inla
Email support ...........: he...@r-inla.org
                         : r-inla-disc...@googlegroups.com
Should I upgrade to testing[25.09.04]?

INLA help

unread,
Sep 6, 2025, 11:43:40 AM (2 days ago) Sep 6
to R-inla discussion group, Brian
Yes please upgrade. 
 
 
The warnings will not go away I believe.  It’s a warning only that a mean correction computed is a little to large to believe (in the scale of the standard deviation) and the it simply ignore the correction term.   

Haavard Rue

Brian

unread,
Sep 6, 2025, 11:50:42 AM (2 days ago) Sep 6
to R-inla discussion group
Thank you for the earlier clarification on the VB correction warnings. I will upgrade to the latest testing version. 
I have a follow-up question about additional warnings I'm encountering with a different model. After running inla.rerun(), I'm getting:

*** WARNING *** GMRFLib_2order_approx: rescue NAN/INF values in logl for idx=33
*** WARNING *** GMRFLib_2order_approx: reset counter for 5 NAN/INF values in logl

I suspect this indicates that my model might be too complex for the available data or vice versa. These warnings only emerge when using inla.rerun() and are not present in the original model fit. Can I safely ignore this?

INLA help

unread,
Sep 6, 2025, 12:21:48 PM (2 days ago) Sep 6
to R-inla discussion group, Brian
It say that the loglikihood evaluation returns NAN, normally by some kind of overflow. When this happen the algorithm will try to fix it.   So if these msg stop, it’s all good.   This could f.ex happen with a flexible model and weak data 

Haavard Rue

Brian

unread,
Sep 6, 2025, 12:46:06 PM (2 days ago) Sep 6
to R-inla discussion group
The warnings do stop after a few iterations and the model fit successfully. Thank you for the clarification!
Reply all
Reply to author
Forward
0 new messages