# Load example GHRmodels object from the package
model_dlnm_file <- system.file("examples", "model_dlnm.rds", package = "GHRmodel")
model_dlnm <- readRDS(model_dlnm_file)
# Load example cross-basis matrix from the package: 2-dimensional cross-basis matrix of the
# non-linear effect of dengue risk across tmin values and lags:
cb_tmin_file <- system.file("examples","cb_tmin.rds", package = "GHRmodel")
cb_tmin <- readRDS(cb_tmin_file) # loads cross-basis matrix into the environment
# Generate predictions
pred_result <- crosspred_inla(
models = model_dlnm,
basis = cb_tmin,
mod_id = "mod3",
at = seq(17, 24, by = 1), # e.g., temperature sequence
lag = 2,
cen = 20,
ci.level = 0.95
)
# Inspect predictions
pred_result$predvar # the sequence of 'at' values
pred_result$allfit # fitted values
pred_result$alllow # lower CI
pred_result$allhigh # upper CI
Run the code above in your browser using DataLab