You are on page 1of 16

UECM3243 Time Series Analysis / UECM3493 Introduction to Time Series and Forecasting /

UECM3773 Financial Time Series

CHAPTER 1 FUNDAMENTAL CONCEPTS

1.1. Introduction to Time Series


FORECASTS AND TIME SERIES
A forecast is a prediction of future events and conditions, and the act of making such prediction
is called forecasting. Most forecasting problems involve the use of time series data. A time
series is a time-oriented or chronological sequence of observations on a variable of interest.

The components of a time series data.


 Trend, T
→ the smooth long-term direction of a time series
 Seasonal variations, S
→ patterns of change in a time series within a year
→ these patterns tend to repeat themselves each year
 Cyclical variations, C
→ the rise and fall of a time series over periods longer than one year
 Irregular fluctuations, I
→ erratic or residual fluctuations

Page 1 of 16
UECM3243 Time Series Analysis / UECM3493 Introduction to Time Series and Forecasting /
UECM3773 Financial Time Series

The time series components do not always occur alone. They can occur in any combination or
all can occur together. For this reason, no single best forecasting model exits. In fact, there are
many forecasting methods that can be used to predict future events.

Forecasting Methods

QUALITATIVE FORECASTING METHODS QUANTITATIVE FORECASTING METHODS

1. Delphi methods 1. Averaging methods


2. Subjective curve fitting 2. Decomposition methods
3. Technological comparison 3. Exponential smoothing methods
4. Judgemental forecasting methods 4. Box-Jenkins methods
5. Regression analysis

Page 2 of 16
UECM3243 Time Series Analysis / UECM3493 Introduction to Time Series and Forecasting /
UECM3773 Financial Time Series

1.2. Financial Data and Their Properties


Financial time series analysis is always concerned with theory and practice of asset valuation
over time.

ASSET RETURNS
Let Pt be the price of an asset at time t , and assume no dividend.

One-Period Simple Return.


Pt
1  Rt  gross return
Pt 1
Pt
Rt  1 net return
Pt 1

Multiperiod Simple Return.


P P P Pt  k 1
1  Rt  k   t  t  t 1  
Pt k Pt 1 Pt  2 Pt k gross return
 1  Rt 1  Rt 1 1  Rt 2  1  Rt k 1 
k 1
  1  Rt  j  compound return
j 0

Pt
Rt  k   1 net return
Pt  k

Continuously Compounded Return / Log Return.


 P 
rt  ln 1  Rt   ln  t   ln  Pt   ln  Pt 1 
 Pt 1 
Rt  ert  1

Continuously Compounded Multiperiod Return / Multiperiod Log Return.


rt  k   ln 1  Rt  k 
 ln 1  Rt 1  Rt 1 1  Rt  2  1  Rt k 1 
 ln 1  Rt   ln 1  Rt 1    ln 1  Rt  k 1 
 rt  rt 1   rt  k 1

Dividend Payment.
Let Pt be the price of an asset at time t
Dt be the dividend payment of an asset between dates t  1 and t

The simple net return and continuously compounded return at time t become
P  Dt
Rt  t 1 , rt  ln  Pt  Dt   ln  Pt 1  .
Pt 1

Page 3 of 16
UECM3243 Time Series Analysis / UECM3493 Introduction to Time Series and Forecasting /
UECM3773 Financial Time Series

Example 1.1.
Table below gives six daily (adjusted) closing prices of Apple stock in December 2017.

Date 21/12 22/12 26/12 27/12 28/12 29/12


Price ($) 175.01 175.01 170.57 170.60 171.08 169.23

Compute the gross return, simple return and log return of holding the stock from
(a) 27/12 to 28/12,
(b) 22/12 to 29/12.
Solution:

Example 1.2.
(a) Given the monthly log return of an asset is 4.46%. Find the corresponding monthly
simple return.
(b) Given the monthly log returns of an asset within a quarter are 4.46%, -7.34% and
10.77%. Find the quarterly log return.
(c) Given the monthly simple returns of an asset are 4.46%, -7.34% and 10.77%. Find the
quarterly simple return.
Solution:

Page 4 of 16
UECM3243 Time Series Analysis / UECM3493 Introduction to Time Series and Forecasting /
UECM3773 Financial Time Series

DISTRIBUTIONAL PROPERTIES OF RETURNS


Estimation.
Let  x1 , , xT  be a random sample of X with T observations.
 Sample mean
1 T
ˆ x   xt
T t 1
 Sample variance
1 T
ˆ x2    xt  ˆ x 
2

T  1 t 1
 Sample skewness
T
1
3  t
Sˆ  x   x  ˆ x 
3

T  1 ˆ x t 1
 Sample kurtosis
T
1
Kˆ  x     x  ˆ 
4

T  1 ˆ x4 t 1
t x

Under normality assumption,


 6
Sˆ  x  ~ N  0,  , Kˆ  x   3 ~ N  0,1 .
 T

Some simple tests for normality (for large T ).


 Test for skewness
H0 : S  x  0
H1 : S  x   0
Sˆ  x 
S*  ~ N  0,1
6/T
Decision rule: Reject H 0 of a symmetric distribution if S *  Z or p  value   .
2

 Test for excess kurtosis


H0 : K  x  3  0
H1 : K  x   3  0
Kˆ  x   3
K*  ~ N  0,1
24 / T
Decision rule: Reject H 0 of normal tail if K *  Z or p  value   .
2

 Jarque-Bera test (joint test)


JB   K *    S *  ~  22
2 2

where  22 denotes a chi-squared distribution with 2 degrees of freedom.


Decision rule: Reject H 0 of normality if JB   22   or p  value   .

Page 5 of 16
UECM3243 Time Series Analysis / UECM3493 Introduction to Time Series and Forecasting /
UECM3773 Financial Time Series

Example 1.3.
Consider the daily log returns of the Sony stock from 04/01/2010 to 29/12/2017. The time plot
of the data is given below.

Here, we use the command basicStats of fBasics in Rmetrics to obtain summary statistics of the
log returns and to perform some basic hypothesis testing.

From the output, we see that there are data points, the sample mean of the log
return is or , and the sample standard error is .
The sample skewness and excess kurtosis are and
respectively.

Next, let  denotes the mean of the daily Sony log return.
H0 :   0
H1 :   0

  0.05 , p-value =

For the skewness test,


H0 : S  x  0
H1 : S  x   0

  0.05 , p-value ≈

Page 6 of 16
UECM3243 Time Series Analysis / UECM3493 Introduction to Time Series and Forecasting /
UECM3773 Financial Time Series

For the excess kurtosis,


H0 : K  x  3  0
H1 : K  x   3  0

  0.05 , p-value =

Note. The test statistics value is huge, which is large compared with a standard normal random
variable. Thus the p-value is close to zero and hence reject H 0 .

For Jarque-Bera test,

  0.05 , p-value 

Note. The Jarque-Bera test statistic from the output is 1870.7536, which is very large compared
with a chi-square distribution with 2 degrees of freedom.

Page 7 of 16
UECM3243 Time Series Analysis / UECM3493 Introduction to Time Series and Forecasting /
UECM3773 Financial Time Series

