I would like calculate the Hurst exponent with R. Is there a library or built in function that can do this? any suggestion will be appreciated (even weblinks to references).
update: thanks to the comment of Ben Bolker, I have found this script in the example of the function
hurst.est(wspec, range, nvoice, plot=TRUE)
at this page http://finzi.psych.upenn.edu/R/library/Rwave/html/hurst.est.html
script:
wnoise <- rnorm(8192)
plot.ts(wnoise)
spwnoise <- fft(wnoise)
spwnoise <- Mod(spwnoise)
spwnoise <- spwnoise*spwnoise
plot(spwnoise[1:4096], log="xy", type="l")
lswnoise <- lsfit(log10(1:4096), log10(spwnoise[1:4096]))
abline(lswnoise$coef)
cwtwnoise <- DOG(wnoise, 10, 5, 1, plot=FALSE)
mcwtwnoise <- Mod(cwtwnoise)
mcwtwnoise <- mcwtwnoise*mcwtwnoise
wspwnoise <- tfmean(mcwtwnoise, plot=FALSE)
wspec.pl(wspwnoise, 5)
hurst.est(wspwnoise, 1:50, 5)
I guess that the first part generate a signal with memory effect, but I can't understand which part of the second part of code is strictly necessary to estimate the hurst exponent. Who can help me and would explain this? I am in doubt with
mcwtwnoise <- Mod(cwtwnoise)
mcwtwnoise <- mcwtwnoise*mcwtwnoise
(Converted from a comment.)
This isn't exactly an answer, but
install.packages("sos")
library("sos")
findFn("hurst exponent")
should get you there pretty quickly. Notes: (1) you only need to do install.packages(...)
once per installation of R, but library("sos")
in every session; (2) you still need to work out whether the packages that you find this way are doing what you need -- but at least you know where to start.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With