Overview
mtarm is an R package for Bayesian estimation, inference, model comparison, and forecasting in multivariate Threshold Autoregressive (TAR) models. The package supports multiple innovation distributions, automatic variable selection through Stochastic Search Variable Selection (SSVS), and both standard forecasting and rolling-origin forecast evaluation. The package accommodates multivariate TAR models with exogenous variables and allows for flexible error specifications, including Gaussian, Student-, skew-normal, skew-Student-, Laplace, slash, contaminated normal, and symmetric hyperbolic distributions.
Installation
Install the development version from GitHub:
remotes::install_github("lhvanegasp/mtarm")Load the package:
Main Features
Bayesian estimation of all model parameters in multivariate TAR models, except for the number of regimes.
Support for multiple threshold regimes and exogenous variables.
Automatic variable selection through Stochastic Search Variable Selection (SSVS).
Flexible innovation distributions, including heavy-tailed and skewed alternatives.
Standard forecasting and rolling-origin forecast evaluation.
Model comparison using the Deviance Information Criterion (DIC), Watanabe-Akaike Information Criterion (WAIC), log-score (LS), Energy Score (ES), Absolute Percentage Error (APE), and related predictive measures.
Residual diagnostics based on quantile-type residuals.
Integration with the
codapackage for convergence assessment and posterior analysis.Parallel model estimation and specification search through
mtar_grid().
Quick Start
The following example illustrates how a Student- model can be fitted on a bivariate output series:
library(mtarm)
data(returns)
fit <- mtar(~ COLCAP + BOVESPA | SP500, data=returns, row.names=Date,
subset={Date<="2015-12-07"}, dist="Student-t",
ars=ars(nregim=3,p=c(1,1,2)), n.burnin=1000, n.sim=2000,
n.thin=2)
summary(fit)Generate forecasts:
Documentation
Additional examples and detailed explanations are available in the package website:
https://lhvanegasp.github.io/mtarm/
Reference manual:
https://lhvanegasp.github.io/mtarm/reference/
Articles and vignettes:
Reproducibility
For reproducible analyses, users are encouraged to set a random seed before model estimation:
set.seed(6666)All examples included in the documentation website and package vignettes can be reproduced directly from the source code distributed with the package.