Identifying and predicting jumps in �nancial timeseries
Petros Dellaportas, UCL
with Alexopoulos (AUEB, Athens) and Papaspiliopoulos (UPF, Barcelona)
25/11/2016, Vienna
Jump identi�cation from daily close prices for the 600 stocks of theEuroStoxx 600 index (January 8 of 2007 - November 5 of 2014).
2008 2010 2012 2014
stocks
1100
200300
400500
571
Dots denote estimated probability of a jump > 0.5; Bottom graphdepicts the total number of estimated jumps
Observe only returns yt , everything else is unobserved:
yt = exp(ht/2)εt +Nt∑j=1
ξj , εt ∼ N(0, 1)
ht = µ+ φ(ht−1 − µ) + ηt , ηt ∼ N(0, σ2η)
I Nt ∼ Poisson(Λt∆t), ∆t is the distance between twosuccessive observations
I Λt ∼ gamma(1, 50) (informative) so that the probability of nojump at time t is .98
I {ξj}Ntj=1
iid∼ N(µξ, σ2ξ ), µξ ∼ N(0, 5R2), σ2ξ ∼ IG (3,R2/18)
where R is the range of the data.I h0 ∼ N(µ, σ2η/(1− φ2))I µ ∼ N(0, 10)I (φ+ 1)/2 ∼ Beta(20, 1.5) (informative)I σ2η ∼ χ21, does not bound ση away from zero a priori, see
Kastner and Frühwirth-Schnatter (2014) andFrühwirth-Schnatter and Wagner (2010).
Disentangling Volatility from Jumps
Bayesian inference with MCMC: how we sample the full conditionaldensities
I Sample simultaneously the vector of the log-volatility process
I Sample the number of jumps with rejection sampling
I Sample the parameters using interweaving; see Yu and Meng(2011) and Kastner and Frühwirth-Schnatter (2014).
I Contribution: we separate the volatility from the jump processwithout using any approximation of the model as it wasproposed by Chib et al. (2002).
Sampling the volatility process
I Denote Y = (y1, y2, . . . , yT ), θ = (µ, φ, σ2η, µξ, σ2ξ ),
H = (h1, . . . , hT ), N = (N1, . . . ,NT ) and Ξ = (ξ1, . . . , ξT ).
I Conditioning on number of jumps N and integrating out jumpsizes Ξ, sample from
p(H|θ,Y ) ∝ p(Y |H, θ)p(H|θ)
I Prior p(H) = N (H|M,Q−1)
I There are many ways to do this -here we use an idea by Titsiasthat was �rst appeared in the discussion of the RSSBdiscussion paper by Girolami and Calderhead (2011).
I The advantage is that we sample the whole vector H as ablock with one Metropolis move.
Sampling p(H |θ,Y ) ∝ p(Y |H , θ)p(H |θ)
I Current state of H is Hn. Say we wish to use slice Gibbs:
I Introduce auxiliary variables U that live in the same space asH: p(U|Hn) = N (U|Hn + δ
2∇ log p(Y |Hn), δ2 I )
I U injects Gaussian noise into Un and shifts it by(δ/2)∇ log p(Y |Hn)
I We cannot sample from p(H|U) so we use a Metropolis step:Propose H∗ from proposal q:
q(H∗|U) =1
Z(U)N (H∗|U, δ
2I )p(H∗)
= N (H∗|(I +δ
2Q)−1(U +
δ
2QM),
δ
2(I +
δ
2Q)−1).
where Z(U) =∫N (H∗|U, δ2 I )p(H∗)dH∗.
I Accept H∗ with Metropolis-Hastings probability min(1, r):
r =p(Y |H∗)p(U|H∗)p(H∗)p(Y |Hn)p(U|Hn)p(Hn)
q(Hn|U)
q(H∗|U)
=p(Y |H∗)p(U|H∗)p(H∗)p(Y |Hn)p(U|Hn)p(Hn)
1
Z(U)N (Hn|U, δ
2I )p(Hn)
1
Z(U)N (H∗|U, δ
2I )p(H∗)
=p(Y |H∗)N (U|H∗ + δ
2Gy ,
δ2I )
p(Y |Hn)N (U|Hn + δ2Gt ,
δ2I )
N (Hn|U, δ2I )
N (H∗|U, δ2I )
=p(Y |H∗)p(Y |Hn)
exp
{−(U − Hn)
TGt + (U − H∗)TGy −δ
4(||Gy ||2 − ||Gt ||2)
}where Gt = ∇ log p(Y |Hn), Gy = ∇ log p(Y |H∗) and ||Z || denotes theEuclidean norm of a vector Z .
I The Gaussian prior terms p(Hn) and p(H∗) have been cancelled out from theacceptance probability, so their evaluation is not required: the resulting q(H∗|U)is invariant under the Gaussian prior.
I Tune δ to achieve an acceptance rate of around 50− 60%.
Rejection sampling for the number of jumpsI Target: the discrete log-concave distribution with density
p(Nt |ht ,Λt , yt , θ).I Proposal: Choose as m any point after the mode, use as a
proposal the red-dotted discrete density: it is a geometric afterm.
n
log(p(n))
mode m
Jump identi�cation from daily close prices for the 600 stocks of theEuroStoxx 600 index (January 8 of 2007 - November 5 of 2014).
2008 2010 2012 2014
stocks
1100
200300
400500
571
Dots denote estimated probability of a jump > 0.5; Bottom graphdepicts the total number of estimated jumps
Jumps prediction
I Key idea: Use a Bayesian hierarchical model for alli = 1, , . . . , p = 600 stocks to borrow strength
Nit ∼ Poisson(Λit∆it)
Λit = λ (1 + exp(−bi −WiFt))−1
λ = 0.15 is the maximum intensity of each stock, W is a p × Kmatrix of factor loadings with rows Wi and each Ft areK -dimensional time-varying independent factors
Ft = AFt−1 + et , t = 2, . . . ,T ,
et ∼ NK (0, IK ), A = diag(α1, . . . , αK ).
The full model
yit = exp(hit/2)εit +
Nit∑j=1
ξij , εit ∼ N(0, 1)
hit = µi + φi (hi ,t−1 − µi ) + ηit , ηit ∼ N(0, σ2iη)
{ξij}Nitj=1
iid∼ N(µiξ, σ2iξ), µiξ ∼ N(0, 5R2
i ), σ2iξ ∼ IG (3,R2i /18)
Nit ∼ Poisson(Λit∆it)
Λit = λ (1 + exp(−bi −WiFt))−1
Ft = AFt−1 + et
MCMC
I We integrate out the jump sizes Ξ and we target the posteriordistribution
p(θ, h,N,F |Y )
where the parameters and the data correspond to all stocks.
I p(hi |N,F , θ): Metropolis as in the 1-dim
I p(Ni |H,F , θ): rejection sampling as in the 1-dim
I p(F |H,N, θ): Label and sign switching are not taken care ofduring MCMC, see also Aÿmann et al. (2016); we chooseinformative prior distributions for the parameters of the factorprocess such that 2 jumps are expected on average every 100days. We sample all factors simultaneously based on theauxiliary Metropolis algorithm described for the 1-d case.
I p(θ|H,N,F ): we use interweaving
We choose prior distributions for the parameters b, the factorloadings in the matrix W and for the persistent parameters of thematrix A such that the induced prior (histogram) for the intensityΛit of the ith stock at time t is comparable with the Gamma(1, 50)prior (red line) used in the univariate model.
Λit
0.00 0.02 0.04 0.06 0.08 0.10 0.12 0.14
05
1015
2025
3035
Separating volatility and jumps: simulation resultsSimulated log returns (top) and their volatility path (bottom -blue)for 3 of the p = 300 time series of length T = 1500 with K = 2factors. Bottom, Red: posterior mean of the volatility path. Blackcircles: simulated jumps. Red and green crosses: estimatedprobability of jump greater than 50% and 70%.
Time
y 1t
0 500 1000 1500
−50
5
Time
h 1t
0 500 1000 1500
−2−1
01
Separating volatility and jumpsSimulated log returns (top) and their volatility path (bottom -blue)for 3 of the p = 300 time series of length T = 1500 with K = 2factors. Bottom, Red: posterior mean of the volatility path. Blackcircles: simulated jumps. Red and green crosses: estimatedprobability of jump greater than 50% and 70%.
Time
y 2t
0 500 1000 1500
−50
5
Time
h 2t
0 500 1000 1500
−2−1
0
Separating volatility and jumpsSimulated log returns (top) and their volatility path (bottom -blue)for 3 of the p = 300 time series of length T = 1500 with K = 2factors. Bottom, Red: posterior mean of the volatility path. Blackcircles: simulated jumps. Red and green crosses: estimatedprobability of jump greater than 50% and 70%.
Time
y 3t
0 500 1000 1500
−50
510
Time
h 3t
0 500 1000 1500
−2.5
−1.5
−0.5
0.5
Jump identi�cationBlack circles: simulated jumps for 50 of the p = 300 simulatedtimes series. Red crosses: estimated probability of at least onejump greater than 50%.
Time
stocks
125
50
1 500 1000 1500
Posterior distributions IPosterior (black lines) and prior (orange lines) distributions of thepersistent parameters of the simulated latent factors. The verticallines represent the simulated values.
0.75 0.80 0.85
05
1015
20
α1
Densi
ty
0.20 0.25 0.30 0.35 0.40 0.45
02
46
8
α2
Densi
ty
Posterior distributions for factor loadings (W )
95% credible intervals; red crosses indicate the simulated values.
−3 −2 −1 0 1 2
xx
xxx
xx
xx
xx
xxx
xx
xx
xx
xx
xx
xx
xxx
xx
xx
xx
xx
xx
xx
xx
xx
xx
xx
x
−3 −2 −1 0 1 2 3
xx
xx
xx
xx
xx
xx
xx
xx
xx
xx
xx
xx
xx
xx
xx
xx
xx
xx
xx
xxx
xx
xx
xx
xx
x
Posterior distributions for factor loadings (W ) after signswitching
95% credible intervals; red crosses indicate the simulated values.
−3 −2 −1 0 1 2
xx
xxx
xx
xx
xx
xxx
xx
xx
xx
xx
xx
xx
xxx
xx
xx
xx
xx
xx
xx
xx
xx
xx
xx
x
−3 −2 −1 0 1 2 3
xx
xx
xx
xx
xx
xx
xx
xx
xx
xx
xx
xx
xx
xx
xx
xx
xx
xx
xx
xx
xx
xx
xx
xxx
x
Centered, Non Centered and Interweaving
I Simulation of p = 150 series and K = 2 factors (λ = 0.15,T = 1500). The table belows ESS per unit of time for α1,α2based on M = 3000 iterations (thinned by 10).
I ESS = M/IF where IF = γ0/s2.
I γ0 estimated spectral density of the Markov chain at zero.I s2 is the sample variance of the MCMC draws.
scheme α1 = 0.8 α2 = 0.8
A : centered 50 70B : Non centered 20 50C : Interw. (Cent.-Non Cent.) 400 200D : Interweaving (Non Cent.- Cent.) 150 60
Results on real data
I Our dataset contains daily close prices for the 600 stocks ofthe EuroStoxx 600 index from the January 8 of 2007 until theNovember 5 of 2014.
I After removing stocks with less than 1500 prices and stockswith more than 10 consecutive zero returns we applied ourMCMC algorithm on the log-returns of each one of the rest571 stocks.
I We only present here results based on subset of this dataset-running in progress! We have used K = 2 factors in theintensity process.
Identi�ed jumps
2008 2010 2012 2014
stocks
1100
200300
400500
571
Posterior (black) and prior (orange) distributions for the persistentparameters of the K = 2 factors and posterior mean of the path ofthe two latent factors (right).
0.72 0.74 0.76 0.78 0.80 0.82
05
1015
2025
α1
Density
2008 2010 2012 2014
−4−2
02
46
8
f 1
−0.60 −0.55 −0.50 −0.45
05
1015
α2
Density
2008 2010 2012 2014
−4−2
02
4
f 2
Factor 1: 95% credible intervals for each stock loading
−0.5 0.0 0.5 1.0 1.5 2.0
Factor 2: 95% credible intervals for each stock loading
−2.5 −2.0 −1.5 −1.0 −0.5 0.0 0.5 1.0
Posterior correlationsPosterior mean correlations of jump intensities: 175 stocks of theLondon stock exchange.
0.00
0.25
0.50
0.75
1.00cor
Network based on jump intensitiesNodes represent stocks, edges are present when the posterior meancorrelation of jump intensities is > 0.9.
1
2
3
4
5
6
7
8
910
11
12
13
14
15
16
17
181920
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
4041
4243
44
45
4647
48
49
50
5152
53
54
55
565758
59
60
61
62
63
64
65
66
67
68
69
70
71
7273
74
757677
78
79
80
8182838485
86
87
88
89
90
91
92
93
94
95
96979899100101102103
104
105
106107
108
109
110111112
113
114
115116
117
118119
120
121
122
123124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141142
143
144
145
146
147
148
149
150
151
152153154155156157158
159160
161
162163
164
165
166
167
168
169
170171
172
173
174
175
176
177
178
179
180
181
182
183
184
185186
187
188189
190
191
192
193
194
195
196
197198
199200201202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225226
227
228
229
230231
232
233
234
235
236
237238
239
240
241
242
243
244
245
246
247248
249
250251252
253
254
255
256
257
258
259
260261
262263
264
265
266267
268
269
270
271
272
273
274275276277278279
280
281
282283
284
285
286287
288
289
290
291292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308309310311312
313
314
315
316317
318319
320
321
322
323324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340341
342343
344
345346
347
348
349350351
352
353
354
355
356
357
358
359
360
361
362
363
364
365366
367
368
369370
371
372
373
374
375
376
377
378
379
380381
382383
384
385386
387
388
389
390
391
392
393
394
395
396
397398
399
400
401
402
403404
405
406
407
408
409
410
411412
413
414
415
416
417418
419420
421
422423424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445446
447448
449
450
451
452453
454
455
456457458
459
460461
462
463
464465466467
468
469
470471472473474
475
476477478
479
480
481
482483
484
485
486487
488
489490
491492493494
495
496
497
498499500
501
502503
504
505
506
507
508
509
510
511512
513514
515
516
517
518
519
520
521
522
523
524
525
526527528
529
530
531
532
533
534
535
536
537538
539
540
541
542543544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563564
565
566567
568
569
570
571
southIMF
central
London
North
southIMF
central
London
North
Model comparison
For two competing models M1 and M2 and out of sampleobservations yT+1, . . . , yT+n we compute the sequence of Bayesfactors
p(yT+1|y1:T ,M1)
p(yT+1|y1:T ,M2), . . . ,
p(yT+1, yT+2, . . . , yT+n|y1:T ,M1)
p(yT+1, yT+2, . . . , yT+n|y1:T ,M2),
where for every model M and j = 1, . . . , n
p(yT+1, yT+2, . . . , yT+j |y1:T ,M) =
T+j∏t=T+1
p(yt |y1:t−1,M).
Problem
Assume θ is known and equal with the posterior mean. For eacht = T + 1, . . . ,T + n, we need to compute the likelihoodincrements
p(yt |y1:t−1,M) =∫p(h0:t−1,F1:t−1|y1:t−1)p(yt |Ft , ht)p(ht |ht−1)p(Ft |Ft−1)dh0:tdF1:t
Typically the above integral is computed using SMC methods butsince in our case the likelihood function is the product of the termsp(yit |Ft , hit) it contains a lot of information for the latent state Ftresulting in poor MC estimation of the integral (Beskos et al.,2014).
Solution
By observing that for each t = T + 1, . . . ,T + n, the marginallikelihood increment p(yit |y1:t−1) of the ith stock is given by∫
p(hi(0:t−1),F1:t−1|y1:t−1)p(yit |Ft , hit)p(hit |hi(t−1))p(Ft |Ft−1)dhi(0:t)dF1:t
we use annealed importance sampling (Neal, 2001) to obtainestimates of the marginal likelihoods
p(yi(T+1)|y1:T ,M), . . . , p(yi(T+1), yi(T+2), . . . , yi(T+n)|y1:T ,M)
and we compute the predictive Bayes factors
p(yi(T+1)|y1:T ,M1)
p(yi(T+1)|y1:T ,M2), . . . ,
p(yi(T+1), yi(T+2), . . . , yi(T+n)|y1:T ,M1)
p(yi(T+1), yi(T+2), . . . , yi(T+n)|y1:T ,M2),
to compare the competing models M1 and M2.
Log-Bayes factor of the univariate SV model with jumps against aunivariate SV model without jumps for 16 stocks of London. HereT = 1967 and out of sample size is n = 50. For each stock wereport estimated in-sample and out-of-sample (red circles) jumps.
8 , 0
Time
log. of
Bayes
factor
0 10 20 30 40 50
−0.5
0.00.5
1.0
5 , 1
Time
log. of
Bayes
factor
0 10 20 30 40 50
01
23
4
23 , 1
Time
log. of
Bayes
factor
0 10 20 30 40 50
−20
24
6
9 , 1
Time
log. of
Bayes
factor
0 10 20 30 40 50
050
100150
21 , 0
Time
log. of
Bayes
factor
0 10 20 30 40 50
0.51.0
1.5
9 , 0
Time
log. of
Bayes
factor
0 10 20 30 40 50
−0.6
−0.2
0.00.2
15 , 0
Time
log. of
Bayes
factor
0 10 20 30 40 50
02
46
8
4 , 0
Time
log. of
Bayes
factor
0 10 20 30 40 50
−0.1
0.00.1
0.20.3
6 , 2
Time
log. of
Bayes
factor
0 10 20 30 40 50
0.00.5
1.01.5
14 , 0
Time
log. of
Bayes
factor
0 10 20 30 40 50
−2−1
01
10 , 2
Time
log. of
Bayes
factor
0 10 20 30 40 50
01
23
45
6
11 , 0
Time
log. of
Bayes
factor
0 10 20 30 40 50
−2.5
−1.5
−0.5
13 , 0
Time
log. of
Bayes
factor
0 10 20 30 40 50
−0.6
−0.2
0.20.6
16 , 1
Time
log. of
Bayes
factor
0 10 20 30 40 50
−10
12
34
17 , 0
Time
log. of
Bayes
factor
0 10 20 30 40 50
−1.0
−0.5
0.00.5
9 , 0
Time
log. of
Bayes
factor
0 10 20 30 40 50
−2.5
−1.5
−0.5
0.5
Log-Bayes factor of the factor SV model with jumps against a SVmodel with jumps for 16 stocks of London. Here T = 1967 and outof sample size is n = 50. For each stock we report estimatedin-sample and out-of-sample jumps.
8 , 0
Time
log. of
Bayes
factor
0 10 20 30 40 50
−0.4
0.00.2
0.40.6
5 , 1
Time
log. of
Bayes
factor
0 10 20 30 40 50
0.00.2
0.40.6
0.81.0
23 , 1
Time
log. of
Bayes
factor
0 10 20 30 40 50
−0.4
0.00.2
0.4
9 , 1
Time
log. of
Bayes
factor
0 10 20 30 40 50
01
23
45
21 , 0
Time
log. of
Bayes
factor
0 10 20 30 40 50
0.00.4
0.81.2
9 , 0
Time
log. of
Bayes
factor
0 10 20 30 40 50
−0.05
0.05
0.15
0.25
15 , 0
Time
log. of
Bayes
factor
0 10 20 30 40 50
−0.2
0.00.1
0.2
4 , 0
Time
log. of
Bayes
factor
0 10 20 30 40 50
−0.35
−0.25
−0.15
−0.05
6 , 2
Time
log. of
Bayes
factor
0 10 20 30 40 50
−0.6
−0.4
−0.2
0.0
14 , 0
Time
log. of
Bayes
factor
0 10 20 30 40 50
0.00.5
1.01.5
2.0
10 , 2
Time
log. of
Bayes
factor
0 10 20 30 40 50
0.00.4
0.81.2
11 , 0
Time
log. of
Bayes
factor
0 10 20 30 40 50
0.01.0
2.03.0
13 , 0
Time
log. of
Bayes
factor
0 10 20 30 40 50
−0.2
0.00.1
0.20.3
16 , 1
Time
log. of
Bayes
factor
0 10 20 30 40 50
−0.4
−0.2
0.00.2
17 , 0
Time
log. of
Bayes
factor
0 10 20 30 40 50
0.00.5
1.01.5
2.0
9 , 0
Time
log. of
Bayes
factor
0 10 20 30 40 50
−0.2
0.00.2
0.40.6
Discussion
we have presented:
I A new algorithm for univariate SV with jumps
I A way to forecasting of jump intensities through jointmodelling of many stocks
I Evidence for better predictive performance