Hurst Exponent-Rescaled Range Analysis

For posting your own programs to share with others

Moderators: EViews Gareth, EViews Moderator

trubador
Did you use forum search?
Posts: 1518
Joined: Thu Nov 20, 2008 12:04 pm

Hurst Exponent-Rescaled Range Analysis

Postby trubador » Mon Jul 13, 2009 1:35 am

Please find attached two subroutines that each provides a different estimation of Hurst Exponent for Rescaled Range Analysis.

Code: Select all

subroutine hurst(series y)
series ym
!n = @obs(y)
series RS_sum
series RS_ave
for !i=2 to !n
 !count = 1
  series R
   for !j = 1 to !n-!i+1 step !i
    series cumser
    smpl !j !i+!j-1
    !S = @stdev(y)
    series ym = y - @mean(y)
    cumser = @cumsum(ym)
    R(!count) = (@max(cumser) - @min(cumser))/!S
    !count = !count+1
  next
    smpl 1 !count-1
    RS_sum = @cumsum(R)
    RS_ave(!i) = RS_sum(!count-1)/(!count-1)
next
smpl @all   
!start = @floor(10^(@log10(!n)*.25))
!end = @floor(10^(@log10(!n)*.75))
smpl !start !end
equation eq1.ls @log10(RS_ave) c @log10(@trend(0))
vector(1) hurst = eq1.@coefs(2)
smpl @all
delete cumser r rs_ave rs_sum ym
endsub



Code: Select all

subroutine hurst(series y)
series ym
series R
!n = @obs(y)
for !i=2 to !n
 !R_sum = 0
 !S_sum = 0
  for !j = 1 to !n-!i+1
    series cumser
    smpl !j !j+!i-1
    !S = @stdevp(y)
    ym = y - @mean(y)
    cumser = @cumsum(ym)
    !R = @max(cumser) - @min(cumser)
    !R_sum = !R_sum + !R
    !S_sum = !S_sum + !S
  next
 R(!i) = !R_sum / !S_sum
next   

smpl @first+2 @last
equation eq1.ls @log10(R) c @log10(@trend(0))
vector(1) hurst = eq1.@coefs(2)
smpl @all
delete ym r cumser
endsub

mmc23
Posts: 21
Joined: Sat Jan 11, 2014 9:44 am

Re: Hurst Exponent-Rescaled Range Analysis

Postby mmc23 » Fri Apr 11, 2014 2:58 am

hi Mr trubador
I have simple suggestion, would you like to write an add-in for test the long memory which includes (R/S classic and Lo's, Moody and Wu test, GPH, GSP test...)
i have seen that the other software like Rats and stata matlab can do this test, if possible also the add-in can calculate hurst with many methode like R/S and Rescaled Variance...etc (Ref 'Long-Memory Processes Probabilistic Properties and Statistical Methods, Springer 2013, Jan Beran & al, pp 409-1-416').

best regards.

ahmedex
Posts: 1
Joined: Tue Oct 27, 2015 1:25 pm

Re: Hurst Exponent-Rescaled Range Analysis

Postby ahmedex » Sun Nov 01, 2015 4:56 pm

This short program was posted last year (actually few years back). I found it very useful to compute Hurst coefficient. However, I wonder if the original author of this program or someone else can post additional commands to obtain R (square) and F-statistics from the series which generates Hurst coefficients.


Return to “Program Repository”

Who is online

Users browsing this forum: No registered users and 7 guests