if (FALSE) {
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)
## Load the simulated cancer mortality data (three diseases) ##
data(Data_MultiCancer)
str(Data_MultiCancer)
## Fit the Global model with an iCAR prior for the within-disease random effects ##
Global <- MCAR_INLA(carto=Carto_SpainMUN, data=Data_MultiCancer,
ID.area="ID", ID.disease="disease", O="obs", E="exp",
prior="intrinsic", model="global", strategy="gaussian")
summary(Global)
## Fit the Disjoint model with an iCAR prior for the within-disease random effects ##
## using 4 local clusters to fit the models in parallel ##
Disjoint <- MCAR_INLA(carto=Carto_SpainMUN, data=Data_MultiCancer,
ID.area="ID", ID.disease="disease", O="obs", E="exp", ID.group="region",
prior="intrinsic", model="partition", k=0, strategy="gaussian",
plan="cluster", workers=rep("localhost",4))
summary(Disjoint)
## 1st-order neighbourhood model with an iCAR prior for the within-disease random effects ##
## using 4 local clusters to fit the models in parallel ##
order1 <- MCAR_INLA(carto=Carto_SpainMUN, data=Data_MultiCancer,
ID.area="ID", ID.disease="disease", O="obs", E="exp", ID.group="region",
prior="intrinsic", model="partition", k=1, strategy="gaussian",
plan="cluster", workers=rep("localhost",4))
summary(order1)
}
}
Run the code above in your browser using DataLab