Foreign Exchange [Part 3 : Non-Linear Models]

The previous post examined exchange rate predictability (in-sample) in the context of various linear models. Since economic and financial systems are known to traverse structural and behavioural changes, different time series / economic models may be required to explain the empirical data at different times. Non-linear modelling in economic/financial times series presupposes the existence of different states of the world (i.e. regimes) and the possibility of time series dynamics to vary across regimes.

There are generally two ways to test the existence of non-linearity. In the absence of any prior knowledge about non-linear structures in the data, Ramsay’s RESET test, Tsay test and the BDS test could be used to determine their existence. By contrast, if a specific form of non-linearity is suggested by economic or financial theory, it is preferable to test for this perceived structure and construct the requisite model.

In this post the Threshold Vector Autoregressive Model (TVAR) and Self-exciting Threshold Autoregression (SETAR) models will be applied to some subset of the data for GBP and CAD currency pairs. Neither the Multivariate Markov Switching Model nor the Smoothed Transition Autoregressive Regression models (STAR) will be utilised; finding no working packages for the former and the data failing suitability tests with respect to the latter model.

Fitting the TVAR model requires specifying , among other parameters, [1] the threshold variable (the evolution of which governs different regimes) and [2] the number of regimes. After looping through various variables in the dataset, the change in money supply and the change in price index appear to yield the best results (lowest rmse) for the CAD and GBP currency pairs respectively. The SETAR model is a special kind of TAR model where the dependent variable is also  the threshold variable.

Since it is basically the same, only the code for the CAD/USD pair is shown.

```#Fundamentals
windows(width=14,height=12)
layout(matrix(c(1,1,2,3,1,1,2,3),nrow=4,ncol=2,byrow=F))
par(mai=c(0,0.55,0.30,0.1))

cad.tvar&lt;-TVAR(include='both',cad.tar.dat, lag=1, nthresh=2, thDelay=1, trim=0.25, mTh=5, plot=F)

plot(cex.lab=1,cex.axis=0.75,cad.diff[2:313,1]*100,type='p',xaxt='n',xlab='',ylab='CAD/USD returns',col='black',main='Threshold Vector Autoregression For CAD/USD \n 2 Thresholds and 3 Regimes',cex.main=0.85)
grid()
lines(fx*100,col='purple')
legend(bty='n','bottomleft',legend=c('Actual','Fitted'),fill=c('black','purple'),ncol=1,cex=1)

par(mai=c(0,0.55,0,0.1))
legend(bty='n','bottomright',legend=c('Low Regime','Middle Regime','High Regime'),fill=c('red','blue','green'),ncol=3,cex=1)
text(adj=0,col=&quot;black&quot;,0,max(cad.diff[2:313,5])*100+0.4,'Threshold Variable : Change in Money Supply',font=2,cex=1)

par(mai=c(0.5,0.55,0,0.1))
plot(lwd=1,xaxt='n',ylab='Regime Index',xlab='',cex.axis=0.8,cex.lab=1,r,type='h',col=ifelse(r==1,'red',ifelse(r==2,'blue','green')))
axis(tick=FALSE,1, at=1:312, labels=rownames(r),las=1,cex.axis=0.8,las=1,cex=0.8)
```

The first plot shows the actual CAD/USD returns aswell as the fitted data. Compared to linear models, the RMSE of the TV AR model is clearly superior, providing some support for non-linear models even against the BMA technique. The second plot depicts the evolution of the threshold variable; the dotted horizontal lines representing the 2 thresholds which separate the data into 3 regimes. The final plot depicts the regime to which values of the threshold variable belongs. Each regime is associated with a different model.

Next let’s plot the results for the SETAR model.

```# Setar

f&lt;-fitted(a)[3:313]

fx&lt;-fitted(s)[3:313]

windows(width=14,height=12)
layout(matrix(c(1,1,2,1,1,2),nrow=3,ncol=2,byrow=F))
par(mai=c(0,0.55,0.30,0.1))

r&lt;-matrix(regime(s)[3:313])

plot(cex.lab=1,cex.axis=0.75,cad.diff[3:313,1],type='p',xaxt='n',xlab='',ylab='CAD/USD returns',col='black',main='SETAR(2) VS ARIMA (1,0,0) For CAD/USD \n 2 Thresholds and 3 Regimes',cex.main=0.85)
grid()
abline(h=m\$th[1],col='black',lty='dotted')
abline(h=m\$th[2],col='black',lty='dotted')
lines(f,col='darkorange')
lines(fx,col='purple')
legend(bty='n','bottomleft',legend=c('Actual','Fitted-ARIMA(1,0,0)','Fitted-SETAR(2)','Low Regime','Middle Regime','High Regime'),fill=c('black','darkorange','purple','red','blue','green'),ncol=1,cex=1)
text(adj=0,col=&quot;black&quot;,nrow(r)/2-40,min(ca.orig[3:313,1]),paste('SETAR-RMSE :: ',rm,'   ARIMA-RMSE ::',arerr),font=2,cex=1)

par(mai=c(0.5,0.55,0,0.1))
plot(lwd=1,xaxt='n',ylab='Regime Index',xlab='',cex.axis=0.8,cex.lab=1,r,type='h',col=ifelse(r==1,'red',ifelse(r==2,'blue','green')))