create formula to pass to inlabru::bru
build_bru_formula(formula, .data, special_index)
formula with an hts() term
tsibble data
special index term
formula
bru_form <- build_bru_formula(
formula = pr ~ avg_lower_age + hts(who_subregion, country),
.data = malaria_africa_ts,
special_index = month_num
)
bru_form
#> pr ~ avg_lower_age + (who_subregion(month_num, model = "ar1",
#> group = .who_subregion_id, constr = FALSE) + country(month_num,
#> model = "ar1", group = .country_id, constr = FALSE))
#> <environment: 0x7fb8c81d8770>