The routine bellow does not work and I can not find why...
Code: Select all
' compute Hill's estimate
subroutine local hill(scalar hill, series x, scalar m)
' get indices
stom(x, xvec)
vector xranks= @ranks(xvec)
vector m
vector xtemp
' get first m observations of sorted data
vector(m)=xtemp
xtemp = 0
for !i=1 to m
xtemp(xranks(!i)) = xvec(!i)
next
' find m-th point
!xm = xtemp(m)
' find mean of first m-1 points
!xsum = @sum(xtemp) - !xm
!mean = !xsum / (m - 1)
' compute hill
hill = !mean - !xm
endsub
