Separable covariance/precision matrix

11 views
Skip to first unread message

Jeffrey Wu

unread,
Aug 20, 2025, 6:24:23 PMAug 20
to R-inla discussion group
Hello, 

I am fitting a mixed effects model to spatiotemporal data (72 time points, 58 locations). I want to specify a separable covariance/precision matrix based on spatial and temporal covariance matrices (call them S1 and S2) that I have estimated beforehand. I have been computing the Kronecker product and inverting it myself (call it Q which is 4176x4176) and then feeding it into my model using the "generic0" specification i.e., f(id, model = "generic0",Cmatrix = Q). This approach works but is kinda slow.

Someone has pointed out that this is probably not the most efficient way to code in a separable spatiotemporal covariance in INLA which is true if I were to use the built in options for model or group within f(). But I have not been able to find out how to feed in a S1 x S2 structure when S1 and S2 are estimated prior to fitting the INLA model and are therefore fed in as constants. While I have seen quite a few questions about separable dependence structures, seems like it has been a while and none of the old posts seem to quite match my situation. Closest thing I've found is examples 8.6.1 and 8.6.2 in this textbook (https://becarioprecario.bitbucket.io/inla-gitbook/ch-temporal.html#sec:spacetime) but I don't think this quite works for me either.

Any suggestions on how I could code in my specification? I'm guessing there is some way to do this with spde or inla.bru() if not with the standard INLA options but I could not find a tutorial either. 

Thanks,
Jeffrey Wu

Finn Lindgren

unread,
Aug 20, 2025, 6:53:44 PMAug 20
to Jeffrey Wu, R-inla discussion group
Hi,
If your pre-estimated precision matrices have no special structure I don’t think there’s a better option than what you already use, since “group” doesn’t allow generic0. However, if it makes sense to impose Markov structure on those matrices, the estimation should be much faster than if they are fully dense.
Also note that the inverse of a kronecker product is the kronecker product of the inverses, so your pre-processing step shouldn’t need to invert the large matrix.

The only added benefit of using inlabru instead of plain inla would be that you can define a space-time mapper for your model to make the code shorter.
If you have Qtime x Qspace, the mapper should be
 bm_multi(list(space=bru_mapper(spacemesh),time=bru_mapper(timemesh)))

Finn

On 20 Aug 2025, at 23:24, Jeffrey Wu <jeffrey...@gmail.com> wrote:

Hello, 
--
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/da51475c-719d-4b20-965a-0e1d63ca2865n%40googlegroups.com.

Helpdesk (Haavard Rue)

unread,
Aug 20, 2025, 6:56:44 PMAug 20
to Jeffrey Wu, R-inla discussion group

you may consider 'dmatern' (since you have few locations) which can be combined
with AR1 or AR(p) in time
Håvard Rue
he...@r-inla.org
Reply all
Reply to author
Forward
0 new messages