*
* @HillGEV( options ) x start end
*
* Estimates the tail index for a distribution using Hill's method.
* Hill, B.M. (1975), "A Simple General Approach to Inference About the Tail of a
* Distribution," Annals of Statistics, 3, 1163-1174.
*
* Parameters:
* x series to analyze
* start end range of x to analyze [full range]
*
* Options:
* TAIL=[LEFT]/RIGHT which tail to analyze
* SMPL=series with 0's in observations to skip [not used]
* ORDER/[NOORDER] Use ORDER if the series is not already sorted (in increasing order).
* If you're doing the estimates for more than one span, it's a good idea to sort
* (a copy of) the series first.
* SPAN=number of extreme observations used [10% of number of data points]
* The estimate is the difference between the mean of the log's of the SPAN-1 most
* extreme values and the log of the "SPAN"th most extreme value.
*
* Variables Defined:
* %%HILL = estimate of the tail index
* %%HILLSE = estimate of the standard error for %%HILL
*
* Revision Schedule:
* 03/2007 Written by Tom Doan, Estima.
*
procedure HillGEV x start end
type series x
type integer start end
*
option choice tail 1 left right
option series smpl
option switch order 0
option integer span
*
local integer startl endl nvalid spanl
local series copy
declare real %%hill %%hillse
*
inquire(series=x) startl<>%%hill
else
sstats(mean) endl-spanl+2 endl log(copy(endl-spanl+1)/copy(t))>>%%hill
compute %%hillse=abs(%%hill)/sqrt(spanl)
end