Hello all,
I am trying to run a simple LGCP model with inlabru containing one "SpatialGridDataFrame" covariate (NDVI) but when i attempt to run the model, i am faced with thousands of error codes (GMRFLib_2order_approx: rescue NAN/INF values in logl for idx) before INLA eventually crashes.
For context, the same model code runs fine with other covariates which are formatted in the same way (e.g. same resolution, origin, extent, CRS). Another note is that i have only included NDVI values ranging between 0 and 1 (no negative values). I will include the code below, does anyone have any ideas to fix this, i'm completely stuck?
Thanks!
# Set experimental inlabru mode
>
>
>
> bru_options_set(inla.mode = "experimental")
>
>
>
> # Reload data
>
>
>
> campbells <- readRDS("campbells.rds")
>
>
>
> # Assign NDVI covariate
>
>
>
> NDVI <- campbells$covariates$NDVI
>
>
>
> # Hazard rate detection function with shape parameter of 7
>
>
>
> hr <- function(distance, lsig) {
>
> 1 - exp(-(distance / exp(lsig))^-7)
>
> }
>
>
>
> # SPDE with Matern covariance structure and PC priors
>
>
>
> matern <- inla.spde2.pcmatern(campbells$mesh_fine,
>
> prior.sigma = c(5, 0.01),
>
> prior.range = c(10, 0.9))
>
>
>
> # Define and run test model
>
>
>
> components_test <- ~ SPDE(main = coordinates, model = matern) +
>
> NDVI(NDVI, model = "linear") +
>
> lsig(1) +
>
> Intercept(1)
>
>
>
> formula_test <- coordinates + distance ~ SPDE + log(hr(distance, lsig)) +
>
> NDVI +
>
> Intercept +
>
> log(2)
>
>
>
> model_test <- lgcp(
>
> components = components_test,
>
> campbells$points,
>
> samplers = campbells$samplers,
>
> domain = list(
>
> coordinates = campbells$mesh_fine,
>
> distance = INLA::inla.mesh.1d(seq(0, 0.06, length.out = 30))
>
> ),
>
> formula = formula_test,
>
> options = list(bru_initial = list(lsig = -3, Intercept = 1), bru_verbose = 4, bru_method=list(rel_tol = 0.15), control.compute = list(dic = TRUE, cpo = TRUE, waic=TRUE))
>
> )
>
>
>
> summary(model_test)