Replicated Spatial-Temporal Correlation – inlabru

122 views
Skip to first unread message

Brian Tavernia

unread,
Sep 10, 2024, 4:37:45 PM9/10/24
to R-inla discussion group

Using the INLA package, one can specify a replicated spatial-temporal correlation by including a term that includes the spde model (‘spde’), spde index (‘w’), and a vector of replications (‘w.repl’):

f(w, model = spde, replicate = w.repl)

How does one create the same type of correlation using a bru formula?  Are there multiple ways to do this?

In an August 22 post on this forum, Tim Meehan created a replicated spatial-temporal correlation by passing the model = ‘iid’ argument to his field_residuals component in the model formula.

However, when looking at the available arguments for a bru component, I see a replicate argument, and this suggest to me that it might also be possible to specify a replicated spatial-temporal correlation by passing the replicate argument to a bru component?  

Am I correct about the potential use of the replicate argument in the bru component?

Thanks!

Finn Lindgren

unread,
Sep 10, 2024, 4:57:51 PM9/10/24
to Brian Tavernia, R-inla discussion group
Hi,
The basic use of replicate in inlabru works the same way as for non-SPDE models. The odd one out is actually the inla() SPDE models, where one needs to construct the A matrix first, which is why the w.repl construction is needed there. In inlabru, you would instead supply the replicate information directly in the component definition, e.g. like

+ field(geometry, model=spde, replicate=time)

(Assuming that replications across “time” are desired; replace it with your own variable of choice…)

One can also optionally use a custom mapper for the replicates, which for example would allow interpolation between replicates (this can make sense in some models, but usually it does not; it is more commonly useful for some “group” models).

Finn

On 10 Sep 2024, at 21:37, Brian Tavernia <btav...@gmail.com> wrote:


--
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 on the web, visit https://groups.google.com/d/msgid/r-inla-discussion-group/21885ba4-c8be-4635-bdc4-2d45b1edc01cn%40googlegroups.com.

Brian Tavernia

unread,
Sep 12, 2024, 8:23:07 AM9/12/24
to R-inla discussion group
Thanks, Finn. 

Courtney Taylor

unread,
May 12, 2026, 10:30:24 AM (yesterday) May 12
to R-inla discussion group
Hi Finn, 

I see this question has been closed for some time but I was wondering if it would it be possible to see the code for what such a custom mapper might look like? For example, if observations were non-uniformly sampled over time and we wanted to attempt to also account for the potential associated temporal autocorrelation.

Thanks very much. 

Finn Lindgren

unread,
May 12, 2026, 11:10:14 AM (yesterday) May 12
to Courtney Taylor, R-inla discussion group
Hi,

an easy case is if one wants to e.g. have 2nd degree B-spline basis functions such that the coefficients follow an ar1 process (via "group"), or independent (via "replicate"):

# mapper
b_spline_2_mapper <- bm_fmesher(fm_mesh_1d(temporal_knots, degree = 2, boundary = "free")))
# independent basis coefficients
field(geometry, model=spde, replicate=time, replicate_mapper = b_spline_2_mapper)
# ar1-dependent coefficients:
field(geometry, model=spde, group=time, group_mapper = b_spline_2_mapper, control.group=list(model="ar1"))

You could then choose the temporal_knots to have uniform spacing, linking the model to unevenly spaced observations (in geometry and time).

Finn 



--
Finn Lindgren
email: finn.l...@gmail.com
Reply all
Reply to author
Forward
0 new messages