inlabru-org / inlabru

inlabru
https://inlabru-org.github.io/inlabru/
78 stars 21 forks source link

Non-separable spatiotemporal model #122

Closed JoseCansec closed 2 years ago

JoseCansec commented 2 years ago

Hello Finn

I have been fitting a spatio-temporal model but realized that the way inlabru does it with the control.group option is based on a separable space-time model. However, given my data has observations that are repeated over time in the same spatial cell I have to threat them as non-separable. Is there a way of fitting this types of models in inlabru like the inla.knmodels?

Best regards, Jose

eliaskrainski commented 2 years ago

The models fitted in inla.knmodels() are the same (and reparametrizations of these) of the ones in https://pubmed.ncbi.nlm.nih.gov/10960871/ . Thus, all with separable precision matrices: Kronecker between precision matrix structures of temporal and spatial models. Please do not get confused with the terms "inseparable space-time variation in disease risk" and "non-separable space-time models". They are not the same thing. You can have inseparable space-time variation in disease risk with separable space-time precision/covariance.

finnlindgren commented 2 years ago

Like Elias wrote, the "group" models implement covariance-separable models, which is more flexible than separability for the functions themselves. Both types of models are separable in their own sense. Function-level separability can also be estimated; with the easiest case being direct product interaction between covariates. For more complicated function products, such as the direct product of a spatial field and a temporal process, inlabru linearises the resulting nonlinear expression iteratively to estimate both factors. The covariance-separable models on the other hand are more flexible, and gives a linear predictor function.

finnlindgren commented 2 years ago

As for specifically the knmodels, the inla.knmodels function seems to mostly collect information for INLA::f() functions, and it looks like the models could be wrapped as model objects in their own right so they could be used in inlabru component specifications as well, but not at the moment. For a specific model, you could extract the relevant code and provide those model="generic0", Cmatrix, constr, etc, arguments to an inlabru component directly, for now.

finnlindgren commented 2 years ago

Closing this bug as it's not an inlabru specific issue; generic latent models should be implemented in with inla.rgeneric or inla.cgeneric. Use the inlabru bru_mapper method system to define how the inputs are mapped to the latent variables.