mtar: Bayesian estimation of a multivariate Threshold...

View source: R/estimation.R

mtarR Documentation

Bayesian estimation of a multivariate Threshold Autoregressive (TAR) model.

Description

This function implements a Gibbs sampling algorithm to draw samples from the posterior distribution of the parameters of a multivariate Threshold Autoregressive (TAR) model and its special cases as SETAR and VAR models. The procedure accommodates a wide range of noise process distributions, including Gaussian, Student-t, Slash, Symmetric Hyperbolic, Contaminated normal, Laplace, Skew-normal, and Skew-Student-t.

Usage

mtar(
  formula,
  data,
  subset,
  Intercept = TRUE,
  trend = c("none", "linear", "quadratic"),
  nseason = NULL,
  ars = ars(),
  row.names,
  dist = c("Gaussian", "Student-t", "Hyperbolic", "Laplace", "Slash",
    "Contaminated normal", "Skew-Student-t", "Skew-normal"),
  prior = list(),
  n.sim = 500,
  n.burnin = 100,
  n.thin = 1,
  ssvs = FALSE,
  setar = NULL,
  progress = TRUE,
  ...
)

Arguments

formula

A three-part expression of class Formula describing the TAR model to be fitted. The first part specifies the variables in the multivariate output series, the second part defines the threshold series, and the third part specifies the variables in the multivariate exogenous series.

data

A data frame containing the variables in the model. If not found in data, the variables are taken from environment(formula), typically the environment from which mtar_grid() is called.

subset

An optional vector specifying a subset of observations to be used in the fitting process.

Intercept

An optional logical indicating whether an intercept should be included within each regime.

trend

An optional character string specifying the degree of deterministic time trend to be included in each regime. Available options are "linear", "quadratic", and "none". By default, trend is set to "none".

nseason

An optional integer, greater than or equal to 2, specifying the number of seasonal periods. When provided, nseason - 1 seasonal dummy variables are added to the regressors within each regime. By default, nseason is set to NULL, thereby indicating that the TAR model has no seasonal effects.

ars

A list defining the autoregressive structure of the model. It contains four components: the number of regimes (nregim), the autoregressive order within each regime (p), and the maximum lags for the exogenous (q) and threshold (d) series in each regime. The object can be validated using the helper function ars().

row.names

An optional variable in data labelling the time points corresponding to each row of the data set.

dist

A character string specifying the multivariate distributions used to model the noise process. Available options are "Gaussian", "Student-t", "Slash", "Hyperbolic", "Laplace", "Contaminated normal", "Skew-normal", and "Skew-Student-t". By default, dist is set to "Gaussian".

prior

An optional list specifying the hyperparameter values that define the prior distribution. This list can be validated using the priors() function. By default, prior is set to an empty list, thereby indicating that the hyperparameter values should be set so that a non-informative prior distribution is obtained.

n.sim

An optional positive integer specifying the number of simulation iterations after the burn-in period. By default, n.sim is set to 500.

n.burnin

An optional positive integer specifying the number of burn-in iterations. By default, n.burnin is set to 100.

n.thin

An optional positive integer specifying the thinning interval. By default, n.thin is set to 1.

ssvs

An optional logical indicating whether the Stochastic Search Variable Selection (SSVS) procedure should be applied to identify relevant lags of the output, exogenous, and threshold series. By default, ssvs is set to FALSE.

setar

An optional positive integer indicating the component of the output series used as the threshold variable. By default, setar is set to NULL, indicating that the fitted model is not a SETAR model.

progress

An optional logical indicating whether a progress bar should be displayed during execution. By default, progress is set to TRUE.

...

further arguments passed to or from other methods.

Value

an object of class mtar in which the main results of the model fitted to the data are stored, i.e., a list with components including

chains list with several arrays, which store the values of each model parameter in each iteration of the simulation,
n.sim number of iterations of the simulation after the burn-in period,
n.burnin number of burn-in iterations in the simulation,
n.thin thinning interval in the simulation,
ars list composed of four objects, namely: nregim, p, q and d, each of which corresponds to a vector of non-negative integers with as many elements as there are regimes in the fitted TAR model,
dist name of the multivariate distribution used to describe the behavior of the noise process,
threshold.series vector with the values of the threshold series,
output.series matrix with the values of the output series,
exogenous.series matrix with the values of the exogenous series,
Intercept If TRUE, then the model included an intercept term in each regime,
trend the degree of the deterministic time trend, if any,
nseason the number of seasonal periods, if any,
formula the formula,
call the original function call.

References

Nieto, F.H. (2005) Modeling Bivariate Threshold Autoregressive Processes in the Presence of Missing Data. Communications in Statistics - Theory and Methods, 34, 905-930.

Romero, L.V. and Calderon, S.A. (2021) Bayesian estimation of a multivariate TAR model when the noise process follows a Student-t distribution. Communications in Statistics - Theory and Methods, 50, 2508-2530.

Calderon, S.A. and Nieto, F.H. (2017) Bayesian analysis of multivariate threshold autoregressive models with missing data. Communications in Statistics - Theory and Methods, 46, 296-318.

Vanegas, L.H. and Calderón, S.A. and Rondón, L.M. (2025) Bayesian estimation of a multivariate tar model when the noise process distribution belongs to the class of gaussian variance mixtures. International Journal of Forecasting.

See Also

DIC, WAIC

Examples


###### Example 1: Returns of the closing prices of three financial indexes
data(returns)
fit1 <- mtar(~ COLCAP + BOVESPA | SP500, data=returns, row.names=Date,
             subset={Date<="2016-03-14"}, dist="Student-t",
             ars=ars(nregim=3,p=c(1,1,2)), n.burnin=2000, n.sim=3000,
             n.thin=2, ssvs=TRUE)
summary(fit1)

###### Example 2: Rainfall and two river flows in Colombia
data(riverflows)
fit2 <- mtar(~ Bedon + LaPlata | Rainfall, data=riverflows, row.names=Date,
             subset={Date<="2009-04-04"}, dist="Laplace", ssvs=TRUE,
             ars=ars(nregim=3,p=5), n.burnin=2000, n.sim=3000, n.thin=2)
summary(fit2)

###### Example 3: Temperature, precipitation, and two river flows in Iceland
data(iceland.rf)
fit3 <- mtar(~ Jokulsa + Vatnsdalsa | Temperature | Precipitation,
             data=iceland.rf, subset={Date<="1974-12-21"}, row.names=Date,
             ars=ars(nregim=2,p=15,q=4,d=2), n.burnin=2000, n.sim=3000,
             n.thin=2, dist="Slash")
summary(fit3)




mtarm documentation built on Jan. 12, 2026, 1:07 a.m.

Related to mtar in mtarm...