STCAR_INLA {bigDM} | R Documentation |
Fit a (scalable) spatio-temporal Poisson mixed model to areal count data.
Description
Fit a spatio-temporal Poisson mixed model to areal count data, where several CAR prior distributions for the spatial random effects, first and second order random walk priors for the temporal random effects, and different types of spatio-temporal interactions described in Knorr-Held (2000) can be specified. The linear predictor is modelled as
\log{r_{it}}=\alpha + \mathbf{x_{it}}^{'}\mathbf{\beta} + \xi_i+\gamma_t+\delta_{it}, \quad \mbox{for} \quad i=1,\ldots,n; \quad t=1,\ldots,T
where \alpha
is a global intercept, \mathbf{x_{it}}^{'}=(x_{it1},\ldots,x_{itp})
is a p-vector of standardized covariates in the i-th area and time period t, \mathbf{\beta}=(\beta_1,\ldots,\beta_p)
is the p-vector of fixed effects coefficients,
\xi_i
is a spatially structured random effect, \gamma_t
is a temporally structured random effect, and \delta_{it}
is the space-time interaction effect. If the interaction term is dropped, an additive model is obtained.
To ensure model identifiability, sum-to-zero constraints are imposed over the random effects of the model. Details on the derivation of these constraints can be found in Goicoa et al. (2018).
As in the CAR_INLA
function, three main modelling approaches can be considered:
the usual model with a global spatial random effect whose dependence structure is based on the whole neighbourhood graph of the areal units (
model="global"
argument)a Disjoint model based on a partition of the whole spatial domain where independent spatial CAR models are simultaneously fitted in each partition (
model="partition"
andk=0
arguments)a modelling approach where k-order neighbours are added to each partition to avoid border effects in the Disjoint model (
model="partition"
andk>0
arguments).
For both the Disjoint and k-order neighbour models, parallel or distributed computation strategies can be performed to speed up computations by using the 'future' package (Bengtsson 2021).
Inference is conducted in a fully Bayesian setting using the integrated nested Laplace approximation (INLA; Rue et al. (2009)) technique through the R-INLA package (https://www.r-inla.org/). For the scalable model proposals (Orozco-Acosta et al. 2023), approximate values of the Deviance Information Criterion (DIC) and Watanabe-Akaike Information Criterion (WAIC) can also be computed.
The function allows also to use the new hybrid approximate method that combines the Laplace method with a low-rank Variational Bayes correction to the posterior mean (van Niekerk et al. 2023) by including the inla.mode="compact"
argument.
Usage
STCAR_INLA(
carto = NULL,
data = NULL,
ID.area = NULL,
ID.year = NULL,
ID.group = NULL,
O = NULL,
E = NULL,
X = NULL,
W = NULL,
spatial = "Leroux",
temporal = "rw1",
interaction = "TypeIV",
model = "partition",
k = 0,
strategy = "simplified.laplace",
scale.model = NULL,
PCpriors = FALSE,
merge.strategy = "original",
compute.intercept = NULL,
compute.DIC = TRUE,
n.sample = 1000,
compute.fitted.values = FALSE,
save.models = FALSE,
plan = "sequential",
workers = NULL,
inla.mode = "classic",
num.threads = NULL
)
Arguments
carto |
object of class |
data |
object of class |
ID.area |
character; name of the variable that contains the IDs of spatial areal units. The values of this variable must match those given in the |
ID.year |
character; name of the variable that contains the IDs of time points. |
ID.group |
character; name of the variable that contains the IDs of the spatial partition (grouping variable). Only required if |
O |
character; name of the variable that contains the observed number of disease cases for each areal and time point. |
E |
character; name of the variable that contains either the expected number of disease cases or the population at risk for each areal unit and time point. |
X |
a character vector containing the names of the covariates within the |
W |
optional argument with the binary adjacency matrix of the spatial areal units. If |
spatial |
one of either |
temporal |
one of either |
interaction |
one of either |
model |
one of either |
k |
numeric value with the neighbourhood order used for the partition model. Usually k=2 or 3 is enough to get good results. If k=0 (default) the Disjoint model is considered. Only required if |
strategy |
one of either |
scale.model |
logical value (default |
PCpriors |
logical value (default |
merge.strategy |
one of either |
compute.intercept |
CAUTION! This argument is deprecated from version 0.5.2. |
compute.DIC |
logical value; if |
n.sample |
numeric; number of samples to generate from the posterior marginal distribution of the linear predictor when computing approximate DIC/WAIC values. Default to 1000. |
compute.fitted.values |
logical value (default |
save.models |
logical value (default |
plan |
one of either |
workers |
character or vector (default |
inla.mode |
one of either |
num.threads |
maximum number of threads the inla-program will use. See |
Details
For a full model specification and further details see the vignettes accompanying this package.
Value
This function returns an object of class inla
. See the mergeINLA
function for details.
References
Goicoa T, Adin A, Ugarte MD, Hodges JS (2018). “In spatio-temporal disease mapping models, identifiability constraints affect PQL and INLA results.” Stochastic Environmental Research and Risk Assessment, 32(3), 749–770. doi:10.1007/s00477-017-1405-0.
Knorr-Held L (2000). “Bayesian modelling of inseparable space-time variation in disease risk.” Statistics in Medicine, 19(17-18), 2555–2567.
Orozco-Acosta E, Adin A, Ugarte MD (2021). “Scalable Bayesian modeling for smoothing disease mapping risks in large spatial data sets using INLA.” Spatial Statistics, 41, 100496. doi:10.1016/j.spasta.2021.100496.
Orozco-Acosta E, Adin A, Ugarte MD (2023). “Big problems in spatio-temporal disease mapping: methods and software.” Computer Methods and Programs in Biomedicine, 231, 107403. doi:10.1016/j.cmpb.2023.107403.
van Niekerk J, Krainski E, Rustand D, Rue H (2023). “A new avenue for Bayesian inference with INLA.” Computational Statistics & Data Analysis, 181, 107692. doi:10.1016/j.csda.2023.107692.
Examples
## Not run:
if(require("INLA", quietly=TRUE)){
## Load the sf object that contains the spatial polygons of the municipalities of Spain ##
data(Carto_SpainMUN)
str(Carto_SpainMUN)
## Create province IDs ##
Carto_SpainMUN$ID.prov <- substr(Carto_SpainMUN$ID,1,2)
## Load simulated data of lung cancer mortality data during the period 1991-2015 ##
data("Data_LungCancer")
str(Data_LungCancer)
## Disjoint model with a BYM2 spatial random effect, RW1 temporal random effect and ##
## Type I interaction random effect using 4 local clusters to fit the models in parallel ##
Disjoint <- STCAR_INLA(carto=Carto_SpainMUN, data=Data_LungCancer,
ID.area="ID", ID.year="year", O="obs", E="exp", ID.group="ID.prov",
spatial="BYM2", temporal="rw1", interaction="TypeI",
model="partition", k=0, strategy="gaussian",
plan="cluster", workers=rep("localhost",4))
summary(Disjoint)
## 1st-order nb. model with a BYM2 spatial random effect, RW1 temporal random effect and ##
## Type I interaction random effect using 4 local clusters to fit the models in parallel ##
order1 <- STCAR_INLA(carto=Carto_SpainMUN, data=Data_LungCancer,
ID.area="ID", ID.year="year", O="obs", E="exp", ID.group="ID.prov",
spatial="BYM2", temporal="rw1", interaction="TypeI",
model="partition", k=1, strategy="gaussian",
plan="cluster", workers=rep("localhost",4))
summary(order1)
}
## End(Not run)