R demonstration
> library(fBasics)
> sony=read.table("sne1017.txt", header=T)
> head(sony)
SNE.Open SNE.High SNE.Low SNE.Close SNE.Volume SNE.Adjusted
1 29.52 30.18 29.50 30.02 988800 27.62975
2 29.72 29.93 29.50 29.88 567800 27.50090
3 29.88 29.95 29.66 29.85 468200 27.47329
4 29.74 29.87 29.59 29.80 645300 27.42727
5 30.04 30.47 29.93 30.41 574100 27.98870
6 30.72 30.75 30.39 30.60 603200 28.16357
> sony.lrtn=diff(log(sony$SNE.Adjusted)) # compute daily log returns
> head(sony.lrtn) # show the first 6 rows of data
[1] -0.004674540 -0.001004544 -0.001676450 0.020263156
[5] 0.006228548 0.031207366
> tdx=c(1:2012)/252+2010 # calender time
> plot(tdx, sony.lrtn, xlab="year", ylab="log return", type="l")
# note that type = small letter L not one
> title(main="Sony Corporation")
> basicStats(sony.lrtn) # compute descriptive statistics of log returns
sony.lrtn
nobs 2012.000000
NAs 0.000000
Minimum -0.118491
Maximum 0.162913
1. Quartile -0.011236
3. Quartile 0.010880
Mean 0.000242
Median -0.000325
Sum 0.486658
SE Mean 0.000467
LCL Mean -0.000675
UCL Mean 0.001158
Variance 0.000439
Stdev 0.020961
Skewness 0.300098
Kurtosis 4.677912
> ## simple test
> t.test(sony.lrtn) # testing the mean log return = 0
One Sample t-test
data: sony.lrtn
t = 0.51761, df = 2011, p-value = 0.6048
alternative hypothesis: true mean is not equal to 0
95 percent confidence interval:
-0.0006745549 0.0011583098
sample estimates:
mean of x
0.0002418775
> s3=skewness(sony.lrtn)
> s3
[1] 0.3000975
attr(,"method")
[1] "moment"
> T=length(sony.lrtn) # sample size
> t3=s3/sqrt(6/T) # skewness test
> t3
[1] 5.495418
attr(,"method")
[1] "moment"
> pv1=2*(1-pnorm(t3)) # compute p-value
> pv1
[1] 3.897854e-08
attr(,"method")
[1] "moment"
> s4=kurtosis(sony.lrtn) # this is excess kurtosis
> s4
[1] 4.677912
attr(,"method")
[1] "excess"
> t4=s4/sqrt(24/T) # kurtosis test
> t4
[1] 42.83122
attr(,"method")
[1] "excess"
> pv2=2*(1-pnorm(t4)) # compute p-value
> pv2
[1] 0
attr(,"method")
[1] "excess"
> normalTest(sony.lrtn, method="jb") # JB test
Title:
Jarque - Bera Normalality Test
Test Results:
STATISTIC:
X-squared: 1870.7536
P VALUE:
Asymptotic p Value: < 2.2e-16

Page 8 of 16
UECM3243 Time Series Analysis / UECM3493 Introduction to Time Series and Forecasting /
UECM3773 Financial Time Series

VISUALIZATION OF FINANCIAL DATA

Figure 1.1. Histogram of daily log returns of Sony stock from January 4, 2010 to December 29, 2017.

Figure 1.2. Empirical density function of daily log returns of Sony stock from January 4, 2010 to December 29,
2017. The dashed line denotes the density function of a normal distribution with the same mean and variance.

R demonstration
> hist(sony.lrtn, nclass = 30) # histogram
> d1=density(sony.lrtn) # obtain density estimate
> names(d1) # find out the output variables of the command "density"
[1] "x" "y" "bw" "n" "call" "data.name"
[7] "has.na"
> plot(d1$x, d1$y, xlab="log return", ylab="density", type="l")
> range(sony.lrtn) # range of log return
[1] -0.1184913 0.1629131
> x=seq(-0.12, 0.17, 0.001) # create a sequence of x with increment 0.001
> y=dnorm(x, mean(sony.lrtn), sd(sony.lrtn))
> lines(x,y,lty=2, col="blue")

Page 9 of 16
UECM3243 Time Series Analysis / UECM3493 Introduction to Time Series and Forecasting /
UECM3773 Financial Time Series

Graphs are useful tools in analysing financial data. To gain a better visualization of the
distribution of asset returns, we can exam either the histogram or empirical density function of
the data. Consider, for instance, the daily log returns of Sony stock from January 4, 2010 to
December 29, 2017 for 2013 observations. The summary statistics of the data are given before.

Figure 1.1 shows a histogram of the data. This is obtained by dividing the data range into 30
bins. The plot appears to be symmetric with respect to its mean zero. However, according to
the skewness test, we have sufficient statistical evidence to conclude that the daily log returns
of Sony stock are positively skewed.

The solid line of Figure 1.2 shows the empirical density function of the Sony log returns. The
empirical density function can be regarded as a refined version of the histogram. The dashed
line of Figure 1.2 shows the density function of a normal distribution that has the same mean
and standard deviation as those of the Sony data. The plot provides a visual inspection of the
normality assumption for the daily Sony log returns. The empirical density function has a
higher peak and tends to be skewed to the right with heavy tails than the normal density. This
phenomenon is common for daily stock returns. In general, the deviation between the solid and
dashed line indicates that the daily log returns of Sony stock are not normally distributed. This
is consistent with the result of normality test shown before.

1.3. Stationarity
The foundation of statistical inference in time series analysis is the concept of weak stationarity.
A time series Yt  is weakly stationary if its first two moments (mean and variance) are time
invariant. More specifically, Yt  is weakly stationary if
(a) E Yt    , which is a constant, and
(b) Cov Yt , Yt k    k , which only depends on k .

1.4. Autocorrelation Function (ACF)

Consider a weakly stationary return series Yt . The lag-k autocorrelation of Yt is defined as

Cov Yt , Yt  k  Cov Yt , Yt k   k


k    .
Var Yt   Var Yt  k  Var Yt  0

From the definition, we have 0  1 ,  k    k and 1   k  1 . The collection of


autocorrelations,   k  , is called the autocorrelation function (ACF) of Yt . A weakly stationary
series Yt is not serially correlated if and only if  k  0 for all k  0 .

The lag-k sample autocorrelation of Yt is defined as


n

 Y  Y Yt t k Y 
ˆ k  t  k 1
n
, 0  k  T  1 , 1  ˆ k  1 .
 Y  Y 
2
t
t 1

Page 10 of 16
UECM3243 Time Series Analysis / UECM3493 Introduction to Time Series and Forecasting /
UECM3773 Financial Time Series

Example 1.4.
Consider the time series with 6 observations which was constructed using uncorrelated random
number between 0 and 100. Find the autocorrelation function (ACF) for time lags of 1, 2 and
5 respectively.

Period, t 1 2 3 4 5 6
Value, Yt 23 59 36 99 36 74
Solution:

Y  Y 
2
t Yt Yt 1 Yt  2 Yt 5 Yt  Y t Yt 1  Y Yt  2  Y Yt 5  Y

1 23 -31.5 992.25
2 59 23 4.5 20.25 -31.5
3 36 59 23 -18.5 342.25 4.5 -31.5
4 99 36 59 44.5 1980.25 -18.5 4.5
5 36 99 36 -18.5 342.25 44.5 -18.5
6 74 36 99 23 19.5 380.25 -18.5 44.5 -31.5
∑ = 327 ∑ = 4057.50

327
Y   54.5
6
t Y  Y Y
t t 1 Y  Y  Y Y
t t 2 Y  Y  Y Y
t t 5 Y 
1
2 -141.75
3 -83.25 582.75
4 -823.25 200.25
5 -823.25 342.25
6 -360.75 867.75 -614.25
∑ = -2232.25 ∑ = 1993 ∑ = -614.25

 The ACF for at lags of 1, 2 and 5 are:

2232.25
r1   0.55
4057.50

1993
r2   0.49
4057.50

614.25
r5   0.15
4057.50
Page 11 of 16
UECM3243 Time Series Analysis / UECM3493 Introduction to Time Series and Forecasting /
UECM3773 Financial Time Series

R demonstration
> Y <- c(23,59,36,99,36,74)
> plot.ts(x=Y, ylab=expression(paste(Y[t])), xlab="t (period)",
+ type="o", col="black", main="Time Series with 6 Observations")

> ACF <- acf(Y, lag = 6)

> ACF$acf
, , 1
[,1]
[1,] 1.0000000
[2,] -0.5501540
[3,] 0.4911892
[4,] -0.4548983
[5,] 0.1652495
[6,] -0.1513863

Page 12 of 16
UECM3243 Time Series Analysis / UECM3493 Introduction to Time Series and Forecasting /
UECM3773 Financial Time Series

WHITE NOISE
A time series Yt is called a white noise if Yt  is a sequence of independent and identically
distributed (iid) random variables with finite mean and variance. In particular, if Yt is normally
distributed with mean 0 and variance  2 , namely,
Yt ~ N  0,  2  ,
the series is called a Gaussian white noise.

For a white noise series, all the ACFs are 0. In practice, if all sample ACFs are close to 0, then
the series is a white noise series.

Example 1.5.
Consider a random error process,
 t ~ N  0,  2  .
Then,
E   t   0 , and E   t2    2 .
For which the  's are uncorrelated across time,
E   t   u   0 for t  u .

LINEAR TIME SERIES


Consider Yt t  represent the sum of a constant  and a Gaussian white noise process

 t t  , namely,

Yt     t .
Then,
E Yt    and Var Yt    0  E Yt       2 for all t.
2
 
Cov Yt , Yt k    k  E Yt   Yt k      0 for all t and k  0 .

Note that for any covariance stationary process,


 k   k
for all integers k.

THE SAMPLING DISTRIBUTION OF AUTOCORRELATION


For a white noise model,
 1
ˆ k ~ N  0,  ,
 T
where T is the number of observations in the series. This information can be used to develop
tests of hypotheses and confidence interval.

It is useful to have a benchmark to determine if an autocorrelation is significantly large. For


example, 95% of all sample autocorrelation coefficients must lie within the critical values
1.96
 .
n
If this is not the case, the series is probably not white noise.

Page 13 of 16
UECM3243 Time Series Analysis / UECM3493 Introduction to Time Series and Forecasting /
UECM3773 Financial Time Series

TESTING INDIVIDUAL ACF


For a given positive integer k, the previous result can be used to test
H 0 : k  0
.
H1 :  k  0

The test statistic is


ˆ k
t .
k 1
1  2 ˆ i
2

i 1
T

1
For simplicity, many software packages use as the asymptotic variance of ˆ k for all k  0 .
T
The t-ratio then becomes
t  ˆ k  T .
This simplification essentially assumes that the underlying time series is a sequence of iid
random variables.

Decision rule: Reject H 0 of zero serial correlations if t  Z or p  value   .


2

PORTMANTEAU TESTS
Financial application often requires to test jointly that several autocorrelations of Yt are zero.
H 0 : 1   2    m  0
H1 : i  0 for some i  1, , m

The test statistic is

A. Box – Pierce Q statistic (1970)


m
Q  T  ˆ k2 2  m 
k 1
or
B. Ljung – Box Q* statistic (1978)
m
 ˆ 2 
Q*  T T  2    k  2  m 
k 1  T  k 

where m is the maximum lag being considered,


T is the number of observations in the series.

Note. Simulation studies suggest that the choice of m  ln T  provides better power
performance.

Decision rule: Reject H 0 if Q  2  m  or Q*  2  m  or p  value   .

Page 14 of 16
UECM3243 Time Series Analysis / UECM3493 Introduction to Time Series and Forecasting /
UECM3773 Financial Time Series

Example 1.6.
Reconsider Example 1.4., test the null hypothesis if the autocorrelations of Yt are zero by using
(a) Box – Pierce Q statistic,
(b) Ljung – Box Q* statistic.
Solution:
R demonstration
> Box.test(Y, lag=5) # by default is Box-Pierce
Box-Pierce test
data: Y
X-squared = 4.8066, df = 5, p-value = 0.4399
> Box.test(Y, lag=5, type="Ljung")
Box-Ljung test

data: Y
X-squared = 10.867, df = 5, p-value = 0.05408

Page 15 of 16
UECM3243 Time Series Analysis / UECM3493 Introduction to Time Series and Forecasting /
UECM3773 Financial Time Series

Example 1.7.
Test the null hypothesis if the autocorrelations of the time series are zero with the information
given below.

R demonstration
> Box.test(Y2, lag=4)
Box-Pierce test
data: Y2
X-squared = 3.1459, df = 4, p-value = 0.5337
> Box.test(Y2, lag=4, type="Ljung")

Box-Ljung test
data: Y2
X-squared = 3.3922, df = 4, p-value = 0.4945

Page 16 of 16

You might also like