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?