简体   繁体   中英

Modelling and Plotting Fat Tails - Python

I am working with Stock Indices. I have a Numpy Array which contains the daily returns data for the Index for last 25 yrs or so. I have Plotted the Empirical PDF and also the Corresponding Normal PDF to show how deviant the actual data is from a Normal Distribution. 在此处输入图片说明

My questions are:-

  1. Is there a Pythonic way to test if my Left Tail is actually a Fat Tail or not?

  2. And in the above graph how do I mark a point/ threshold beyond which I can say the Tail is Fat?

Consider scipy.stats.kurtosistest and scipy.stats.skewtest .

To your second question, use .axvline to mark your line there. Depending on how granular the bins are, try finding the first point left of zero that meets the following condition:

df
Out[20]: 
      Normal  Empirical
Bin                    
-1.0       0        2.0
-0.9       1        2.5
-0.8       2        3.0
-0.7       3        3.5
-0.6       4        4.0
-0.5       5        4.5
-0.4       6        5.0
-0.3       7        6.0
-0.2       8        8.0
-0.1       9       10.0
 0.0      10       12.0

df.index[(df.Normal.shift() < df.Empirical.shift()) 
          & (df.Normal == df.Empirical)].values
Out[38]: array([-0.6])

And lastly, you could consider plotting the actual histogram in addition to fitted distribution, and using an inset, as is done here . 在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM