# Define covariates of interest
covs <- c("tmin.l1", "tmin.l2", "pdsi.l1", "pdsi.l2", "urban_level")
# Combine covariate names using a pattern-matching functionality
combined_covariates <- cov_multi(
covariates = covs,
pattern = c("tmin", "pdsi", "urban_level")
)
# Define hyperprior specifications for random effects
prior_re1 <- list(prec = list(prior = "loggamma", param = c(0.01, 0.01)))
prior_re2 <- list(prec = list(prior = "loggamma", param = c(0.01, 0.01)))
prior_re3 <- list(
prec = list(prior = "pc.prec", param = c(0.5 / 0.31, 0.01)),
phi = list(prior = "pc", param = c(0.5, 2 / 3))
)
# Write a set of INLA-compatible model formulas
inla_formulas <- write_inla_formulas(
outcome = "dengue_cases",
covariates = combined_covariates,
re1 = list(
id = "month_id",
model = "rw1",
cyclic = TRUE,
hyper = "prior_re1",
replicate = "spat_meso_id"
),
re2 = list(
id = "year_id",
model = "rw1",
hyper = "prior_re2"
),
re3 = list(
id = "spat_id",
model = "iid",
hyper = "prior_re3"
),
baseline = TRUE
)
Run the code above in your browser using DataLab