Fit a hierarchical time series model

fit_hts(
  formula,
  .data,
  special_index,
  family,
  verbose = TRUE,
  keep_data = TRUE,
  ...
)

Arguments

formula

formula must contain fixed effect terms and hts()

.data

a tsibble

special_index

The variable that represents time in your data

family

character.

verbose

default TRUE, whether to display message

keep_data

attach the data used to fit the model to the final model object?

...

list of options to pass to inlabru::bru, see ?inlabru::bru to see these options.

Value

inlabru model

How to allow weighting of observations?

To weight your observations, say when using empirical logit, you must provide a vector of variances, for each observation, which represents the uncertainty of measurement. You can do this, provided the family = "gaussian", add the argument, scale = vec, to fit_hts, where vec is a vector of variances for each observation.

Examples

if (FALSE) {
m <- fit_hts(
#inputs are  the levels of hierarchy, in order of decreasing size
formula = pr ~ avg_lower_age + hts(who_subregion, country),
.data = malaria_africa_ts,
family = "gaussian",
special_index = month_num
)
}