Fat Tail Analysis and Package Fattailsr
Total Page:16
File Type:pdf, Size:1020Kb
Fat Tail Analysis and Package FatTailsR [email protected] 9th R/Rmetrics Workshop 27June2015 Villa Hatt – Zürich [email protected] Fat Tail Analysis and Package FatTailsR 9th R/Rmetrics Workshop 27June2015 1 / 26 Outline 1 Introduction 2 Mathematics 3 Fat tails: Application in finance 4 Conclusion [email protected] Fat Tail Analysis and Package FatTailsR 9th R/Rmetrics Workshop 27June2015 2 / 26 About InModelia Since 2009: a small company located in Paris Consulting services in data analysis Design of experiments Multivariate nonlinear modeling Neural networks Times series Software development in R June 2014: 8th R/Rmetrics workshop First version of R package FatTailsR introducing Kiener distributions with symmetric (3 parameters) and asymmetric (4 parameters) fat tails June 2015: 9th R/Rmetrics workshop Second version of R package FatTailsR including 3 functions for parameter estimation R package FatTailsRplot including advanced plotting functions [email protected] Fat Tail Analysis and Package FatTailsR 9th R/Rmetrics Workshop 27June2015 3 / 26 Fat tails It is now well established that financial markets exhibit fat tails. It occurs on all markets. SP500 janv. 1957 − déc. 2013 SP500 janv. 1957 − déc. 2013 100 µ F(X) > 0.995 14349 points ●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●● ● ●● ●● ● ● ● X − 14350 points daily ●●●●●●●●●●●●●● 1.0 ●●●●●●●● ●●●●●● ●●●● ● ●●● ●●●●●●●● ●●●●● ● ●● ● ●● ●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●● ●●●●●●●●●●●●●● ●●●●●●●●●●●●●●●●●● ●●●●●●●●● ●●● ●●●● ●● 2975 points weekly ● ●● ●●●●●●●●●●●●●●●●●●●●●●●●● ●●●●●●●●●●●●● ●●●●●●●●●●●●●●● ●●●●● ●●● ● ●●●●●● ● ●● ●●●●●●●●●●●●●●●●●●●●●●●●● ●●●●●●●●●●●●●● ●●●●●●●●●●●●●●● ●●●●●●●●●●●●●●●●● ● ●● ●●●●●●●●●●●●●●●●●●●●● ●●●●●●●●●● ●●●●●●●●●●●● ●●●●●● ●●●●●●●●● ● ●● ●●●●●●●●●●●●●●●●●● ●●●●●●●● ●●●●●●●●●●●●● ●●●● ●●●●●● ● ●● ●●●●●●●●●●●●●●●● ●●●●●● ●●●●●●●●●●●● ●●●●●● ●●●●●●●● ● ●● ●●●●●●●●●●●●●●●●● ●●●●●● ●●●●●●●●●● ●●●●● ●●●● ● ● ●●●●●●●●●●●●●●●● ●●●●●● ●●●●●●●● ●●● ●●●●● ● ● ●●●●●●●●●●●●●●●● ●●●●● ●●●●●●● ●●●● ●●●●● ● ● ●●●●●●●●●●●●●●●● ●●●● ●●●●●●●● ●●● ●●● 685 points monthly ● ● ●●●●●●●●●●●●●● ●●●●● ●●●●●●●● ●●● ●●● ● ● ●●●●●●●●●●●●●● ●●●●● ●●●● ●●●● ●●●●●● ● ● ●●●●●●●●●●●●●● ●●●● ●●●●●●● ●●● ●●●● ● ● ●●●●●●●●●●●●● ●●●● ●●●●●● ●●● ●●●●● ● ● ●●●●●●●●●●●● ●●●● ●●●●● ●●● ●●● ● ● ●●●●●●●●●●●● ●●●●● ●●●●● ●●● ●●● ● ● ●●●●●●●●●●●● ●●●● ●●●●● ●● ●●●● ● ● ●●●●●●●●●●● ●●●●● ●●●● ●●● ●●●● ● ● ●●●●●●●●●● ●●● ●●●●● ●●● ●●●●● ● ● − ●●● ●●●●● ●●● ●●●● ●● ●●● 0.999 ● ● 1 ●●● ●●●● ●●● ●●● ● ●●● ● ● ●●●●●●●●●● ●● ●●●● ●● ● ● ● ●●●●●●●●● ●●● ●●●● ●● ●●● ● ● ●●● ●●●●● ●●● ●●●● ●● ● ● ● 10 ●●● ●●●●● ●●● ●●● ●● ●● ● ● ●● ●●● ●● ●●● ● ●● ● ● ●●● ●●●● ●●● ●●● ● ●● ● ● ●●● ●●●● ●●● ●●●● ●● ●●● ● ● ●●● ●●●●● ●●● ●●● ●● ●● ● ● ●●● ●●●●● ●● ●●●● ● ●●● ● ● ●●● ●●●●● ●● ●●● ●● ●●● ● ● ●●●● ●●●● ●●● ●●●●● ●● ● ● ● ●●● ●●●●● ●●● ●●● ●● ●● ● ● ●●● ●●●● ●● ●●●● ●● ● ● ● ●●● ●●●● ●● ●●● ●● ● ● ● ●●●●●●● ●● ●●●● ●● ●● ● ● ●● ●●●● ●● ●●● ● ● ● ● ● ●● ●●● ●●● ●● ●● ● ● ● ●●● ●●● ●●● ●●● ● ● ● ● ●●●●●● ●● ●● ● ● ● ● ●●●●●● ●● ●●● ● ●● ● ● ●●●●●●● ●● ●● ●● ● ● ● ●●●●● ●● ●● ● ●● ● ● ●●●●● ●● ●● ●● ● ● ● ●●●●●● ●● ●● ● ● ● ● ●●●●● ●●● ●●●● ● ● ● ● ●●●●● ● ● ● ● ● ● ●●●●● ●● ●● ● ● ● ● ●●●●● ●● ●● ● ● 0.997 ● ● ●●●●● ●● ●● ● ● ● ● ●●●●●● ● ●● ● ● ● ●●●●●● ●●● ●● ● ● ● ● ●●●●● ●● ●● ● ● ● ● ●●●●● ● ● ● ● ● ● ●●●●● ●● ●● ● ● ● ● ●● ● ●● ● ● ● ●●●●● ●● ●●● ● ● ● ● ●●●● ● ● ● ● ● ●●●● ● ●● ● ● ● − ●●●●●● ●● ● ● ● ● 2 ●●●● ● ● ● ● ● ●●●●●● ● ●● ● ● ● ● ●● ●● ●● ● ● ● ●●●●● ●● ● ● ● ● ● 10 ●●●● ● ●● ● ● ●● ● ● ● ● ●●●●● ● ● ● ● ●●●●● ● ● ● ● ● ● ●●● ● ● ● ● F(X) < 0.005 ●●●● ● ●● ● ●●● ● ● ● ● ● ●●●●● ● ● ● ● ● ● ● ●● ● ● ● ● ●●● ● ● ● ● ●●●● ● ● ● ● ●●●● ● ● 0.995 ● ● ●●● ● ● ● ●●●● ● ● ● ● ● ● ●●●● ● 4 6 8 10 ● ● ●● ● ● ● ●●● ● ● ● ● ●●● ● ● ● ●●● ● ● ●●● ● ● ● ● ● ●● ● ● 0.5 ● ● ● ● ● ● ● ● ● ● ● ● ● ●● ● ● ●● ●● ● ● ● ● ●● ● ● ● ●● ● ● ● ● ●● ●● ● ● ● ●● ● ● ● ● ●● ● ● ● ● ● ● ● ● ● ● ● ● ● − ● ● ● ● ● 3 ● ● ● 0.004 ● ● ● ● ● ● ● ● ● 10 ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ●● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ●● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● 0.002 ● ● ● ● − ● ● 4 ● ● ● ● 10 ● ● ● ● ● ● ● ● ● ● ● ● ● ● ●● ● ●● ● ●● ● ●● ● ● ●● ● ●● ● ●●● ● ●●● ● ●●● ● ●●● ●●●● ●●●● ●●●●●●● ●●●●●●●●● ●●●●●●●●●● 0.000 0.0 ●●● ● ● ●●●● ● ●● ●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●● −20 −15 −10 −5 − 10 5 −1 0 1 2 −10 −5 0 5 10 10 10 10 10 Figure : (a) SP500 daily log-returns (b) SP500 daily, weekly and monthly log-returns in log-log scale black dots = negative returns, white circles = positive returns ® ! lim F (x) x ¡ lim 1 F (x) x ¡ ®, ! 3.5 x Æ j j x ¡ Æ ¼ !¡1 !Å1 [email protected] Fat Tail Analysis and Package FatTailsR 9th R/Rmetrics Workshop 27June2015 4 / 26 Symmetric distributions K1. Asymmetric distributions K2, K3, K4 Last year 1, we introduced a family of four probability distributions which deal with symmetric and asymmetric fat tails. These distributions were named Kiener distributions or, simply, distributions K1, K2, K3, K4. They combine two log-logistic quantile functions, one for each tail. The parameters are: 2®! 1 1 ³ 1 1 ´ median ¹, scale γ, left tail ®, right tail !, shape parameter · ® ! or harmonic mean · 2 ® ! Æ Å Æ Å ³ ´ distorsion ± and eccentricity ² defined by ± ² 1 1 1 with bonds 1 ± 1 and 1 ² 1 Æ · Æ 2 ¡ ® Å ! ¡ · Ç Ç · ¡ Ç Ç Quantile functions of distributions K2(¹,γ,®,!), K3(¹,γ,·,±), K4(¹,γ,·,²), K1(¹,γ,·) 2 3 µ ¶ 1 µ ¶ 1 à logit(p) logit(p) ! p ¡ ® p ! (K2) x(p) ¹ γκ4 5 ¹ γκ e¡ ® e ! Æ Å ¡ 1 p Å 1 p Æ Å ¡ Å ¡ ¡ 2 3 µ ¶ 1 µ ¶ 1 µ ¶± µ ¶ p · p · p logit(p) ±logit(p) (K3) x(p) ¹ γκ4 ¡ 5 ¹ 2γκsinh e Æ Å ¡ 1 p Å 1 p 1 p Æ Å · ¡ ¡ ¡ 2 1 1 3 ² µ p ¶ · µ p ¶ · µ p ¶ · µ logit(p) ¶ ² logit(p) (K4) x(p) ¹ γκ4 ¡ 5 ¹ 2γκsinh e · Æ Å ¡ 1 p Å 1 p 1 p Æ Å · ¡ ¡ ¡ 2 1 1 3 µ p ¶ · µ p ¶ · µ logit(p) ¶ (K1) x(p) ¹ γκ4 ¡ 5 ¹ 2γκsinh ¹ γkogit(p, ·) Æ Å ¡ 1 p Å 1 p Æ Å · Æ Å ¡ ¡ 1P. Kiener, Explicit models for bilateral fat-tailed distributions and applications in finance with the package FatTailsR, 8th R/Rmetrics Workshop, Paris, 2014. http://www.inmodelia.com/fattailsr-en.html [email protected] Fat Tail Analysis and Package FatTailsR 9th R/Rmetrics Workshop 27June2015 5 / 26 Distribution K1 and some properties ³ x ¹ ´ Probability and density functions of distribution K1(¹,γ,·), t asinh ¡ Æ 2γκ 1 1 1 F (x) ³ x ¹ ´ f (x) f (0) Æ · asinh ¡ Æ 4γcosh(t)(1 cosh(·t)) Æ 8γ 1 e¡ 2γκ Å Å Logit-probability: Density as a function of the probability: ³ x ¹ ´ 1 logit(p) logit(F (x)) ·asinh ¡ f (x) sech( )p (1 p) Æ 2γκ Æ 2γ · ¡ Conversion between parameters ®, !, ·, ±, ² 1 1 µ 1 1 ¶ ² 1 µ 1 1 ¶ 1 1 1 1 ® ! · · ± ± ± ² ¡ ® ! · Æ 2 ® Å ! Æ · Æ 2 ¡ ® Å ! ® Æ · ¡ ! Æ · Å Æ ® ! Æ 1 ² Æ 1 ² Å ¡ Å Property 1: Pareto aymptotic functions ¯ ¯ ® ¯ ¯ ! ¯ x ¹ ¯¡ ¯ x ¹ ¯¡ lim F (x) ¯ ¡ ¯ lim 1 F (x) ¯ ¡ ¯ x Æ ¯ γκ ¯ x ¡ Æ ¯ γκ ¯ !¡1 !Å1 Property 2: Karamata theorem about slowly ®-varying and !-varying functions x f (x) x f (x) lim ® lim ! x F (x) Æ¡ x 1 F (x) Æ !¡1 !Å1 ¡ [email protected] Fat Tail Analysis and Package FatTailsR 9th R/Rmetrics Workshop 27June2015 6 / 26 Comparaison with other distributions Distributions K1, K2, K3, K4 are similar, but more tractable and easier to use than 2 Generalized Tukey lambda distribution and Tadikamalla and Johnson LU distribution . K2 and K4 distributions (Kiener, 2014): " µ ¶ 1/® µ ¶1/!# µ ¶ p ¡ p logit(p) ² logit(p) x(p) ¹ γκ ¹ 2γκsinh e · Æ Å ¡ 1 p Å 1 p Æ Å · ¡ ¡ Generalized Tukey lambda distribution (Ramberg et Schmeiser, 1972): 1 h ¸ ¸ i x(p) ¸1 (1 p) 4 p 3 Æ Å ¸2 ¡ ¡ Å LU distribution (Tadikamalla and Johnson, 1982): µ γ 1 ¶ x(p) » ¸ sinh logit(p) Æ Å ¡ ± Å ± 2Non-central Student distribution and Cauchy distribution were already discussed last year [email protected] Fat Tail Analysis and Package FatTailsR 9th R/Rmetrics Workshop 27June2015 7 / 26 Figures related to symmetric distribution K1 Quantiles : K1 ( µ = 0, γ = 1, κ = ... ) Probabilités : K1 ( µ = 0, γ = 1, κ = ... ) + Gauss ( σ = 3.2 ) Densités : K1 ( µ = 0, γ = 1, κ = ... ) + Gauss ( σ = 3.2 ) 20 1.0 0.15 κ κ κ 0.6 0.6 0.6 1 1 1 1.5 1.5 1.5 10 2 2 2 3.2 3.2 3.2 0.10 10 10 10 Gauss Gauss 0 0.5 0.05 −10 Kogit −20 0.0 0.00 0.0 0.5 1.0 −15 −10 −5 0 5 10 15 −15 −10 −5 0 5 10 15 Dérivées des quantiles : K1 ( µ = 0, γ = 1, κ = ... ) Logit(Proba) : K1 ( µ = 0, γ = 1, κ = ... ) + Logistique + Gauss (σ = 3.2 ) LogDensités : K1 ( µ = 0, γ = 1, κ = ... ) + Logistique + Gauss (σ = 3.2 ) 200 6.9 κ κ −2 0.6 0.6 1 4.6 1 1.5 1.5 2 2 3.2 2.9 3.2 10 10 −4 Logistique Gauss 100 0.0 κ 0.6 logit(q.999) = 6.9 1 −6 −2.9 logit(q.99) = 4.6 1.5 logit(q.95) = 2.9 2 logit(q.50) = 0 3.2 −4.6 logit(q.05) = −2.9 10 logit(q.01) = −4.6 Logistique logit(q.001) = −6.9 Gauss 0 −6.9 −8 0.0 0.5 1.0 −15 −10 −5 0 5 10 15 −15 −10 −5 0 5 10 15 Figure : Distribution K1 : (a) Quantiles - (b) Cumulative functions (c) Densities (d) Quantile derivatives - (e) Logit of the cumulative functions - (f) Logdensities [email protected] Fat Tail Analysis and Package FatTailsR 9th R/Rmetrics Workshop 27June2015 8 / 26 Figures related to asymmetric distributions K2, K3, K4 Quantiles : K2 ( µ = 0, γ = 1, α = 2, ω = ... ) Quantiles + Probabilités : K2 ( µ = 0, γ = 1, α = 2, ω = ... ) Quantiles + Densités : K2 ( µ = 0, γ = 1, α = 2, ω = ... ) 15 1.0 0.200 ω ω ω 0.6 0.6 0.6 10 1 1 1 1.5 1.5 1.5 2 2 2 3.2 3.2 3.2 5 10 10 0.125 10 0 0.5 −5 −10 −15 0.0 0.000 0.0 0.5 1.0 −15 −10 −5 0 5 10 15 −15 −10 −5 0 5 10 15 Dérivées des quantiles : K2 ( µ = 0, γ = 1, α = 2, ω = ... ) Quantiles + Logit(Probabilités) : K2 ( µ = 0, γ = 1, α = 2, ω = ... ) Quantiles + Log−Densités :