Hi. Not sure why this code produces the error like this. This error appears
when i run the code of print "Hurst(GBM): %s" % hurst(gbm):
Traceback (most recent call last): File "<pyshell#31>", line 1, in <module>
print "Hurst(GBM): %s" % hurst(gbm)NameError: name 'hurst' is not defined
Here is the full code:>>> import statsmodels.tsa.stattools as ts
>>> import urllib>>> from datetime import datetime>>> from pandas_datareader
>>> import data, wb>>> from pandas_datareader.data import DataReader>>> goog =
>>> DataReader("GOOG", "yahoo", datetime(2000,1,1), datetime(2017,1,1))>>>
>>> ts.adfuller(goog['Adj Close'], 1>>> import numpy as np
>>> from numpy import cumsum, log, polyfit, sqrt, std, subtract>>> from
>>> numpy.random import randn>>> def hurst(ts): lags = range(2, 100) tau =
>>> [sqrt(std(subtract(ts[lag:], ts[:-lag]))) for lag in lags] poly =
>>> polyfit(log(lags), log(tau), 1) return poly[0]*2.0>>> gbm =
>>> log(cumsum(randn(100000))+1000)>>> mr = log(randn(100000)+1000)>>> tr =
>>> log(cumsum(randn(100000)+1)+1000)>>> print "Hurst(GBM): %s" % hurst(gbm)
[[alternative HTML version deleted]]
______________________________________________
[email protected] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.