predict.mtar: Forecasting for multivariate TAR models

View source: R/forecasting.R

predict.mtarR Documentation

Forecasting for multivariate TAR models

Description

Computes forecasts from a fitted multivariate Threshold Autoregressive (TAR) model.

Usage

## S3 method for class 'mtar'
predict(
  object,
  ...,
  newdata,
  n.ahead = NULL,
  row.names,
  credible = 0.95,
  out.of.sample = FALSE,
  rolling = NULL
)

Arguments

object

An object of class mtar obtained from a call to mtar().

...

Additional arguments that may affect the prediction method.

newdata

An optional data.frame containing future values of the threshold series (if included in the fitted model), the exogenous series (if included in the fitted model), and, when out.of.sample = TRUE, the realized values of the output series.

n.ahead

A positive integer specifying the number of steps ahead to forecast.

row.names

An optional variable in newdata specifying labels for the time

credible

An optional numeric value in (0,1) specifying the level of the required credible intervals. By default, credible is set to 0.95.

out.of.sample

An optional logical indicator. If TRUE then the log-score, Energy-Score (ES), Absolute Error (AE), Absolute Percentage Error (APE), Squared Error (SE), are computed as measures of predictive accuracy. In this case, newdata must include the observed values of the output series.

rolling

An optional positive integer specifying the rolling-window size used for forecasting with fixed parameters. By default, rolling = NULL, indicating that rolling-window forecasting is not performed.

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.

Karlsson, S. (2013) Chapter 15-Forecasting with Bayesian Vector Autoregression. In Elliott, G. and Timmermann, A. Handbook of Economic Forecasting, Volume 2, 791–89, Elsevier.

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.

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<="2015-12-07"}, dist="Student-t",
             ars=ars(nregim=3,p=c(1,1,2)), n.burnin=1000, n.sim=2000,
             n.thin=2)
p1 <- predict(fit1, newdata=subset(returns,Date>"2015-12-07"), n.ahead=75,
              credible=0.8, out.of.sample=TRUE)
with(p1,summary)
with(p1,cbind(LS,ES,APE,CR))
plot(p1,last=100)

###### Example 2: Rainfall and two river flows in Colombia
data(riverflows)
fit2 <- mtar(~ Bedon + LaPlata | Rainfall, data=riverflows, row.names=Date,
             subset={Date<="2009-02-13"}, dist="Laplace",
             ars=ars(nregim=3,p=5), n.burnin=1000, n.sim=2000, n.thin=2)
p2 <- predict(fit2, newdata=subset(riverflows,Date>"2009-02-13"), n.ahead=60,
              credible=0.8, out.of.sample=TRUE)
with(p2,summary)
with(p2,cbind(LS,ES,APE,CR))
plot(p2,last=100)

###### 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-11-06"}, row.names=Date,
             ars=ars(nregim=2,p=15,q=4,d=2), n.burnin=1000, n.sim=2000,
             n.thin=2, dist="Slash")
p3 <- predict(fit3, newdata=subset(iceland.rf,Date>"1974-11-06"), n.ahead=55,
              credible=0.8, out.of.sample=TRUE)
with(p3,summary)
with(p3,cbind(LS,ES,APE,CR))
plot(p3,last=100)

###### Example 4: U.S. stock returns
data(US.returns)
fit4 <- mtar(~ CCR | dVIX, data=US.returns, subset={Date<="2025-11-28"},
             row.names=Date, ars=ars(nregim=2,p=3,d=3), n.burnin=1000,
             n.sim=2000, n.thin=2, dist="Student-t")
p4 <- predict(fit4, newdata=subset(US.returns,Date>"2025-11-28"),n.ahead=100,
              credible=0.8, out.of.sample=TRUE)
with(p4,summary)
with(p4,cbind(LS,ES,APE,CR))
plot(p4,last=100)



mtarm documentation built on June 12, 2026, 5:07 p.m.