Numerical singular in AQA^t

20 views
Skip to first unread message

Rafael Lopes

unread,
May 16, 2025, 4:03:37 PM5/16/25
to r-inla-disc...@googlegroups.com
Hi all,

I'm fitting a besag2 model, and I'm getting warnings like this:

"GitId: b2abbedea53ff456149dbe37d7be47fdd0cfdf9f - Wed Dec 11 22:31:59 2024 +0300
Error:0 Reason: Warning
Message: Matrix AQA^t is numerical singular, remove singularity and move on
Line:733 Function: GMRFLib_init_problem_store"

I tried to fix it by adding diag.eps = 1e-3 to the diagonal of the besag2 model, but it still keeps returning those warnings. I'm not sure how much more I can add to the diagonal without breaking the model or making it invalid.

This is my model code:

best_model <- inla(
        as.formula(infectionsPC ~ 1 +
                     f(ID,
                       model = "besag2",
                       graph = hex_graph,
                       scale.model = TRUE,
                       diagonal = diag.eps,
                       constr = TRUE,
                       hyper = hyper_smooth)),
        data = as.data.frame(hex_week),
        family = "gaussian",
        control.inla = control.inla(strategy = "gaussian", h = h.value, restart = 3, int.strategy = "eb"),
        control.mode = control.mode(restart = TRUE),
        control.compute = compute_list,
        control.predictor = predictor_list,
        control.fixed = list(prec.intercept = 0.01),
        num.threads = 6,  # Prevent internal threading conflicts
        # verbose = T
      )

The priors are typical 'pc.priors' with the following specification:

hyper_smooth <- list(
  prec = list(
    prior = "pc.prec",
    param = c(0.2, 0.01),  # P(SD > 0.2) = 1% (STRONG smoothing)
    initial = 5            # Start with high precision (1/exp(4) ≈ 0.018 SD)
  )
)

Is there any solution to it?
--
                  +1 475 300 8455 (USA)

Postdoc Yale,
PhD. in Physics

Helpdesk (Haavard Rue)

unread,
May 16, 2025, 4:06:19 PM5/16/25
to Rafael Lopes, r-inla-disc...@googlegroups.com

you may try increase the precision for the intercept, does it go away then?
> rafael...@yale.edu
> Cellphone: +55(11) 97559-1996 (Brazil)
>                   +1 475 300 8455 (USA)
>
> Postdoc Yale,
> PhD. in Physics
> --
> 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/CAFHzx86kGBNmnMmYSUsq6xj2M4EYV-4V992dRr5MO5CGRo_N7w%40mail.gmail.com
> .

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

Rafael Lopes

unread,
May 16, 2025, 5:29:09 PM5/16/25
to Helpdesk, r-inla-disc...@googlegroups.com
I changed to 0.1 and still get the warning about numerically singular
--
Reply all
Reply to author
Forward
0 new messages