# Build cross-basis with a custom prefix for columns
# Import example data set
data("dengue_MS")
lag_mat <- lag_cov(data = dengue_MS,
name = c("tmin"),
time = "date",
lag = c(1:6),
group = "micro_code",
add = FALSE) # add = FALSE return only the lagged matrix
cb_inla <- crossbasis_inla(
covariate = lag_mat,
basis_name = "tempLag",
lag = c(1,6),
argvar = list(fun = "bs", df = 3),
arglag = list(fun = "poly", degree = 2)
)
# Check class of the cross-basis object
class(cb_inla)
# View resulting cross-basis matrix
head(colnames(cb_inla))
Run the code above in your browser using DataLab