spatio temporal model resulting in "Error in inla.core.safe"

24 views
Skip to first unread message

ellen blomme

unread,
Jul 15, 2025, 10:36:56 AMJul 15
to R-inla discussion group
Hello,

I want to investigate whether there is an association between weather variables and trend of populations. For each year i have a count of my population, I determined the slope of the trend of the population, which I use as response variable (I rarely have 1 continuous time series for a population). To first test that my model is working, I use a subset of my dataset but i made sure that for each year I have at least 1 population with an observation (no years without data).

I am trying to run a spatio-temporal model. I made my spatial field, defined my temporal correlation and put everything in my model.  The response variable is a decimal number (-2.5, 3.5). The covariates are weather anomalies of temperature, temperature variation and precipitation. Each covariate is standardized. 

Group <- df_INLA$Group
NGroups <- length(unique(Group))
A5 <- inla.spde.make.A(mesh, loc = Loc, group = Group)
w5.index <- inla.spde.make.index(name = "w", n.spde = mesh$n, n.group = NGroups)

Stk5 <- inla.stack(
             tag = "Fit",
             data = list(y = df_INLA$slope),  
         A = list(1, A5, 1),                  
         effects = list(
           Intercept = rep(1, nrow(df_INLA)),
           w = w5.index, # spatial field
           X = X)) # covariates 

f5 <- y ~ -1 + Intercept + T_std + T_sd_std + P_std +
          f(w,
            model = spde2,
            group = w.group,
            control.group = list(model='rw1')) + f(site_id, model = "iid")

I5 <- inla(f5,
           family = 'gaussian',
           data = inla.stack.data(Stk5),
           control.compute = list(dic = TRUE),
           verbose = TRUE,
           control.predictor = list(A = inla.stack.A(Stk5))
           )

I get this error:  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.

In the verbose output, I only find these errors:
*** inla.core.safe:  The inla program failed, but will rerun in case better initial values may help. try=1/1 

|
|
Compute initial values...

             Iter[0] RMS(err) = 1.000, update with step-size = 1.047

             Iter[1] RMS(err) = 0.521, update with step-size = 0.662

             Iter[2] RMS(err) = 0.599, update with step-size = 0.705

             Iter[3] RMS(err) = 0.660, update with step-size = 0.658

Any help in finding my mistake would be greatly appreciated.

Thanks in advance!
Kind regards,
Ellen



Reply all
Reply to author
Forward
0 new messages