CAR_INLA | R Documentation |
Fit a spatial Poisson mixed model to areal count data. The linear predictor is modelled as
\log{r_{i}}=\alpha+\mathbf{x_i}^{'}\mathbf{\beta} + \xi_i, \quad \mbox{for} \quad i=1,\ldots,n;
where \alpha
is a global intercept, \mathbf{x_i}^{'}=(x_{i1},\ldots,x_{ip})
is a p-vector of standardized covariates in the i-th area,
\mathbf{\beta}=(\beta_1,\ldots,\beta_p)
is the p-vector of fixed effects coefficients, and \xi_i
is a spatially structured random effect.
Several conditional autoregressive (CAR) prior distributions can be specified for the spatial random effect, such as the intrinsic CAR prior \insertCitebesag1991bigDM, the convolution or BYM prior \insertCitebesag1991bigDM,
the CAR prior proposed by \insertCiteleroux1999estimation;textualbigDM, and the reparameterization of the BYM model given by \insertCitedean2001detecting;textualbigDM named BYM2 \insertCiteriebler2016intuitivebigDM.
If covariates are included in the model, two different approaches can be used to address the potential confounding issues between the fixed effects and the spatial random effects of the model: restricted regression and the use of orthogonality constraints.
At the moment, only continuous covariates can be included in the model as potential risk factors, which are automatically standardized before fitting the model. See \insertCiteadin2021alleviating;textualbigDM for further details.
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"
and k=0
arguments)
a modelling approach where k-order neighbours are added to each partition to avoid border effects in the Disjoint model (model="partition"
and k>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 \insertCitebengtsson2020unifyingbigDM.
Inference is conducted in a fully Bayesian setting using the integrated nested Laplace approximation (INLA; \insertCiterue2009approximate;textualbigDM) technique through the R-INLA package (https://www.r-inla.org/). For the scalable model proposals \insertCiteorozco2020bigDM, 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 \insertCitevanNiekerk2023bigDM by including the inla.mode="compact"
argument.
CAR_INLA(
carto = NULL,
ID.area = NULL,
ID.group = NULL,
O = NULL,
E = NULL,
X = NULL,
confounding = NULL,
W = NULL,
prior = "Leroux",
model = "partition",
k = 0,
strategy = "simplified.laplace",
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
)
carto |
object of class |
ID.area |
character; name of the variable that contains the IDs of spatial areal units. |
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 units. |
E |
character; name of the variable that contains either the expected number of disease cases or the population at risk for each areal unit. |
X |
a character vector containing the names of the covariates within the |
confounding |
one of either |
W |
optional argument with the binary adjacency matrix of the spatial areal units. If |
prior |
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 |
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 |
For a full model specification and further details see the vignettes accompanying this package.
This function returns an object of class inla
. See the mergeINLA
function for details.
adin2021alleviatingbigDM
\insertRefbengtsson2020unifyingbigDM
\insertRefbesag1991bigDM
\insertRefdean2001detectingbigDM
\insertRefleroux1999estimationbigDM
\insertRefriebler2016intuitivebigDM
\insertRefrue2009approximatebigDM
\insertReforozco2020bigDM
\insertRefvanNiekerk2023bigDM
## Not run:
if(require("INLA", quietly=TRUE)){
## Load the Spain colorectal cancer mortality data ##
data(Carto_SpainMUN)
## Global model with a Leroux CAR prior distribution ##
Global <- CAR_INLA(carto=Carto_SpainMUN, ID.area="ID", O="obs", E="exp",
prior="Leroux", model="global", strategy="gaussian")
summary(Global)
## Disjoint model with a Leroux CAR prior distribution ##
## using 4 local clusters to fit the models in parallel ##
Disjoint <- CAR_INLA(carto=Carto_SpainMUN, ID.area="ID", ID.group="region", O="obs", E="exp",
prior="Leroux", model="partition", k=0, strategy="gaussian",
plan="cluster", workers=rep("localhost",4))
summary(Disjoint)
## 1st-order neighbourhood model with a Leroux CAR prior distribution ##
## using 4 local clusters to fit the models in parallel ##
order1 <- CAR_INLA(carto=Carto_SpainMUN, ID.area="ID", ID.group="region", O="obs", E="exp",
prior="Leroux", model="partition", k=1, strategy="gaussian",
plan="cluster", workers=rep("localhost",4))
summary(order1)
## 2nd-order neighbourhood model with a Leroux CAR prior distribution ##
## using 4 local clusters to fit the models in parallel ##
order2 <- CAR_INLA(carto=Carto_SpainMUN, ID.area="ID", ID.group="region", O="obs", E="exp",
prior="Leroux", model="partition", k=2, strategy="gaussian",
plan="cluster", workers=rep("localhost",4))
summary(order2)
}
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.