Fix Matern hypers in barrier model

42 views
Skip to first unread message

Sylvan Benaksas

unread,
May 27, 2025, 11:08:48 AM5/27/25
to R-inla discussion group
Hi Inla team,

is it possible to fix the matern priors (range and sigma) for Haakon's barrier model, as it is possible for a stationary model?

Many thanks,
Sylvan

Finn Lindgren

unread,
May 27, 2025, 11:15:11 AM5/27/25
to Sylvan Benaksas, R-inla discussion group
Hi,

I'm guessing you're asking if the parameter _values_ can be set to fixed values?
The documentation for inla.barrier.pcmatern claims you can, by setting the probability to NA:

"
prior.range
2 parameters ⁠(range0,Prange)⁠ for the prior spatial range. If Prange is NA, then range0 is used as a fixed range value (not tested).

prior.sigma
2 parameters ⁠(sig0,Psig)⁠ for the prior marginal standard deviation sigma. If Psig is NA, then sig0 is used as a fixed sigma value (not tested).
"

but as it says it hasn't been tested, so if you're running into a specific problem you need to provide more details.

But also note that there's a new implementation in INLAspacetime::barrierModel.define(), with a slightly different method for setting fixed values (0 instead of NA):

"
prior.range
numeric vector containing U and a to define the probability statements P(range < U) = a used to setup the PC-prior for range. If a = 0 then U is taken to be the fixed value for the range.

prior.sigma
numeric vector containing U and a to define the probability statements P(range > U) = a used to setup the PC-prior for sigma. If a = 0 then U is taken to be the fixed value for sigma.
"

If you're asking because something appears to not do what the documentation says, please provide more details.

Finn

--
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/41f3cf6c-4812-4fc2-8768-d80caead4ee3n%40googlegroups.com.


--
Finn Lindgren
email: finn.l...@gmail.com

Sylvan Benaksas

unread,
May 29, 2025, 8:00:22 AM5/29/25
to R-inla discussion group
Hi Finn,

Yes sorry, I was referring to fixing the parameter values. When I tried to fix the parameter values in the barrier model I get the following error:

> barrier.model = inla.barrier.pcmatern(mesh, barrier.triangles = + barrier.tri, + prior.range = c(20, NA),# 50, 0.5 + prior.sigma = c(0.5, NA)) Error in INLAspacetime::barrierModel.define(mesh = mesh, barrier.triangles = barrier.triangles, : prior.range[2] >= 0 is not TRUE In addition: Warning message: In inla.barrier.pcmatern(mesh, barrier.triangles = barrier.tri, : Using implementation from the `INLAspacetime` package
Cheers,
Sylvan


Finn Lindgren

unread,
May 29, 2025, 10:26:22 AM5/29/25
to Sylvan Benaksas, R-inla discussion group
Ah, yes, this is because apparently the code in inla.barrier.pcmatern now calls the INLAspacetime implementation without translating the parameter syntax appropriately.
I would suggest using the INLAspacetime model directly instead, which wants a zero instead of NA. (and then you won't need to wait for the INLA code to be corrected...)

I'm not sure why the INLAspacetime implementation uses a different syntax; NA makes more sense to me than 0, but both are easily detected, so it could support both in principle...

Finn

Sylvan Benaksas

unread,
Jun 10, 2025, 7:15:53 AM6/10/25
to R-inla discussion group
Hi Finn,

Many thanks for that, using 0 instead of NA does seem to work.

Sylvan

Elias T. Krainski

unread,
Jun 10, 2025, 7:26:12 AM6/10/25
to R-inla discussion group
I've fixed this in the current github.

Reply all
Reply to author
Forward
0 new messages