Professional Documents
Culture Documents
14.3.23 Computational Finance
14.3.23 Computational Finance
AY 2022-2023
VI Trimester
Dr. Narend. S
Professor & Chairperson – Accounting &
Finance,
Thiagarajar School of Management
Recommended Books
1. Ruey S. Tsay “Analysis of Financial Time Series”, (Wiley Series in Probability and Statistics) 2nd Edition,
Wiley India, Pvt. Ltd, New Delhi.
2. Montgomery, D. C., Jennings, C. L., & Kulahci, M. (2015). Introduction to time series analysis and
forecasting. John Wiley & Sons.
2
Dr. Narend Subramanian, Prof & Chairperson Accounting & Finance, TSM
CF – Course modules
Module 4: Modelling volatility in time series
Modelling time series volatility: Volatility - Historical
volatility, Implied volatility models, ARCH processes,
GARCH Processes, Estimation of ARCH, GARCH
models in EVIEWS, Extensions of GARCH models,
Multivariate GARCH models
3
Dr. Narend Subramanian, Prof & Chairperson Accounting & Finance, TSM
Computational Finance – Course evaluation
S.NO Topics Weightage Deadlines
1 Assignments 10% TBC
2 First quiz 10% TBC
3 Case studies, class participation 10% TBC
4 Mid term 30% TBC
5 End Term 40% TBC
4 Dr. Narend Subramanian, Prof & Chairperson Accounting & Finance, TSM
Types of Data
Data Properties
Time series data Data on one or more variables over a period of time
5
Dr. Narend Subramanian, Prof & Chairperson Accounting & Finance, TSM
Types of Data
7
Dr. Narend Subramanian, Prof & Chairperson Accounting & Finance, TSM
Types of Data
Data Properties
Cross sectional Data on one or more variables collected at the same
data point of time. Eg: Number of eggs produced in 1990
8
Dr. Narend Subramanian, Prof & Chairperson Accounting & Finance, TSM
Types of Data
Data Properties
Pooled data Combination of both time series and cross sectional
data
Panel data Special type of pooled data – same cross sectional
data
9
Dr. Narend Subramanian, Prof & Chairperson Accounting & Finance, TSM
Types of Data
Data Properties
Pooled data Combination of both time series and cross sectional
data
Panel data Special type of pooled data – same cross sectional
data
10
Dr. Narend Subramanian, Prof & Chairperson Accounting & Finance, TSM
Time series models
Structural models – Multivariate in nature
Eg: Linear regression analysis
Stock returns = F ( GDP, Inflation, Unemployment…)
Sometimes structural models are not viable
All variables are not observable or measurable- Unemployment rate in
India
Lower frequency –Eg: Stock prices are daily, macro economic variables
are quarterly (GDP)
How to model ??? Can we model variables with different time frequencies
– Stocks (daily prices), GDP (quarterly), IIP (monthly)??
Structural models are not suitable for out of sample forecasting
Univariate models
Based only on their past values and also based on their error term
• Time Series models -
Also known as “ a-theoretical” models and not based on underlying theory
ARMA and ARIMA (p,d,q) – important class of time series models
AR- AutoRegressive & MA Moving Average
11
Dr. Narend Subramanian, Prof & Chairperson Accounting & Finance, TSM
Time series models
Regression analysis assumptions
The regression model
12
Dr. Narend Subramanian, Prof & Chairperson Accounting & Finance, TSM
Time series models
Significance of error term
1) Vagueness of theory
Unsure of other variables in the above e.g. U I captures all other terms missing
2) Unavailability of data
Some data may be unavailable .
13
Dr. Narend Subramanian, Prof & Chairperson Accounting & Finance, TSM
Time series models
Significance of error term
6) Principle of parsimony
Regression is explained by 2 or 3 variables and other variables – unsure whether they
can have an effect – better to use lesser no. of variables
7) Wrong functional form
Linear form and non-linear form – not chosen properly
Ui will capture those errors
14
Dr. Narend Subramanian, Prof & Chairperson Accounting & Finance, TSM
Time series models
Regression analysis assumptions
1) The regression model is linear in the parameters
15
Dr. Narend Subramanian, Prof & Chairperson Accounting & Finance, TSM
Time series models
Regression analysis assumptions
16
Dr. Narend Subramanian, Prof & Chairperson Accounting & Finance, TSM
Time series models
Regression analysis assumptions
4) Homoscedasticity or equal variance of (ui )
17
Dr. Narend Subramanian, Prof & Chairperson Accounting & Finance, TSM
Time series models
Regression analysis assumptions
5) No autocorrelation between the disturbances
18
Dr. Narend Subramanian, Prof & Chairperson Accounting & Finance, TSM
Time series models
• Exponential Smoothing
Not based on ARIMA approach
Uses a linear combination of previous values for modelling
and forecasting
Gives more weight on recent observations than the past
values
19
Dr. Narend Subramanian, Prof & Chairperson Accounting & Finance, TSM
Stationarity of series
Many financial and economic time series exhibit non
stationarity:
• Stock market indices, exchange rates, interest rates,
commodity prices
Leads to spurious regressions
What are the consequences of spurious regressions?
20
Dr. Narend Subramanian, Prof & Chairperson Accounting & Finance, TSM
Stationarity of series
Stationarity, is defined as a quality of a process in
which the statistical parameters (mean and
standard deviation) of the process do not change
with time. (Challis and Kitney,1991)
22
Dr. Narend Subramanian, Prof & Chairperson Accounting & Finance, TSM
Nifty closing price vs Nifty closing returns -
EVIEWS
Close
9,200
8,800
8,400
8,000
7,600
7,200
6,800
M10 M11 M12 M1 M2 M3 M4 M5 M6 M7 M8 M9
2015 2016
closret
.04
.03
.02
.01
.00
-.01
-.02
-.03
-.04
M10 M11 M12 M1 M2 M3 M4 M5 M6 M7 M8 M9
2015 2016
23
Dr. Narend Subramanian, Prof & Chairperson Accounting & Finance, TSM
EVIEWS – Variable transformation
Variable transformations
Variables are transformed to make it stationary
Generally
1) Natural log transformation
2) First differences
Lagged variables
Lag1 .. Lag1close = close(-1)
Lag 2.. Lag2close = close(-2)
Differenced Variables
First difference – fdi = d(close)
Second difference sdi = d(close,2)
Returns Series
Closeret = d(log(close)or ret1 = log(close/close(-1))
24
Dr. Narend Subramanian, Prof & Chairperson Accounting & Finance, TSM
Stationarity of series
How to detect stationarity of series?
Visual inspection of time series
Can evaluate the Autocorrelation Function (ACF)
25
Dr. Narend Subramanian, Prof & Chairperson Accounting & Finance, TSM
Stationarity
A non stationary series is said to have a unit root.
Null Hypothesis:
Here, if you reject the null, you have stationarity and thus, don’t need to
difference.
26
Dr. Narend Subramanian, Prof & Chairperson Accounting & Finance, TSM
Stationarity of series
How to detect stationarity of series?
Visual inspection of time series
Can evaluate the Autocorrelation Function (ACF)
27
Dr. Narend Subramanian, Prof & Chairperson Accounting & Finance, TSM
Stationarity of series
How to detect stationarity of series?
Visual inspection of time series
Can evaluate the Autocorrelation Function (ACF)
28
Dr. Narend Subramanian, Prof & Chairperson Accounting & Finance, TSM
Autocorrelation Function (ACF)
The autocorrelation measures the correlation between
some value of a series (e.g., Y) and the value of that
series at some lag.
e.g., autocorrelation at a lag of 1 is the pairwise correlation
between Yt and Yt-1 for all n-1 pairs.
29
Dr. Narend Subramanian, Prof & Chairperson Accounting & Finance, TSM
Partial Autocorrelation Function (PACF)
The Partial Auto Correlation measures the direct
correlation (for example say) between Y(t) and Y (t-2)
after removing the intermediary effect of Y(t-1)
30
Dr. Narend Subramanian, Prof & Chairperson Accounting & Finance, TSM
Graphical tests for autocorrelation in residuals
Positive autocorrelation in residuals
31
Dr. Narend Subramanian, Prof & Chairperson Accounting & Finance, TSM
Graphical tests for autocorrelation in residuals
Negative autocorrelation in residuals
32
Dr. Narend Subramanian, Prof & Chairperson Accounting & Finance, TSM
Graphical tests for autocorrelation in residuals
No autocorrelation in residuals
33
Dr. Narend Subramanian, Prof & Chairperson Accounting & Finance, TSM
Detection of autocorrelation – Durbin Watson Test
DW test used to detect autocorrelation
DW test
34
Dr. Narend Subramanian, Prof & Chairperson Accounting & Finance, TSM
Detection of autocorrelation – Durbin Watson Test
DW test used to detect autocorrelation
, DW =2 No autocorrelation
, DW =0 +ve autocorrelation
, DW =4 -ve autocorrelation
35
Dr. Narend Subramanian, Prof & Chairperson Accounting & Finance, TSM
Autocorrelation Function (ACF)
Closing prices of Nifty series (prices)
Replication in excel
36
Dr. Narend Subramanian, Prof & Chairperson Accounting & Finance, TSM
Autocorrelation Function (ACF)
Closing prices of Nifty series ( Returns)
37
Dr. Narend Subramanian, Prof & Chairperson Accounting & Finance, TSM
Time Series Components
Components
Trend
Seasonal
Irregular
Cyclical
38
Dr. Narend Subramanian, Prof & Chairperson Accounting & Finance, TSM
Time Series Components - Trend
39
Dr. Narend Subramanian, Prof & Chairperson Accounting & Finance, TSM
Time Series Components - Seasonal
40
Dr. Narend Subramanian, Prof & Chairperson Accounting & Finance, TSM
Time Series Components - Irregular
Random fluctuation
41
Dr. Narend Subramanian, Prof & Chairperson Accounting & Finance, TSM
Time Series Components - Cyclical
42
Dr. Narend Subramanian, Prof & Chairperson Accounting & Finance, TSM
Time Series Components -
43
Dr. Narend Subramanian, Prof & Chairperson Accounting & Finance, TSM
Time Series
Developed by G. P. E Box and G. M Jenkins, “Time
Series Analysis: Forecasting and Control”, 1976.
44
Dr. Narend Subramanian, Prof & Chairperson Accounting & Finance, TSM
Time Series
Notations and concepts
Confidence interval =
T is the sample size
45
Dr. Narend Subramanian, Prof & Chairperson Accounting & Finance, TSM
Time Series
One can think of a time series as having structure related
to:
46
Dr. Narend Subramanian, Prof & Chairperson Accounting & Finance, TSM
Time Series
AR (p): Auto Regressive Process
y t 1 y t 1 2 y t 2 p y t p ut
ARMA (q)
p q
yt
i 1
i yt i j 0
j ut j
47
Dr. Narend Subramanian, Prof & Chairperson Accounting & Finance, TSM
Time Series
Original Stationary AR MA White
Series Series Structure Structure Noise
Modelling steps
1) Identification
2) Estimation
3) Diagnostic Checking
4) Forecasting
48
Dr. Narend Subramanian, Prof & Chairperson Accounting & Finance, TSM
Time Series
1) Identification (Model Building)
2) Estimation
By Least squares or
Maximum Likelihood
49
Dr. Narend Subramanian, Prof & Chairperson Accounting & Finance, TSM
Time Series
3) Diagnostic Checking
How is model fit estimated for linear regressions???
For time series Information criteria (widely used)
AIC (Akaike Information Criteria)
50
Dr. Narend Subramanian, Prof & Chairperson Accounting & Finance, TSM
Time Series
Model validity tests
Residuals plot – Correlogram
Breusch Godfrey LM test F sig. > .05 – no serial
correlation in residuals
Durbin Watson statistic for residuals = 2, no serial
correlation , d=0 – positive correlation, d=4 negative
correlation
Test normality of residuals – Jarque Bera test, Shapiro
Wilks test, etc.
51
Dr. Narend Subramanian, Prof & Chairperson Accounting & Finance, TSM
Characteristics of AR, MA process
52
Dr. Narend Subramanian, Prof & Chairperson Accounting & Finance, TSM
Characteristics of AR, MA process
53
Dr. Narend Subramanian, Prof & Chairperson Accounting & Finance, TSM
Characteristics of AR, MA process
AR(Autoregressive order) MA(Moving Average order)
Geometrically declining ACF ACF – No. of non-zero determines MA
order
PACF- no. of non zero determines AR Geometrically declining PACF
order
54
Dr. Narend Subramanian, Prof & Chairperson Accounting & Finance, TSM
Characteristics of AR, MA process
AR(Autoregressive order) MA(Moving Average order)
Geometrically declining ACF ACF – No. of non-zero determines MA
order
PACF- no. of non zero determines AR Geometrically declining PACF
order
55
Dr. Narend Subramanian, Prof & Chairperson Accounting & Finance, TSM
Characteristics of AR, MA process
AR(Autoregressive order) MA(Moving ARMA process
Average order)
Geometrically declining ACF ACF – No. of non- Decaying ACF
zero determines MA
order
PACF- no. of non zero determines AR Geometrically Decaying PACF
order declining PACF
56
Dr. Narend Subramanian, Prof & Chairperson Accounting & Finance, TSM
Characteristics of AR, MA process
57
Dr. Narend Subramanian, Prof & Chairperson Accounting & Finance, TSM
Forecasting in Econometrics
Forecasting – Determine the values that a series is likely to take.
Why forecasting?
Useful to make financial decisions
More accurate the forecast more the utility
Examples in finance where forecasting is useful
Forecasting stock returns
Forecasting the price of a house
Forecasting the riskiness of portfolio
Forecasting the volatility of bond returns
Forecasting number of likely defaults on home loans
Time series forecasting – Done using its previous values and/or previous
error terms
Point forecast – predicts single value
Interval forecasts – gives a range of values
58
Dr. Narend Subramanian, Prof & Chairperson Accounting & Finance, TSM
Time Series Forecasting
In sample
Out sample
One step forecast – Forecasting done only for the next step
Multistep forecast – done for the next ‘s’ steps i.e 1,2,3,… s
steps
59
Dr. Narend Subramanian, Prof & Chairperson Accounting & Finance, TSM
Forecasting in Econometrics
Some more concepts used in forecasting
Rolling windows – The length of the period remains same
Recursive windows – Length of the period changes due to addition
60
Dr. Narend Subramanian, Prof & Chairperson Accounting & Finance, TSM
Forecasting accuracy
Forecasts produced for out of sample
Compared with actual values & diff. is aggregated in various
ways
Main types
MSE (Mean Square Error)
61
Dr. Narend Subramanian, Prof & Chairperson Accounting & Finance, TSM
Forecasting accuracy
Forecasts error aggregation
Example
62
Dr. Narend Subramanian, Prof & Chairperson Accounting & Finance, TSM
Time Series Forecasting
Forecasting errors measured by
MEAN Square error
Adjusted MAPE =
63
Dr. Narend Subramanian, Prof & Chairperson Accounting & Finance, TSM
Time Series Forecasting
64
Dr. Narend Subramanian, Prof & Chairperson Accounting & Finance, TSM
Time Series
Nifty prices
3000
2500
2000
Series1
1500
1000
500
0
1 20 39 58 77 96 115 134 153 172 191 210 229 248
65
Dr. Narend Subramanian, Prof & Chairperson Accounting & Finance, TSM
Time Series
Nifty returns
0.02
0.015
0.01
0.005
0 Series1
1 21 41 61 81 101 121 141 161 181 201 221 241
-0.005
-0.01
-0.015
-0.02
66
Dr. Narend Subramanian, Prof & Chairperson Accounting & Finance, TSM