Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import numpy as np
- import matplotlib.pyplot as plt
- from hurst import compute_Hc, random_walk
- import seaborn as sns
- sns.set();
- %matplotlib inline
- np.random.seed(42)
- random_changes = 1. + np.random.randn(99999) / 1000.
- series = np.cumprod(random_changes)
- H, c, result = compute_Hc(series, kind='price', simplified=True)
- plt.rcParams['figure.figsize'] = 10, 5
- f, ax = plt.subplots()
- _ = ax.plot(result[0], c*result[0]**H)
- _ = ax.scatter(result[0], result[1])
- _ = ax.set_xscale('log')
- _ = ax.set_yscale('log')
- _ = ax.set_xlabel('log(time interval)')
- _ = ax.set_ylabel('log(R/S ratio)')
- print("H={:.3f}, c={:.3f}".format(H,c))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement