Lecture 1.
Financial Econometrics and Statistical Arbitrage
Master of Science Program in Mathematical Finance New York University Lecture 1: Basics on Time Series Analysis
Fall 2005
Farshid Magami Asl
G63.2707 - Financial Econometrics and Statistical Arbitrage
Administrative Details
Lecture 1. 2
Instructors: Farshid Maghami ASL and Lee Maclin Email: [email protected] Course Web sites:
Blackboard http://homepages.nyu.edu/~fma1
Teaching Assistant: Junyoep Park Email: [email protected] Office Hours: Mondays 5-7 pm Office Location:
WWH 606
Farshid Magami Asl
G63.2707 - Financial Econometrics and Statistical Arbitrage
Administrative Details (cont.)
Time: Mondays, 7:10 9 pm
Lecture 1. 3
First Class: September 12, 2005, Last Class: December 12, 2005. There will be no class on Columbus Day (October 10, 2005). We will make it up on Wednesday 11/23/05.
Homework and Exam: There will be six homework sets which will be assigned every other week. Students must write up and turn in their solutions individually within one week. Computer assignments can be solved by C/C++/C#, MATLAB, R. For other tools, please coordinate with the TA or the instructor. There will be one final exam (no mid-term). Final grade will be evaluated based on homework solutions (30%) and the final exam (70%). Lecture Notes and Homework will be posted on the course website as they become available
Farshid Magami Asl
G63.2707 - Financial Econometrics and Statistical Arbitrage
Administrative Details (cont.)
Lecture 1. 4
Textbooks: Lectures are drawn from many sources including the following books: 1. Alexander, C. Market Models, John Wiley and Sons, 2001 2. Brockwell, P.J., Davis, R.A., Introduction to Time Series and Forecasting, Springer 3. Javaheri, A. Inside Volatility Arbitrage : The Secrets of Skewness Wiley 4. Tsay, R. S., Analysis of Financial Time Series, Wiley, 2002 5. Wilmott, P. Derivatives: The Theory and Practice of Financial Engineering, Wiley Frontiers in Finance Series 6. Pandit S.M., Wu S.M., Time Series and System Analysis with Applications. Krieger Publishing, Malabar, FL, 2001 7. Hamilton J. D. Time Series Analysis. Princeton University Press, 1994 A number of research articles will be posted on the course webpage.
Farshid Magami Asl
G63.2707 - Financial Econometrics and Statistical Arbitrage
Expected Background
Lecture 1. 5
Prior knowledge of Linear Algebra, Probability and Statistics is required I assume you have taken the following courses: Derivative Securities Continuous Time Finance Scientific Computing / Computing for Finance Programming in C/C++ or MATLAB/R is required
Farshid Magami Asl
G63.2707 - Financial Econometrics and Statistical Arbitrage
What is Statistical Arbitrage?
Lecture 1. 6
Arbitrage is a riskless profit. Arbitrage Strategy is a trading strategy that locks in a riskless profit.
Strategies and Implementation Process (Cointegration based pairs trading, Volatility trading, ) Financial Econometrics (Time Series Review and Volatility modeling)
Statistical Arbitrage covers any trading strategy which uses statistical tools and time series analysis to identify approximate arbitrage opportunities while evaluating the risks inherent in the trades considering the transaction costs and other practical aspects.
Market Microstructur Theory (Transaction costs and Optimal Control, Algorithmic Trading,) Risk Management (Practical Risk Measurement and Management Technics)
Farshid Magami Asl G63.2707 - Financial Econometrics and Statistical Arbitrage
Course Outline
Financial Econometrics (8 weeks) Time Series Models Review and Analysis Volatility and Correlation Models in Financial Systems Calibration and Estimation Methods Cointegration and Market Microstructure in Practice (3 weeks) Cointegration and Pairs Trading Transaction Costs, and Market Friction Trade Execution Strategies Practical Simulation and Risk Management (1 week) More on Trading Strategies (1-2 week)
Lecture 1. 7
Farshid Magami Asl
G63.2707 - Financial Econometrics and Statistical Arbitrage
Typical Behavior of Financial Assets
12000
Lecture 1. 8
10000
8000 Dow J ones Index
6000
4000
2000
1000
2000 3000 4000 5000 6000 7000 Time in days from 1/1/1975 to 07/30/2005
8000
9000
The unpredictability inherent in asset prices is the main feature of financial modeling. Because there is so much randomness, any mathematical model of a financial asset must acknowledge the randomness and have a probabilistic foundation.
G63.2707 - Financial Econometrics and Statistical Arbitrage
Farshid Magami Asl
Introduction to Financial Modeling
Lecture 1. 9
There are three general types of analysis used in finance and trading
1. Fundamental Analysis 2. Technical Analysis 3. Quantitative Analysis
Return in financial assets By return we mean the percentage growth in the value of an asset, together with accumulated dividends, over some period:
Return =
Change in value of the asset + accumulated cashflows Original value of the asset
Si +1 S i Si
Denoting the asset value on the i-th day by Si, the return from day i to day i+1 is given by
Ri =
Farshid Magami Asl
G63.2707 - Financial Econometrics and Statistical Arbitrage
Introduction to Financial Modeling
0.1 Difference of the Log Trans form of Dow J ones Index 0.05 0 -0.05 -0.1 -0.15 -0.2 -0.25 -0.3
Lecture 1. 10
1000
2000 3000 4000 5000 6000 7000 Time in days from 1/1/1975 to 07/30/2005
8000
9000
Supposing that we believe that the empirical returns are close enough to Normal for this to be a good approximation. For start, we write the returns as a random variable drawn from a Normal distribution with a known, constant, non-zero mean and a known, constant, 1 1 non-zero standard deviation: N ( 0 ,1) = e 2 2
Ri =
Farshid Magami Asl
Si +1 S i = mean + standard deviation x Si
G63.2707 - Financial Econometrics and Statistical Arbitrage
Introduction to Financial Modeling
Ri = Si +1 S i = mean + standard deviation x Si
Lecture 1. 11
Time scale t Mean return over period t is Standard deviation over period t is
t 1/ 2
X
Ri =
Si +1 Si = t + t 1/ 2 Si
And in the limit t 0 dS R = t = dt + dX t St
Farshid Magami Asl G63.2707 - Financial Econometrics and Statistical Arbitrage
Basic Review
STOCHASTIC PROCESS:
Lecture 1. 12
A stochastic process is a collection of random variables {X t ( ), t } defined on a probability space ( , F , P ) . For a fixed
, a realization of stochastic process is a function of time (t).
x 10 1.3
1.2
1.1
0.9 State 5 5 State 4 State 3 State 2 State 1
Time
4 3 2 1 0 20 40 60
Time
80
100
Farshid Magami Asl
G63.2707 - Financial Econometrics and Statistical Arbitrage
Simulation of a Stochastic Process
x 10 1.6 1.4 1.2 1 0.8 0.6 200 150 100 50 0 0 20 40 60 80 100
4
Lecture 1. 13
Farshid Magami Asl
G63.2707 - Financial Econometrics and Statistical Arbitrage
Definition
Time Series:
Lecture 1. 14
A time series is a stochastic process where is a set of discrete points in time. In other words, it is a discrete time, continuous state process. In this course we consider
3
= { all integers}
Xk
-1
-2
-3
X1 X2 X3
0 5 10 15 20 25 30 35 40
-4
k
Farshid Magami Asl G63.2707 - Financial Econometrics and Statistical Arbitrage
Goals of Studying Time Series 1- Forecasting
12000
Lecture 1. 15
We want to forecast distributions
10000
Dow Jones Index
8000
6000
4000
2000
1000
2000
3000
4000
5000
6000
7000
8000
9000
10000
Time in days from 1/1/1975 to 07/30/2005
2- Understanding the statistical characteristics and building trading strategies based on them
Farshid Magami Asl G63.2707 - Financial Econometrics and Statistical Arbitrage
Basic Review
An Example of a Time Series:
Lecture 1. 16
Xk
1 0 8 6 4 2 0 -2 -4 -6 -8
-1 0
1 0 0 0
2 0 0 0
3 0 0 0
4 0 0 0
5 0 0 0
6 0 0 0
k
10 8 6 4 2 0 -2 -4
7 0 0 0
10 8 6 4 2 0 -2 -4 -6 -8 -10 -10 -8 -6 -4 -2 0 2 4
Xk
10 8 6 4 2 0 -2 -4
10
Xk
8 6 4 2 0 -2 -4
Xk
Xk
Xk-1
6 8 10
-6 -8 -10 -10 -8 -6 -4 -2 0 2 4
Xk-2
6 8 10
-6 -8 -10 -10 -8 -6 -4 -2 0 2 4
Xk-3
6 8 10
-6 -8 -10 -10 -8 -6 -4 -2 0 2
Xk-10
4 6 8 10
Xk= 1 Xk-1+ 2 Xk-2++ek
Farshid Magami Asl
Auto-Regression as a Dynamic System? We will get back to this
G63.2707 - Financial Econometrics and Statistical Arbitrage
Definition Autocovariance Function:
Lecture 1. 17
Let {Xt} be a time series. The autocovariance function of process {Xt} for all integers r and s is:
X (r , s ) = cov( X r , X s )
X (r , s ) = E[( X r E ( X r ))( X s E ( X s ))]
X (r , s ) = E[ X r X s X r E ( X s ) X s E ( X r ) + E ( X r ) E ( X s )] X (r , s) = E ( X r X s ) E ( X r ) E ( X s ) E ( X s ) E ( X r ) + E ( X r ) E ( X s ) X (r , s ) = E ( X r X s ) E ( X r ) E ( X s )
2 Note that X (r , r ) = E ( X r ) E ( X r ) = var( X r ) 0 2
=0
Farshid Magami Asl
G63.2707 - Financial Econometrics and Statistical Arbitrage
Autocovariance Function
Lecture 1. 18
Sample Autocovariance Function
10
12
14
16
18
20
Lag
Farshid Magami Asl G63.2707 - Financial Econometrics and Statistical Arbitrage
Definition Stationary Process:
A time series {Xt} is stationary (weakly) if:
Note:
Lecture 1. 19
1. E ( X t ) < 2. E ( X t ) = Some constant m for all t 3. X ( r , s ) = X ( r + t , s + t )
A strict (strong) stationary time series {Xt , t=1,2,,n} is defined by the condition that realizations (X1, X2, , Xn) and (X1+h, X2+h, , Xn+h) have the same joint distributions for all integers h and n>0.
i.e. Cov(Xr,Xs) only depends on r and s and not on t. Note: If {Xt} is stationary, then
X (r, s) = X (r s, s s) = X (r s,0) = X (r s)
Define h=r-s
X (r s) = X (h) = cov(X t , X t +h )
Farshid Magami Asl
Does not depend on t
G63.2707 - Financial Econometrics and Statistical Arbitrage
Definition Note:
Lecture 1. 20
Strict Stationary (Strong)
Weak Stationary (Covariance Stationary)
Not generally true except for the Gaussian processes
Farshid Magami Asl
G63.2707 - Financial Econometrics and Statistical Arbitrage
Stationary Process
Lecture 1. 21
Stationary Process and Mean Reversion
We are interested in stationary time series because many models and tools are developed for stationary processes. A stationary process can never drift too far from its mean because of the finite variance. The speed of mean-reversion is determined by the autocovariance function: Mean-reversion is quick when autocovariances are small and slow when autocovariances are large. Trends and periodic components make a time series non-stationary.
Farshid Magami Asl
G63.2707 - Financial Econometrics and Statistical Arbitrage
Stationary Process
Lecture 1. 22
80 60 40 20 0 -20 0 50 100 150
Non-Stationary Process
200 250 300
4 2 0 -2 -4 -6 0
Mean-Reversion
50 100 150
Stationary Process
200 250 300
Farshid Magami Asl
G63.2707 - Financial Econometrics and Statistical Arbitrage
General Approach to Time Series Time Series Analysis
1. Plot time series and check for trends or sharp changes in behavior (most of the time non-stationary) 2. Transform into a stationary time series 3. Fit a model 4. Perform diagnostic tests (residual analysis,)
Lecture 1. 23
If bad
5. Generate forecasts (find predictive distributions) and invert the transformations performed in 2. Note for option pricing: 6. Find a risk neutral version of the model 7. Obtain predictive distributions under the risk neutral model
Farshid Magami Asl G63.2707 - Financial Econometrics and Statistical Arbitrage
Building Blocks of Financial Models White Noise Process
If {Xt} is a sequence of random variables with E ( X t ) = 0 ,
Lecture 1. 24
E ( X t ) = 2 and
2
0 2 {Xt} is called White Noise and it is written as WN(0, )
2 X (r , s) =
r = s ( 2 < ) otherwise
Note that E[Xt Xs]=0 for t=s If Xt and Xs independent for t=s
5
Uncorrelated r.v.s IID(0, 2 )
5
Xk
0 WN
-5 0 1000 2000 3000 4000 5000 6000 7000
-5 -5
Xk-1
0 5
Farshid Magami Asl
G63.2707 - Financial Econometrics and Statistical Arbitrage
Building Blocks of Financial Models White Noise Process (Is it Stationary?)
E( X t ) = 0
Lecture 1. 25
2 X (r , s) = 0
r=s otherwise
( 2 < )
Farshid Magami Asl
G63.2707 - Financial Econometrics and Statistical Arbitrage
Building Blocks of Financial Models Random Walk Process
If {Xt} be a sequence of with S0=0 and
Lecture 1. 26
IID(0, 2) random variables , a sequence {St}
St = j =1 X j
t
(Integrated Process)
Is called a Random Walk.
100 10 5 Random Walk 0 0 -5 -100 0 1000 2000 3000 4000 5000 6000 7000 -10 -10 -5 0 5
Sk
Sk-1
10
Farshid Magami Asl
G63.2707 - Financial Econometrics and Statistical Arbitrage
Building Blocks of Financial Models Random Walk Process (Is it Stationary?)
Lecture 1. 27
St = j =1 X j
t
{Xt}
IID(0, )
2
Farshid Magami Asl
G63.2707 - Financial Econometrics and Statistical Arbitrage
Building Blocks of Financial Models Moving Average Process
Let {Xt} be WN(0, ), and consider the process
2
Lecture 1. 28
Yt = X
+ X
t 1
Where could be any constant. This time series model is called a firstorder moving average process, denoted MA(1). The term Moving Average comes from the fact that Yt is constructed from a weighted sum of the two most recent values of Xt.
=0.5
4 2 0 -2 -4 -4
Yk
Yk-1
-2 0 2 4
1000
2000
3000
4000
5000
6000
Farshid Magami Asl
G63.2707 - Financial Econometrics and Statistical Arbitrage
Building Blocks of Financial Models Moving Average Process (Is it Stationary?)
{Xt} is WN(0, )
2
Lecture 1. 29
Yt = X t + X t 1
Farshid Magami Asl
G63.2707 - Financial Econometrics and Statistical Arbitrage
Building Blocks of Financial Models Autoregressive Process
Let {Zt } be WN(0, 2 ), and consider the process
Lecture 1. 30
= X
t 1
+ Z
Where | |<1 and Zt is uncorrelated with Xs for each s<t. This time series model is called a first-order Autoregressive process, denoted AR(1). It is easy to show that E(Xt)=0
5
Random Walk
=0.7
10 5 0 -5
Xk
-5 0 100 200 300 400 500 600 700
-10 -10
Xk-1
-5 0 5 10
Farshid Magami Asl
G63.2707 - Financial Econometrics and Statistical Arbitrage
Building Blocks of Financial Models Autoregressive Process (Is it Stationary?) {Zt } is WN(0, 2), and X t = X t 1 + Z
Lecture 1. 31
Where | |<1 and Zt is uncorrelated with Xs for each s<t.
We will see this later
Farshid Magami Asl
G63.2707 - Financial Econometrics and Statistical Arbitrage
Building Blocks of Financial Models
Lecture 1. 32
X
30 20 10 0 -10
= X
t 1
+ Z
t
30 20 10 0 -10 -10 10 5 0 -5 -10 -10 4 2 0 -2 -4 -4
=1
Random Walk
0 10 20 30
50
100
150
200
250
300
10 5 0 -5 -10
= 0.9
AR(1)
-5 0 5 10
50
100
150
200
250
300
4 2 0 -2 -4
= 0.1
AR(1)
-2 0 2 4
50
100
150
200
250
300
Farshid Magami Asl
G63.2707 - Financial Econometrics and Statistical Arbitrage
Transforming a Non-Stationary Process to a Stationary Process
Lecture 1. 33
Classical Decomposition
X t = mt + St + Yt
Original Time series (Nonstationary) Trend Seasonal component Stationary Time series (zero-mean)
Seasonal component St satisfies
St+d=St
where d= period of seasonality
Also for mathematical convenience assume
j =1
Sj = 0
Most observed time series are non-stationary but they can be transformed to stationary processes.
Farshid Magami Asl G63.2707 - Financial Econometrics and Statistical Arbitrage
Transforming a Non-Stationary Process to a Stationary Process
Lecture 1. 34
Classical Decomposition
X t = mt + St + Yt
^ ^
Idea of transformation is to estimate mt and St by mt and St, then work with the stationary process:
X t* = X t m t + S t
Assume there is no seasonal component (St=0)
X t = mt + Yt
Consider a parametric form for mt e.g.
m t = a0 + a1t + a2t 2
Using observed data X1, X2, Xn, choose 0, 1, 2 to minimize
Farshid Magami Asl
(X
t =1
mt )
G63.2707 - Financial Econometrics and Statistical Arbitrage
Transforming a Non-Stationary Process to a Stationary Process
Lecture 1. 35
12000
10000
8000
Dow Jones Index
6000
4000
2000
0 0 1000 2000 3000 4000 5000 6000 7000 8000 9000
Time in days from 1/1/1975 to 07/30/2005
Farshid Magami Asl G63.2707 - Financial Econometrics and Statistical Arbitrage
Transforming a Non-Stationary Process to a Stationary Process
Lecture 1. 36
10 9.5
Log Transform of Dow Jones Index
9 8.5 8 7.5 7 6.5 6 5.5 5
1000
2000
3000
4000
5000
6000
7000
8000
9000
Time in days from 1/1/1975 to 07/30/2005
Farshid Magami Asl G63.2707 - Financial Econometrics and Statistical Arbitrage
Transforming a Non-Stationary Process to a Stationary Process
10
Lecture 1. 37
9.5
Log Transform of Dow Jones Index
8.5
mt = 6.1513 + 0.0004t
7.5
6.5
5.5
5 0 1000 2000 3000 4000 5000 6000 7000 8000 9000
Time in days from 1/1/1975 to 07/30/2005
Farshid Magami Asl G63.2707 - Financial Econometrics and Statistical Arbitrage
Transforming a Non-Stationary Process to a Stationary Process
0.1
Lecture 1. 38
Difference of the Log Transform of Dow Jones Index
0.05
-0.05
-0.1
-0.15
-0.2
-0.25
-0.3 0 1000 2000 3000 4000 5000 6000 7000 8000 9000
Time in days from 1/1/1975 to 07/30/2005
Farshid Magami Asl G63.2707 - Financial Econometrics and Statistical Arbitrage
Transforming a Non-Stationary Process to a Stationary Process
0.15
Lecture 1. 39
0.1
Forecast
0.05
Forecast of the model
-0.05
-0.1
-0.15
-0.2
-0.25
-0.3 0 1000 2000 3000 4000 5000 6000 7000 8000 9000 10000
Time in days from 1/1/1975 to 07/30/2005
Farshid Magami Asl G63.2707 - Financial Econometrics and Statistical Arbitrage
Transforming a Non-Stationary Process to a Stationary Process
10
Lecture 1. 40
Forecast
Convert back the difference in the Forecast of the model
9.5
8.5
7.5
6.5
6 0 1000 2000 3000 4000 5000 6000 7000 8000 9000 10000
Time in days from 1/1/1975 to 07/30/2005
Farshid Magami Asl G63.2707 - Financial Econometrics and Statistical Arbitrage
Transforming a Non-Stationary Process to a Stationary Process
15000
Lecture 1. 41
convert back the Log of the Forecast of the model
Forecast
10000
5000
0 0 1000 2000 3000 4000 5000 6000 7000 8000 9000 10000
Time in days from 1/1/1975 to 07/30/2005
Farshid Magami Asl G63.2707 - Financial Econometrics and Statistical Arbitrage
Transforming a Non-Stationary Process to a Stationary Process
x 10 2
4
Lecture 1. 42
1.8
Monte Carlo Simulation of the Forecast
1.6
1.4
1.2
0.8
0.6
0.4
0.2
0 0 1000 2000 3000 4000 5000 6000 7000 8000 9000 10000
Time in days from 1/1/1975 to 07/30/2005
Farshid Magami Asl G63.2707 - Financial Econometrics and Statistical Arbitrage
Transforming a Non-Stationary Process to a Stationary Process
x 10 2
4
Lecture 1. 43
1.8
Monte Carlo Simulation of the Forecast
1.6
1.4
1.2
0.8
0.6
0.4
0.2
0 0 1000 2000 3000 4000 5000 6000 7000 8000 9000 10000
Time in days from 1/1/1975 to 07/30/2005
Farshid Magami Asl G63.2707 - Financial Econometrics and Statistical Arbitrage
Transforming a Non-Stationary Process to a Stationary Process
Lecture 1. 44
x 10 1.3 1.2 1.1 1 0.9 0.8 0
10
20
30
40
50
60
70
80
90
100
60
40
20
0 0.7
0.8
0.9
1.1
1.2
1.3
1.4
1.5 x 10
1.6
4
Farshid Magami Asl
G63.2707 - Financial Econometrics and Statistical Arbitrage