BAYSTAR: Threshold Autoregressive model: Bayesian approach

View source: R/BAYSTAR.R

BAYSTARR Documentation

Threshold Autoregressive model: Bayesian approach

Description

Bayesian estimation and one-step-ahead forecasting for two-regime TAR model, as well as monitoring MCMC convergence. One may want to allow for higher-order AR models in the different regimes. Parsimonious subset AR could be assigned in each regime in the BAYSTAR function rather than a full AR model (i.e. the autoregressive orders could be not a continuous series).

Usage


BAYSTAR(x, lagp1, lagp2, Iteration, Burnin, constant, d0, 
        step.thv, thresVar, mu01, v01, mu02, v02, v0, lambda0, refresh,tplot)

Arguments

x

A vector of time series.

lagp1

A vector of non-zero autoregressive lags for the lower regime (regime one). For example, an AR model with p1=3 in lags 1,3, and 5 would be set as lagp1<-c(1,3,5).

lagp2

A vector of non-zero autoregressive lags for the upper regime (regime two).

Iteration

The number of MCMC iterations.

Burnin

The number of burn-in iterations for the sampler.

constant

The intercepts include in the model for each regime, if constant=1. Otherwise, if constant=0. (Default: constant=1)

d0

The maximum delay lag considered. (Default: d0 = 3)

step.thv

Step size of tuning parameter for the Metropolis-Hasting algorithm.

thresVar

A vector of time series for the threshold variable. (if missing, the series x is used.)

mu01

The prior mean of phi in regime one. This setting can be a scalar or a column vector with dimension equal to the number of phi. If this sets a scalar value, then the prior mean for all of phi are this value. (Default: a vector of zeros)

v01

The prior covariance matrix of phi in regime one. This setting can either be a scalar or a square matrix with dimensions equal to the number of phi. If this sets a scalar value, then prior covariance matrix of phi is that value times an identity matrix. (Default: a diagonal matrix are set to 0.1)

mu02

The prior mean of phi in regime two. This setting can be a scalar or a column vector with dimension equal to the number of phi. If this sets a scalar value, then the prior mean for all of phi are this value. (Default: a vector of zeros)

v02

The prior covariance matrix of phi in regime two. This setting can either be a scalar or a square matrix with dimensions equal to the number of phi. If this sets a scalar value, then prior covariance matrix of phi is that value times an identity matrix. (Default: a diagonal matrix are set to 0.1)

v0

v0/2 is the shape parameter for Inverse-Gamma prior of sigma^2. (Default: v0 = 3)

lambda0

lambda0*v0/2 is the scale parameter for Inverse-Gamma prior of sigma^2. (Default: lambda0 = the residual mean squared error of fitting an AR(p1) model to the data.)

refresh

Each refresh iteration for monitoring MCMC output. (Default: refresh=Iteration/2)

tplot

Trace plots and ACF plots for all parameter estimates. (Default: tplot=FALSE )

Details

Given the maximum AR orders p1 and p2, the two-regime SETAR(2:p1;p2) model is specified as:

x_{t} = ( φ _0^{(1)} + φ _1^{(1)} x_{t - 1} + … + φ _{p1 }^{(1)} x_{t - p1 } + a_t^{(1)} ) I( z_{t-d} <= th) + ( φ _0^{(2)} + φ _1^{(2)} x_{t - 1} + … + φ _{p2 }^{(2)} x_{t - p2 } + a_t^{(2)} I( z_{t-d} > th)

where is the threshold value for regime switching; is the threshold variable; is the delay lag of threshold variable; and the error term , , for each regime is assumed to be an i.i.d. Gaussian white noise process with mean zero and variance . I(A) is an indicator function. Event A will occur if I(A)=1 and otherwise if I(A)=0. One may want to allow parsimonious subset AR model in each regime rather than a full AR model.

Value

A list of output with containing the following components:

mcmc

All MCMC iterations.

posterior

The initial Burnin iterations are discarded as a burn-in sample, the final sample of (Iteration-Burnin) iterates is used for posterior inference.

coef

Summary Statistics of parameter estimation based on the final sample of (Iteration-Burnin) iterates.

residual

Residuals from the estimated model.

lagd

The mode of time delay lag of the threshold variable.

DIC

The deviance information criterion (DIC); a Bayesian method for model comparison (Spiegelhalter et al, 2002)

Author(s)

Cathy W. S. Chen, Edward M.H. Lin, F.C. Liu, and Richard Gerlach

Examples


set.seed(989981)
## Set the true values of all parameters
nob<- 200                ## No. of observations
lagd<- 1                  ## delay lag of threshold variable
r<- 0.4                   ## r is the threshold value
sig.1<- 0.8; sig.2<- 0.5  ## variances of error distributions for two regimes
p1<- 2; p2<- 1            ## No. of covariate in two regimes
ph.1<- c(0.1,-0.4,0.3)    ## mean coefficients for regime 1
ph.2<- c(0.2,0.6)     ## mean coefficients for regime 2
lagp1<-1:2
lagp2<-1:1

yt<- TAR.simu(nob,p1,p2,ph.1,ph.2,sig.1,sig.2,lagd,r,lagp1,lagp2)


## Total MCMC iterations and burn-in iterations
Iteration <- 500
Burnin    <- 200


## A RW (random walk) MH algorithm is used in simulating the threshold value
## Step size for the RW MH
step.thv<- 0.08

out <- BAYSTAR(yt,lagp1,lagp2,Iteration,Burnin,constant=1,step.thv=step.thv,tplot=TRUE)

BAYSTAR documentation built on May 15, 2022, 1:06 a.m.

Related to BAYSTAR in BAYSTAR...