Non-Linear Time Series and Artificial Neural Network of Red Hat Volatility
Non-Linear Time Series and Artificial Neural Network of Red Hat Volatility
Non-Linear Time Series and Artificial Neural Network of Red Hat Volatility
June 5, 2018
arXiv:1806.01070v1 [q-fin.CP] 4 Jun 2018
Abstract
We extend the empirical results published in the paper Empirical
Evidence on Arbitrage by Changing the Stock Exchange [2] by means of
machine learning and advanced econometric methodologies based on
Smooth Transition Regression models and Artificial Neural Networks.
1 Introduction
In this paper we examine wether there is a reduction in the Red Hat inc.
stock volatility during the moving from NASDAQ to New York Stock Ex-
change (NYSE) on December 12, 2006 [2]. We model the dynamics of the
volatility by means of non-linear autoregressive models and machine learning
approach. We mainly focus on three models: the Logistic smooth transition
regression model (LSTAR), the self-exciting threshold autoregressive model
(SETAR), and the neural network non-linear autoregressive model (NNET).
NASDAQ and NYSE are markets in which trade take place under very
different conditions. It seems natural to assume that Red Hat Inc. stock
dynamics suffers a change when markets are switched. We naturally allow
the stock price to consist of two different regimes or states of the world and
allow the dynamics to be different in the two regimes. One before the switch
of the markets and other after the switch of markets. Classical linear models
seem not to capture the complexity of this change. Non-linear models may
be more appropriate [1].
A popular set of models applied in different regimes are autoregressive
(AR) models such as SETAR and LSTAR models. These models are ex-
tentions of the linear AR models. They are easily estimated and intepreted
using regression methods.
We explore machine learning approach as an alternative semiparametric
method. The use of NNET has become very popular in the last two decades.
This is due to its capacity of learning the ”hidden” relationships in the data
without the necessity of supposing a particular parametric model. We con-
fine ourselfves to the applications of Artificial Neural Networks (ANN) and
1
do not consider other types of machine learning approches such as support
vector machines and other kernel based learning methods.
2 Data set
The data set includes 500 observations of daily closing prices of Red Hat
financial assets. These daily prices are sourced from the Federal Reserve
Bank of St. Louis Economic Data (FRED).
Unit root test, based on the non-linear Perron test, indicates that the
time series is non-stationary. We therefore choose to work with the first
difference of the logarithmic price. To perform the non-linear Perron test,
we first consider a one-time structural break at TB = ”December12, 2006”
with 1 < TB < T . The null hypothesis consists of a unit root with possible
non-zero drift which permits a structural change in the level and the growth
rate of the price series
where
( (
1 if t = TB + 1 1 if t > TB
D(T B) = and DUt =
0 otherwise 0 otherwise
where (
t − TB if t > TB
DTt =
0 otherwise.
To motivate the particular choice of the hypothesis test, we illustrate in
Figure 4(a), the trend of the Red Hat Inc.
After detrending the price series, we perform a Phillips-Perron test on
the residulas et . We do not reject the unit root hypothesis with Z-statistic
-2.8112 and p-value 0.235. We therefore use the logarithm of the first dif-
ferences of the price series.
2
(a) Structural break. (b) Logarithmic returns.
Figure 1: Time series plots of Red Hat Inc. stock price and returns. (a)
The trend of the price series shows a jump and a change of growth rate at
December 12, 2006. (b) Illustrates a possible reduction in the fluctuations
of the returns after the switch of markets on December 12, 2006.
We construct the realized volatility time series from the log returns with
a window of 60 days. The time series is smooth and tractable for modelling.
The series has a clear two regime with a definite structural break at the time
of market switch (see Figure 1). We consider other window alternatives such
as monthly or quarterly - 30 and 90 days respectively-. Although they have
clear economical meaning, they do not produce volatility trajectories which
are easily to model. The 30 days window produces a too wild fluctuation
series and the 90 days window produces a too short series for meaningful
statistics.
3
3 Econometric Methods
We use a non-linear autoregressive time series model in the analysis. Con-
sider a general time series autoregressive model that is generated by
Xt = φ + φ0 Xt−1 + . . . φp Xt−p + εt .
Xt = φ+φ0 Xt−1 +. . . φp Xt−p +G(Zt ; γ, c)(β +β0 Xt−1 +. . . βp Xt−p )+εt . (3)
If
1
G(Zt ; γ, c) = , γ > 0, (4)
1+ e−γ(Zt −c)
the logistic function and Zt is the threshold variable, the model is called
Logistic Smooth Transition model (LSTAR). The parameter c can be in-
terpreted as the thereshold and γ determines the speed and smoothness of
transition. The exponential form of the model (ESTAR) uses equation (3)
with
2
G(Zt ; γ, c) = 1 − e−γ(Zt −c) , γ > 0.
In the empirical study, we use the approach of Artificial Neural Networks
models (ANN). A neural network model with linear input, D hidden units
and activation function g, can be written as:
D m
!
X X
Xt = β0 + βj g γ0j + γij Xt−i + εt .
j=1 i=1
A leading example for the active function g is the logistic function (4).
Figure 3 illustrates the architecture of a feedforward network with 3 input
units, 4 hidden units, 1 output unit and shortcut connections.
4
Input Hidden Output
layer layer layer
Xt−2
Xt
Xt−3
Bias
γ0j
Xt−1 γ1j
Activate
function Output
Inputs Xt−2 γ2j
Σ g Xt
Xt−3 γ3j
Feedback error
Weights
4 Empirical Results
4.1 Nonlinear Time series Analysis
We perform a Teräsvirta test to detect the presence of a Logistic smooth
transition model. The test is based on a Taylor series expansion of the
general LSTAR model.
We take the third order Taylor approximation of the Logistic function
(4) with respect to ht = −γ(t − c) with threshold variable Zt = t evaluated
at ht = 0. The expansion has the form:
ht h3t
G(t; γ, c) ' −
4 48
so that
ht h3t
Xt = φ + φ0 Xt−1 + . . . φp Xt−p + (β + β0 Xt−1 + . . . βp Xt−p )( − ) + εt .
4 48
The first step is to estimate the linear portion of the AR(p) model to
5
determine the order p. A p order of one or zero AIC and BIC respectively
(see Table 1).
Table 1: Order selection for volatility. Best five AIC and BIC out of the first 20
lags.
p AIC BIC
0 -1308.18 -1810.94
1 -3125.22 -1804.89
2 -3123.25 -1799.36
3 -3121.80 -1793.28
4 -3119.81 -1787.21
We next select the functional form. Consider two LSTAR models with
order zero and one respectively :
The F-statistic for the entire regression is 6794; with four numerator and
434 denominator degrees of freedom, the regression is highly significant.
However, the probability value of F-statistic for the null hypothesis that
t = t2 = t3 = 0 in the auxiliary equation is 0.2547. Hence, there is weak
evidence of nonlinear behavior.
From Taylor series expansion for a first-order LSTAR model, we need to
regress the residuals from the linear model on the regressors (i.e, a constant
and Xt−1 ) and t, t2 and t3 multiplied by the regressors. The estimated
auxiliary regression is:
The F-statistic for the entire regression is 6973; with four numerator and 434
denominator degrees of freedom, the regression is highly significant. More-
over, the F-statistic for the presence of the nonlinear terms Xt t, Xt t2 and
Xt t3 is 5.14; with three numerator and 434 denominator degrees of freedom,
we can conclude that there is STAR behavior. Next, we can determine if
6
LSTAR or ESTAR behavior is the most appropriate. Given that the prob-
ability of the t-statistic on the coefficient for Xt−1 t is 0.00412, we cannot
exclude this expression from the auxiliary equation. Hence, we can rule out
ESTAR behavior in favor of LSTAR behavior.
The coefficients of the LSTAR model are estimated using non-linear
least squares. The gamma parameter is estimated by means of a grid search
ranging from 1 to 200 with step increament 0.002 and initial value 3.
The three regime SETAR model is the best in terms of AIC and BIC
with a value of -3199 and -3166 respectively. However, it does a bit worse
than the two regime LSTAR by about 0.1% MAPE. The neural net 1-2-1
with 7 weights faired the lowest MAPE of 2.99 %. It however performes
relatively poorly in terms of information criteria. Hence, this comparation
suggests a three regime SETAR versus a two regime LSTAR.
7
We examine various grapical analysis. Some of the results relating to
the SETAR model are shown in Figure.
0.8
Series
ACF
0.2
0.0
0 100 200 300 400 0 5 10 15 20 25
Time Lag
0.8
Series
ACF
−0.2
0.0
0 100 200 300 400 0 5 10 15 20 25
Time Lag
Figure 4:
regime
low
0.8
middle
high
0.6
time series values
0.4
0.2
Figure 5:
5 Conclusions
We examine wether there is a reduction in the Red Hat inc. stock volatility
during the moving from NASDAQ to New York Stock Exchange (NYSE) on
December 12, 2006. We used a variety of non-linear time series models which
included the following: self-exciting transition regression models, logistic
smooth transition and artifial neural networks. The Akaike and Bayesian
information and the mean absolute percentage error in forecasting were used
to compare across models. All models performed pretty well in terms of
MAPE with differences between 1.5% and 0.05%.
8
The self-exciting transition with three regimes model was clearly the best
option in terms of AIC and BIC. The fitted model captures all the features
of the data except the jump in the price of the Red Hat stock due to the
announcement and change of the financial markets. This is reflected in the
volatility residuals with four jumps, see Figure 4(a).
References
[1] Philip Hans Franses and Dick Van Dijk. Non-linear time series models
in empirical finance. Cambridge University Press, 2000.
[2] José Igor Morlanes, Antti Rasila, and Tommi Sottinen. Empirical evi-
dence on arbitrage by changing the stock exchange. Advances and Ap-
plications in Statistics, 12(2):223–233, 2009.