Forecasting Financial Markets Nonlinear Dynamics
Copyright © 1999 – 2006 Investment Analytics
Forecasting Financial Markets – Nonlinear Dynamics
Slide: 1
Overview Fractal distributions ¾ ARFIMA models ¾ Chaotic systems ¾ Phase space ¾ Correlation integrals ¾ Lyapunov exponents ¾
Copyright © 1999 – 2006 Investment Analytics
Forecasting Financial Markets – Nonlinear Dynamics
Slide: 2
Fractal Distributions ¾
Problems with Gaussian theory of financial markets Non-normal distribution of returns • Fat tails • Peaked
¾
Pareto (1897) Found that proportion of people owning huge amounts of wealth was far higher than predicted by (log) normal distribution “Fat-tails” Many examples in nature
Copyright © 1999 – 2006 Investment Analytics
Forecasting Financial Markets – Nonlinear Dynamics
Slide: 3
Pareto-Levy Distributions ¾
Levy (1935) generalized Pareto’s law Described family of fat-tailed, high-peak pdf’s
¾
Pareto-Levy density functions Ln[f(t)] = iδt - γ|t|α(1+iβ(t/|t|)tan(απ/2) Parameters • α is measure of peakedness • β is measure of skewness (range +/- 1) • γ is scale parameter • δ is location parameter of the mean
Copyright © 1999 – 2006 Investment Analytics
Forecasting Financial Markets – Nonlinear Dynamics
Slide: 4
Characteristics of Pareto-Levy ¾
α is fractal dimension of probability space α=1/H 0<α<2 • If α = 2, (β = 0, γ = δ = 1) distribution is Normal EMH: α = 2; FMH: 1 < α < 2 Self-similarity • If distribution of daily returns has α = a, so will distribution of 5-day returns
Variance undefined for 1 <= α < 2 Mean undefined for α < 1
Copyright © 1999 – 2006 Investment Analytics
Forecasting Financial Markets – Nonlinear Dynamics
Slide: 5
Undefined Variance ¾
Example: Volatility in the S&P 500 Index S&P 500 Index Roling 12 Month Volatility 200%
150%
100%
50%
Copyright © 1999 – 2006 Investment Analytics
98 M ar -
96 M ar -
94 M ar -
92 M ar -
90 M ar -
88 M ar -
86 M ar -
84 M ar -
82 M ar -
80 M ar -
78 M ar -
M ar -
76
0%
Forecasting Financial Markets – Nonlinear Dynamics
Slide: 6
ARFIMA Models ¾
Generalized ARIMA models ARFIMA(p,d,q) • Fractional differencing parameter d = H - 0.5
¾
Models fractal Brownian motion Short memory effects Long memory effects
Copyright © 1999 – 2006 Investment Analytics
Forecasting Financial Markets – Nonlinear Dynamics
Slide: 7
ARFIMA(0, d, 0) No short memory effects ¾ Long memory depends on parameter d ¾
0 < d < 0.5: black noise -0.5 < d < 0: pink noise D = 0: white noise D = 1: brown noise
Copyright © 1999 – 2006 Investment Analytics
Forecasting Financial Markets – Nonlinear Dynamics
Slide: 8
ARFIMA(0, d, 0) ¾
d < 0.5 {yt} is stationary Represented as infinite MA process ∞
yt = ∑ψ k ε t − k k =0
(k + d − 1)! ψk = k!(d − 1)! Copyright © 1999 – 2006 Investment Analytics
Forecasting Financial Markets – Nonlinear Dynamics
Slide: 9
ARFIMA(0, d, 0) ¾
d > - 0.5 {yt} is invertible Represented as infinite AR process ∞
yt = ∑ π k yt − k k =1
(k − d − 1)! πk = k!(d − 1)! Copyright © 1999 – 2006 Investment Analytics
Forecasting Financial Markets – Nonlinear Dynamics
Slide: 10
ARMA(0, d, 0) ¾
Covariance
¾
Correlation
¾
(−1) k (−2d )! γk = (k − d )!(− k − d )!
(− d )! 2 d −1 ρk ~ k (d − 1)!
as k → ∞
Partial Autocorrelation
d φ kk = k −d Copyright © 1999 – 2006 Investment Analytics
Forecasting Financial Markets – Nonlinear Dynamics
Slide: 11
ARFIMA(1, d, 0) ¾
Process: (1 - αB)∆dyt = εt Combines long and short term memory processes
¾
Correlation function
(− d )!(1 + α ) k ρk = × 2 (d − 1is)!the(1Hypergeometric − α ) Ffunction (1,1 + d ;1 − d ;α ) F(a,b;C,z) 2 d −1
¾
Example: AR(1) vs. ARFIMA(1,d, 0) AR(1): a = 0.711 ARFIMA(1, d, 0): d = 0.2, a = 0.5
Copyright © 1999 – 2006 Investment Analytics
Forecasting Financial Markets – Nonlinear Dynamics
Slide: 12
AR(1) vs. ARFIMA(1, d, 0) 0.8 0.7
Correlation
0.6 0.5 0.4 0.3
AR(1)
0.2
ARFIMA(1,d,0)
0.1 0.0
0
5
10
15
20
25
Lag
Copyright © 1999 – 2006 Investment Analytics
Forecasting Financial Markets – Nonlinear Dynamics
Slide: 13
Estimating ARFIMA Models ¾
Step 1 Estimate d in ARIMA(0, d, 0) model ∆dyt = εt • Use R/S analysis to estimate d
¾
¾
¾ ¾
Step 2 Define ut = ∆dyt Use box-Jenkins analysis to fit model αBut = βBεt Step 3 Define xt = (βB)-1(αB) yt Step 4: estimate d in model ∆dxt = εt Repeat steps 2-4 until parameters converge
Copyright © 1999 – 2006 Investment Analytics
Forecasting Financial Markets – Nonlinear Dynamics
Slide: 14
Chaotic Systems ¾
Charaterized by: Fractal dimension Sensitivity to initial conditions
¾
Phase space Scatter plot of system variables Allows for visual inspection for patterns
¾
Attractors Region in phase space where solutions lie Can have Euclidean or fractal dimension
Copyright © 1999 – 2006 Investment Analytics
Forecasting Financial Markets – Nonlinear Dynamics
Slide: 15
Example: Logistic-Delay Function Equation: Xt = aXt-1 (1-Xt-2) ¾ Attractor dimension ¾
Depends on constant a • Point attractor (spiral) for smaller values of a • Limit cycle (ellipse) as a increases
Copyright © 1999 – 2006 Investment Analytics
Forecasting Financial Markets – Nonlinear Dynamics
Slide: 16
Logistic Function: a = 1.8 The Logistic Function 0.7 0.6 0.5 0.4 0.3 0.2 0.1 0.0
Phase Space of the Logistic Function 0.70 0.60
Xt-1
0.50 0.40 0.30 0.20 0.10 0.00 0.00
0.10
0.20
0.30
0.40
0.50
0.60
0.70
Xt
Copyright © 1999 – 2006 Investment Analytics
Forecasting Financial Markets – Nonlinear Dynamics
Slide: 17
Logistic Function: a = 2.2 The Logistic Function 1.0 0.8 0.6 0.4 0.2 0.0
Phase Space of the Logistic Function
Xt-1
1.00 0.90 0.80 0.70 0.60 0.50 0.40 0.30 0.20 0.10 0.00 0.00
0.20
0.40
0.60
0.80
1.00
Xt
Copyright © 1999 – 2006 Investment Analytics
Forecasting Financial Markets – Nonlinear Dynamics
Slide: 18
Fractal (“Strange”) Attractors Example: Henon attractor ¾ Equations ¾
xt+1 = 1+yt - axt2 yt+1 = bxt ¾
Phase portrait shows strange attractor Fractal dimension 1.2 1 < D < 2 indicates presence of 2 variables in system
Copyright © 1999 – 2006 Investment Analytics
Forecasting Financial Markets – Nonlinear Dynamics
Slide: 19
Henon Attractor Phase Portrait of the Henon Attractor 0.5 0.4 0.3 0.2 0.1 0.0 -1.5
-1.0
-0.5
-0.1 0.0
0.5
1.0
1.5
-0.2 -0.3 -0.4 -0.5
Copyright © 1999 – 2006 Investment Analytics
Forecasting Financial Markets – Nonlinear Dynamics
Slide: 20
Strange Attractors in the Capital Markets? ¾
Examine phase portrait of financial time series Fractal attractor would indicate chaotic (i.e. deterministic) process. Dimension of attractor would indicate # of system variables
¾
Problem: What is dimensionality of phase space?
Copyright © 1999 – 2006 Investment Analytics
Forecasting Financial Markets – Nonlinear Dynamics
Slide: 21
Constructing Phase Space ¾
Recall Henon attractor Phase space constructed using scatterplot of two variables X and Y
¾
Reconstruct phase space Use scatterplot of Xt and Xt-1 Generates same map Note: constructed using one variable, no equations
Copyright © 1999 – 2006 Investment Analytics
Forecasting Financial Markets – Nonlinear Dynamics
Slide: 22
Reconstructed Phase Portrait for Henon Attractor Reconstucted Phase Portrait 1.5 1.0
Xt-1
0.5 0.0 -1.5
-1.0
-0.5
0.0
0.5
1.0
1.5
-0.5 -1.0 -1.5
Xt
Copyright © 1999 – 2006 Investment Analytics
Forecasting Financial Markets – Nonlinear Dynamics
Slide: 23
Phase Space Dimensionality ¾
Ruelle: reconstructed vs. actual phase space Same fractal dimension Same Lyapunov spectrum
¾
Takens(1981): Can reconstruct phase space by lagging time series for each dimension
¾
Problem: what time lag to use? i.e. What dimension is attractor? • Need to embed it in higher dimension than its own • Dimension of attractor does not change when embedded in higher dimension (e.G. A plane in 3-D space still has 2-D)
Copyright © 1999 – 2006 Investment Analytics
Forecasting Financial Markets – Nonlinear Dynamics
Slide: 24
Determining Embedding Dimensionality ¾
Wolf: mt = Q • M = embedding dimension • T = time lag • Q = mean orbital period
¾
Example If period is 48 iterations we require: • 2 points lagged 24 iterations in 2-D space • 3 points lagged 16 iterations in 3-D space
Copyright © 1999 – 2006 Investment Analytics
Forecasting Financial Markets – Nonlinear Dynamics
Slide: 25
Fractional Dimensionality of Phase Space ¾
Time series One variable Dimensionality < 2
¾
Phase space Includes all variables in system Dimensionality depends on complexity of system • May be > 3-D
Copyright © 1999 – 2006 Investment Analytics
Forecasting Financial Markets – Nonlinear Dynamics
Slide: 26
Correlation Dimension ¾
Correlation integral Grassberger & Procaccia (1983) Measures probability that pair of points in attractor are within distance R of one another Approximates fractal dimension
1 Cm ( R ) = 2 N
N
∑ Z (R− | X
i , j =1 i≠ j
i
− X j |)
Z(x) = 1 if x > 0; 0 otherwise
Copyright © 1999 – 2006 Investment Analytics
Forecasting Financial Markets – Nonlinear Dynamics
Slide: 27
Estimating the Correlation Integral ¾
As R increases, Cm(r) should increase in proportion to RD Cm(R) ~ RD
¾ ¾
Log[Cm(R) ] = const + Dlog(R) Procedure Measure Cm(r) for increasing values of R Log-log plot of Cm(r) vs R OLS estimate of slope is correlation dimension D for embedding dimension m
Copyright © 1999 – 2006 Investment Analytics
Forecasting Financial Markets – Nonlinear Dynamics
Slide: 28
Correlation Integral of the Henon Attractor Correlation Dimension 0.0 -1.0
-0.8
-0.6
-0.4
-0.2
0.0
0.2
0.4
-0.2
Log[Cm(R)]
-0.4
y = 1.2014x - 0.5762 R2 = 0.999
-0.6 -0.8 -1.0 -1.2 -1.4 -1.6 -1.8
Log(R)
Copyright © 1999 – 2006 Investment Analytics
Forecasting Financial Markets – Nonlinear Dynamics
Slide: 29
BDS Test for Randomness ¾
Brock, Dechert, Scheinkman (1987) Lag time series {yt, t = 1, . . , T} in N lagged series • Reconstruct n-dimensional phase space a la Takens CN(R,T) → C1(R)N as T→ ∞ BDS test statistic 0 .5 T WN ( R, T ) =| C N ( R, T ) − C1 ( R, T ) N | × σ N ( R, T )
• σN(r,t) is the SD of the correlation integrals • W ~ No(0,1) • For large W, reject the hypothesis that series is random – Note will detect both linear and non-linear, so typically use AR(1) residuals to filter out linear effects
Copyright © 1999 – 2006 Investment Analytics
Forecasting Financial Markets – Nonlinear Dynamics
Slide: 30
BDS Test of Financial Markets Series Dow (20 day returns) Yen (daily) S&P 500 (weekly)
Dimension 6 6 6
W 28.72 116.05 23.89
All tests based on AR(1) residuals of above series Sources: Hsieh(1989), LeBaron(1990), Peters (1993)
Copyright © 1999 – 2006 Investment Analytics
Forecasting Financial Markets – Nonlinear Dynamics
Slide: 31
Lab: Estimating the Correlation Dimension for the S&P 500 Index ¾
Monthly S&P index returns (AR(1) residuals) Cycle estimated at 42 months from R/S analysis
¾
Estimate correlation dimension Use embedding dimensions m = 5 to 10 Lags = Int[42 / m]
¾
Chart log[Cm(r)] vs log(r) • M = 5 to 10
¾
Regression analysis Estimate phase space dimensionality D • OLS estimate of slope in log(r) = Dlog[Cm(r)]
Copyright © 1999 – 2006 Investment Analytics
Forecasting Financial Markets – Nonlinear Dynamics
Slide: 32
Solution: Estimating the Correlation Dimension for the S&P 500 Index Correlation Index of the S&P500 Index -1.14
-1.12
-1.10
-1.08
-1.06
-1.04
-1.02
0.0 -1.00
Log(R)
-1.0
Log[C(r)]
-0.5
-1.5
-2.0
5 Copyright © 1999 – 2006 Investment Analytics
6
7
8
9
10
-2.5
Forecasting Financial Markets – Nonlinear Dynamics
Slide: 33
Solution: Estimating the Correlation Dimension for the S&P 500 Index S&P 500 Index - Estimated Fractal Dimension
Correlation Dim ension
5.50 5.00 y = -0.1078x 2 + 2.08x - 4.8576 R2 = 0.9684
4.50 4.00 3.50 3.00 2.50 2.00 5
6
7
8
9
10
Em bedding Dim ension
Copyright © 1999 – 2006 Investment Analytics
Forecasting Financial Markets – Nonlinear Dynamics
Slide: 34
Solution: Estimating the Correlation Dimension for the S&P 500 Index DEST SE t p R2
5 2.86 0.029 98.45 0.000 99.90%
6 3.82 0.043 88.13 0.000 99.87%
7 4.15 0.017 247.26 0.000 99.98%
8 5.12 0.058 88.19 0.000 99.87%
9 5.10 0.029 174.43 0.000 99.97%
10 5.14 0.045 114.02 0.000 99.92%
Fractal dimension estimate Stablizes around 5.17 Concurs with LeBaron & Scheinkman (1986) • Daily stock returns had fractal dimension between 5 and 6 Interpretation • 5 or 6 dynamic variables determine S&P index process • Extremely complex system, impossible to estimate Copyright © 1999 – 2006 Investment Analytics
Forecasting Financial Markets – Nonlinear Dynamics
Slide: 35
Other Studies of Fractal Dimension ¾
Peters (1991) Criticized LeBaron Study • Data insufficiency - would require 106 data points to estimate fractal dimension reliably Use of returns not appropriate for study of non-linear effects
• Used inflation-adjusted prices over 40 year period ¾
Findings Equity Index US (S&P500) Japan Germany UK
Copyright © 1999 – 2006 Investment Analytics
Est. Dimension 2.33 3.05 2.41 2.94
Forecasting Financial Markets – Nonlinear Dynamics
Slide: 36
Lyapunov Exponents ¾
Measure of sensitivity to initial conditions How rapidly nearby points in phase space diverge (+ve) or converge (-ve) One exponent for each dimension of phase space • Linear dimension grows at rate 2L1t • Area grows at rate 2(L1 + L2 )t etc.
¾
Equation Lyapunov exponent for ith dim. pi(t) ⎡1 ⎛ pi (t ) ⎞⎤ ⎟⎟⎥ Li = Lim ⎢ Log 2 ⎜⎜ t →∞ ⎣ t ⎝ pi (0) ⎠⎦
Copyright © 1999 – 2006 Investment Analytics
Forecasting Financial Markets – Nonlinear Dynamics
Slide: 37
Lyapunov Exponents and Attractors ¾
Point attractors 3 negative exponents
¾
Limit cycles 2 negative, one zero exponent • 2 dimensions that converge
¾
3-D strange attractors One positive, one zero, one negative • Positive exponent shows sensitivity to initial conditions • Negative exponent causes diverging point to remain in range of attractor
Copyright © 1999 – 2006 Investment Analytics
Forecasting Financial Markets – Nonlinear Dynamics
Slide: 38
Lyapunov Exponents and the Capital Markets ¾
Strange attractor? Positive exponent due to technical factors or sentiment Negative exponent due to fundamental value • Brings prices back into “reasonable” range
Copyright © 1999 – 2006 Investment Analytics
Forecasting Financial Markets – Nonlinear Dynamics
Slide: 39
Lyapunov Exponents and Time Series ¾
Find largest positive Lyapunov exponent L+ Measured in bits per day Means we lose L+ bits of predictive power / day
¾
Example: L+ = 0.1 We lose 0.1 bits of predictive power / day Suppose we can measure today’s conditions to 1 bit precision Information will lose all value after 1 / 0.1 = 10 days
Copyright © 1999 – 2006 Investment Analytics
Forecasting Financial Markets – Nonlinear Dynamics
Slide: 40
Estimating the Largest Lyapunov Exponent ¾
Wolf’s algorithm Measures divergence of nearby points in reconstructed phase space Indicates how rate of divergence scales over fixed intervals of time Should converge to L+ if appropriate embedding dimension m and time lag t are chosen m ⎛ L' (t j +1 ) ⎞ 1 + ⎟ L = ∑ Log 2 ⎜ ⎜ L(t ) ⎟ t j =1 j ⎝ ⎠
Copyright © 1999 – 2006 Investment Analytics
Forecasting Financial Markets – Nonlinear Dynamics
Slide: 41
Largest Lyapunov Exponents of International Equity Markets Equity Market
Lyapunov (bit / month)
S&P500 UK Japan Germany
0.0241 0.0280 0.0228 0.0168
Indicated Cycle (months) 42 36 44 60
Source: Peters (1991) Copyright © 1999 – 2006 Investment Analytics
Forecasting Financial Markets – Nonlinear Dynamics
Slide: 42
Conclusions ¾
Long memory process Confirmed by two independent methods of analysis • R/S and Lyapunov
¾
Equity and bond markets - nonlinear systems Aperiodic cycles • E.g. Average cycle length 42 months in S&P 500 index Strange attractors • Fractal attractor dimension 2.33 (5.17) Fractional noise short term (technical factors?) Chaotic long term (fundamental analysis?)
¾
Currency markets have no cycle - black noise
Copyright © 1999 – 2006 Investment Analytics
Forecasting Financial Markets – Nonlinear Dynamics
Slide: 43