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:
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?
rm
people’s workspace, edited . $\endgroup$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$