Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

Issue with zero-mean Matérn field in Log-Gaussian Cox Process using inlabru

56 views
Skip to first unread message

Daniele Poggio

unread,
Nov 18, 2024, 1:28:42 PM11/18/24
to R-inla discussion group

Dear colleagues,

I am using inlabru (a wrapper for INLA) to build a Log-Gaussian Cox Process (LGCP) model for spatial observations.

I aim to describe the observations with a simple model composed of:

  • a time-dependent intercept and
  • a zero-mean Matérn field,
    fixed for all time points considered.

The model is defined as:

log(lambda(s,t)) = Intercept_t + w(s)  

Here:

  • is the spatial location,
  • is the time,
  • is the time-dependent intercept, and
  • is a zero-mean Matérn field.

Following the tutorial 2D LGCP in inlabru, I defined a mesh for the study region:

mesh.png

  The blue line in the image represents the boundary of the study area.  

  I compute the model using the following R code:

# Define the Matérn model
matern <- inla.spde2.pcmatern(
  mesh,
  # P(\sigma > \sigma_0) = p_{\sigma}
  prior.sigma = c(0.1, 0.01),
  # P(\rho < \rho_0) = p_{\rho}
  prior.range = c(50, 0.5)
)

# Define the component model
cmp <- geometry + season ~ Intercept(season, model = "factor_full") + W(geometry, model = matern) - 1

# Set bru options
bru_options_set(
  bru_verbose = TRUE,
  verbose = TRUE,
  bru_max_iter = 1,
  control.inla = list(int.strategy = "eb")
)

# Fit the LGCP model
fit <- lgcp(cmp,
  data = points,
  samplers = search_area_polygon,
  domain = list(
    geometry = mesh,
    season = seq_len(5)
  )
)

Here, search_area_polygon is an sfc_POLYGON object that defines the boundaries of the study region.

When I observe the mean value of the Matérn field, I notice the following issue:

  • Inside the study area (where the observations are located), the field is strongly positive.
  • Outside the study area (where there are no observations), the field is negative.

I would like the Gaussian field to have a zero-mean, but it does not appear to behave as such. I would expect these deviations to be "absorbed" by the intercept component.

Here is an image of the Matérn field for reference:

GF.png

Can anyone suggest whether there is an issue with my approach or provide advice on how to resolve this?

Thank you in advance!

Best regards,

Daniele Poggio

Helpdesk (Haavard Rue)

unread,
Nov 22, 2024, 2:00:08 PM11/22/24
to Daniele Poggio, R-inla discussion group

you can add constr=T in inla.spde2.pcmatern to impose a (weighted-)sum-to-zero
constraint on the spde model, hence you can separate the 'intercept' from the
spde

On Mon, 2024-11-18 at 07:36 -0800, Daniele Poggio wrote:
> Dear colleagues,
> I am using inlabru (a wrapper for INLA) to build a Log-Gaussian Cox Process
> (LGCP) model for spatial observations.
> I aim to describe the observations with a simple model composed of:
>  * a time-dependent intercept and
>  * a zero-mean Matérn field,
>    fixed for all time points considered.
> The model is defined as:
> log(lambda(s,t)) = Intercept_t + w(s)  
> Here:
>  * s is the spatial location,
>  * t is the time,
>  * Intercept_t​ is the time-dependent intercept, and
>  * w(s) is a zero-mean Matérn field.
> Following the tutorial 2D LGCP in inlabru, I defined a mesh for the study
> region:
>  * Inside the study area (where the observations are located), the field is
> strongly positive.
>  * Outside the study area (where there are no observations), the field is
> negative.
> I would like the Gaussian field to have a zero-mean, but it does not appear to
> behave as such. I would expect these deviations to be "absorbed" by the
> intercept component.
> Here is an image of the Matérn field for reference:
> GF.png
> Can anyone suggest whether there is an issue with my approach or provide
> advice on how to resolve this?
> Thank you in advance!
> Best regards,
> Daniele Poggio
> --
> 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/1aabeb3b-e149-42eb-89ee-38ca1781c4f0n%40googlegroups.com
> .

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

Finn Lindgren

unread,
Nov 22, 2024, 4:30:10 PM11/22/24
to Daniele Poggio, R-inla discussion group
One thing to note:

Even if one used constr=TRUE, that would impose the constraint to the whole mesh, which wouldn’t prevent the effect you’re seeing, as it would still be confounded with the intercepts on the observed subdomain; one would need to apply the integrate-to-zero constraint only on the study domain. This is also possible; the extraconstr.int can be used to supply a constraint against an indicator function defined on the mesh nodes; 1 inside and 0 for vertices outside the study domain. That way, it can more fully ignore the outside parts. The format is list(A=matrix(…, 1, fm_dof(mesh)), e=1), I think, where the … are the 0/1 values. fm_is_inside or fm_is_within is the function that can help evaluate those.

Finn

On 18 Nov 2024, at 18:28, Daniele Poggio <poggiod...@gmail.com> wrote:



Dear colleagues,

I am using inlabru (a wrapper for INLA) to build a Log-Gaussian Cox Process (LGCP) model for spatial observations.

I aim to describe the observations with a simple model composed of:

  • a time-dependent intercept and
  • a zero-mean Matérn field,
    fixed for all time points considered.

The model is defined as:

log(lambda(s,t)) = Intercept_t + w(s)  

Here:

  • is the spatial location,
  • is the time,
  • is the time-dependent intercept, and
  • is a zero-mean Matérn field.

Following the tutorial 2D LGCP in inlabru, I defined a mesh for the study region:

<mesh.png>

<GF.png>

Can anyone suggest whether there is an issue with my approach or provide advice on how to resolve this?

Thank you in advance!

Best regards,

Daniele Poggio

--
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/1aabeb3b-e149-42eb-89ee-38ca1781c4f0n%40googlegroups.com.
<mesh.png>
<GF.png>
Reply all
Reply to author
Forward
0 new messages