8
$\begingroup$

I am trying to determine the Hurst exponent of a simple Brownian motion, however, I seem to get a result that differs from 0.5. I am following the instructions given on the Wikipedia-page, and here is the code I wrote in R for determining it:

library(ggplot2)

#generate Brownian motion
t <- 1:1e3
sig2 <- 0.01
x <- rnorm(n = length(t) - 1, sd = sqrt(sig2))
data <- c(0, cumsum(x))

#function to find Hurst exponent
simpleHurst <- function(y){
  sd.y <- sd(y)
  m <- mean(y)
  y <- y - m
  max.y <- max(cumsum(y))
  min.y <- min(cumsum(y))
  RS <- (max.y - min.y)/sd.y
  return(RS)
}

#find Hurst exponent of Brownian motion
df.rs <- data.frame()
for(i in c(1, 2, 4, 8, 16, 32)){
  RS <- 0
  n <- floor((length(data)/i))
  for(j in 0:(i-1)){
    X <- data[(1:n) + j*n]
    RS <- RS + simpleHurst(y = X)
  }

  df.rs <- rbind(df.rs, 
                 data.frame("log.t" = log(length(X)),
                            "log.RS"= log(RS / n)))
}

ggplot(data=df.rs,  aes(x=log.t, y=log.RS)) + geom_point(size=I(2))

This gives me the following plot:

enter image description here

This doesn't converge to 0.5 obviously. Is there an error in the script, or do I simply need to analyze a (much) longer time-series?

$\endgroup$
  • 3
    $\begingroup$ Please don’t rm people’s workspace, edited . $\endgroup$ – Bob Jansen Feb 24 '18 at 11:38
  • 1
    $\begingroup$ @BobJansen Good point, deleted it $\endgroup$ – BillyJean Feb 24 '18 at 11:39
  • 1
    $\begingroup$ fit <- lm(log.RS ~ log.t, data = df.rs) Just make sure the reference cited in wikipedia uses the same definition of $H$. According to this fit $H=-1$ $\endgroup$ – caverac Feb 24 '18 at 12:53
  • 2
    $\begingroup$ It certainly calculates $H$ according to wikipedia, whether this number matches what these (c.f. wikipedia's reference list) authors mean is a whole other story $\endgroup$ – caverac Feb 24 '18 at 13:07
  • 1
    $\begingroup$ caverac has answered this above - it's the slope of the graph you are after rather than it converging to a value. Something like slope = H - 1 $\endgroup$ – GodLovesATrier Apr 17 '18 at 10:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.