Copyright 2011 - 2019 Jon Danielsson.
This code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published
by the Free Software Foundation, either version 3 of the License,
or (at your option) any later version.
This code is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
The GNU General Public License is available at:
Listing 9.1/9.2: Hill estimator in MATLAB
Last updated 2011
ysort = sort(y); % sort the returns
CT = 100; % set the threshold
iota = 1/mean(log(ysort(1:CT)/ysort(CT+1))) % get the tail index
Listing 9.1/9.2: Hill estimator in Julia
Last updated June 2018
ysort = sort(y) # sort the returns
CT = 100 # set the threshold
iota = 1/mean(log.(ysort[1:CT]/ysort[CT+1])) # get the tail index