I am trying to run a Hill estimator on a rolling window of observations, however I am having trouble to get the sub-sample for each window. So far what I have is this:
Code: Select all
'Move sample !step at a time
for !i=1 to !length-!window+1-!step step !step
!j=!j+1
for !upper=1 to 2
if !upper=1 then
smpl @first+!i-1 @first+!i+!window-2 'Setting sample to each window
sort(d) y 'Sorting the data because I just want to use the biggest 10% of the observations in the window
'I know the following lines do not work/make sense, but hopefully you can understand what I am trying to do
!start= @first+!i-1
!end = @first+!i+!window-2
!prop=0.1
!truncnumber = !start+@floor((!prop)*(!end-start)
smpl !start !truncnumber 'This is where I want to set the sample to the original first observation of the window and biggest 10% of that window
'Do stuff Here
Thanks.
