INLA Crash When Fitting marked lgcp via inlabru

8 views
Skip to first unread message

Sebastião Farias

unread,
Oct 6, 2025, 12:35:25 PM (7 days ago) Oct 6
to R-inla discussion group
Dear INLA Team,

I hope you're doing well.

I've been working on a joint spatial model (marked LGCP) using the inlabru package.

My model consists of a spatial point process (CP) component, combined with a Tweedie mark model,that share a SPDE-based latent field.

i keep running into a problem where the INLA call crashes, even after trying various adjustments. I have tried several different priors but found no solution. 

If you have any idea what could help me I would be really thankfull. Here is my code:

------------------------------------------
# DEF mesh
DEF_boundary.loc <- SpatialPoints(as.matrix(DEF_coords))
DEF_boundary <- list(
  inla.nonconvex.hull(sp::coordinates(DEF_boundary.loc), 25000, resolution = 50),
  inla.nonconvex.hull(sp::coordinates(DEF_boundary.loc), 35000, resolution = 50))
DEF_mesh <- inla.mesh.2d(boundary = DEF_boundary,
                         max.edge = c(15000, 50000),
                         min.angle = c(30, 21),
                         max.n = c(48000, 16000), ## Safeguard against large meshes.
                         max.n.strict = c(128000, 128000), ## Don't build a huge mesh!
                         cutoff = 0.01, ## Filter away adjacent points.
                         offset = c(25000, 35000),
                         crs = 3763) 


# Define SPDE
DEF_matern <- INLA::inla.spde2.pcmatern(DEF_mesh,
                                        prior.sigma = c(0.5, 0.5),
                                        prior.range = c(70000, 0.5)
)

DEF_components <-  ~
  field(main = geometry, model = DEF_matern) +
  Int1(1) + Int2(1) +
  Batimetria(main = bathy_cov, model = "linear")

DEF_lik_mark_test <- bru_obs(
  "tweedie",
  formula = VALOR ~ Int1 + field,
  data = DEF_sf,
  samplers = DEF_sampler,
  domain = list(geometry = DEF_mesh)
)
DEF_lik_spatial_test <- bru_obs(
 family = "cp",
 formula = geometry ~ Int2 + field,
 data = DEF_sf,  
 samplers = DEF_sampler,
 domain = list(geometry = DEF_mesh)
)

DEF_mod_test <- bru(
  components = DEF_components,
  DEF_lik_spatial_test,
  DEF_lik_mark_test,
  options = list(
    control.inla = list(int.strategy = "laplace"),
    bru_max_iter = 5,
    control.compute = list(cpo = TRUE),           # ask for CPO & PIT
    control.predictor = list(compute = TRUE)      # ensure fitted values are stored
  )
)

And the error:

*** inla.core.safe: The inla program failed, but will rerun in case better initial values may help. try=1/1 Warning in bru_log_warn(paste0("iinla: Problem in inla:\n", result)) : iinla: Problem in inla: Error in inla.core.safe(formula = formula, family = family, contrasts = contrasts, : The inla program call crashed. The inla program failed and the maximum number of tries has been reached. iinla: Problem in inla: 1: bru(components = DEF_components, DEF_lik_spatial_test, DEF_lik_mark_test, [...] 2: iinla(model = info[["model"]], lhoods = info[["lhoods"]], inputs = info[[" [...] 3: fm_try_callstack(...) 4: do.call(INLA::inla, inla.options.merged, envir = environment(model$effects)) 5: (function (formula = NULL, family = "gaussian", contrasts = NULL, data = N [...] 6: inla.core.safe(formula = formula, family = family, contrasts = contrasts, [...] 7: stop(paste0(r$message, "\n", "The inla program failed and the maximum numb [...] iinla: Giving up and returning last successfully obtained result for diagnostic purposes.

Thank you,
Sebastião Farias

INLA help

unread,
Oct 6, 2025, 12:38:32 PM (7 days ago) Oct 6
to Sebastião Farias, R-inla discussion group
If you could share code and data so we can rerun it here, it would be useful
 
 
Also, what OS are u using, R version and INLA version and inland 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/8e93cff1-cf46-4b1a-b026-03db03b1c74fn%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages