Skip to contents

Supported mvgam trend models

Details

mvgam currently supports the following dynamic trend models:

  • None (no latent trend component; i.e. the GAM component is all that contributes to the linear predictor, and the observation process is the only source of error; similarly to what is estimated by gam)

  • RW()

  • AR(p = 1, 2, or 3)

  • CAR(p = 1)(continuous time autoregressive trends; only available in Stan)

  • VAR()(only available in Stan)

  • PW() (piecewise linear or logistic trends; only available in Stan)

  • GP() (Gaussian Process with squared exponential kernel; only available in Stan)

For most dynamic trend types available in mvgam (see argument trend_model), time should be measured in discrete, regularly spaced intervals (i.e. c(1, 2, 3, ...)). However you can use irregularly spaced intervals if using trend_model = CAR(1), though note that any temporal intervals that are exactly 0 will be adjusted to a very small number (1e-12) to prevent sampling errors. For all trend types apart from GP(), PW(), and CAR(), moving average and/or correlated process error terms can also be estimated (for example, RW(cor = TRUE) will set up a multivariate Random Walk if data contains >1 series). Character strings can also be supplied instead of the various trend functions. The full list of possible models that are currently supported is:

  • 'RW'

  • 'RWMA'

  • 'RWcor'

  • 'RWMAcor'

  • 'AR1'

  • 'AR1MA'

  • 'AR1cor'

  • 'AR1MAcor'

  • 'AR2'

  • 'AR2MA'

  • 'AR2cor'

  • 'AR2MAcor'

  • 'AR3'

  • 'AR3MA'

  • 'AR3cor'

  • 'AR3MAcor'

  • 'CAR1'

  • 'VAR'

  • 'VARcor'

  • 'VAR1' (same as 'VAR')

  • 'VAR1cor' (same as 'VARcor')

  • 'VARMA'

  • 'VARMAcor'

  • 'VARMA1,1cor'

  • 'PWlinear'

  • 'PWlogistic'

  • 'GP'

  • 'None'

Note that only RW, AR1, AR2 and AR3 are available if using JAGS. All trend models are supported if using Stan. Dynamic factor models can be used in which the latent factors evolve as either RW, AR1-3, VAR or GP. For VAR models (i.e. VAR and VARcor models), users can either fix the trend error covariances to be 0 (using VAR) or estimate them and potentially allow for contemporaneously correlated errors using VARcor. For all VAR models, stationarity of the latent process is enforced through the prior using the parameterisation given by Heaps (2022). Stationarity is not enforced when using AR1, AR2 or AR3 models, though this can be changed by the user by specifying lower and upper bounds on autoregressive parameters using functionality in get_mvgam_priors and the priors argument in mvgam. Piecewise trends follow the formulation in the popular prophet package produced by Facebook, where users can allow for changepoints to control the potential flexibility of the trend. See Taylor and Letham (2018) for details

References

Sarah E. Heaps (2022) Enforcing stationarity through the prior in Vector Autoregressions. Journal of Computational and Graphical Statistics. 32:1, 1-10.

Sean J. Taylor and Benjamin Letham (2018) Forecasting at scale. The American Statistician 72.1, 37-45.

See also

RW, AR, CAR, VAR, PW, GP