BAYSTAR {BAYSTAR}R 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)

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=1000)

Details

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

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

where th is the threshold value for regime switching; z_{t} is the threshold variable; d is the delay lag of threshold variable; and the error term a_t^{(j)}, j, (j=1,2), for each regime is assumed to be an i.i.d. Gaussian white noise process with mean zero and variance sigma_j^2, j=1,2. 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

library(BAYSTAR)
data(unemployrate)
x<- unemployrate
nx<- length(x)
differ.x<- x[2:nx]-x[2:nx-1]
lagp1<- c(2,3,4,10,12)
lagp2<- c(2,3,12)

## Total MCMC iterations and burn-in iterations
Iteration<- 10000
Burnin<- 2000

## A RW (random walk) MH algorithm is used in simulating the threshold value
## Step size for the RW MH

step.thv<- 2.5

out1 <- BAYSTAR(differ.x,lagp1,lagp2,Iteration,Burnin,constant=0,step.thv=step.thv)

d0 <- 4
out2 <- BAYSTAR(differ.x,lagp1,lagp2,Iteration,Burnin,d0,constant=0,step.thv=step.thv)

## Comparison with DIC

library(coda)
geweke.diag(out2$posterior, frac1=0.1, frac2=0.5)

[Package BAYSTAR version 0.2-3 Index]