Nolds examples¶
You can run some examples for the functions in nolds with the command
python -m nolds.examples <key>
where <key>
can be one of the following:
lyapunov-logistic
shows a bifurcation plot of the logistic map and compares the true lyapunov exponent to the estimates obtained withlyap_e
andlyap_r
.lyapunov-tent
shows the same plot aslyapunov-logistic
, but for the tent map.profiling
runs a profiling test with the packagecProfile
.hurst-weron2
plots a reconstruction of figure 2 of the weron 2002 paper about the hurst exponent.hurst-hist
plots a histogram of hurst exponents obtained for random noise.hurst-nvals
creates a plot that compares the results of different choices for nvals for the functionhurst_rs
.sampen-tol
compares old and new default tolerance values forsampen
.hurst_mf_stock
example function recreates a plot from Di Matteo (2003).barabasi_1991_figure2
andbarabasi_1991_figure3
recreate the respective plots from Barabasi et al. (1991)lorenz
calculates all main measures ofnolds
for x, y, and z coordinates of a Lorenz plot and compares them to prescribed values from the literature.
These tests are also available as functions inside the module nolds.examples
.
Functions in nolds.examples
¶
- nolds.examples.plot_lyap(maptype='logistic')[source]¶
Plots a bifurcation plot of the given map and superimposes the true lyapunov exponent as well as the estimates of the largest lyapunov exponent obtained by
lyap_r
andlyap_e
. The idea for this plot is taken from [ll].This function requires the package
matplotlib
.References:
[ll]Manfred Füllsack, “Lyapunov exponent”, url: http://systems-sciences.uni-graz.at/etextbook/sw2/lyapunov.html
- Kwargs:
- maptype (str):
can be either
"logistic"
for the logistic map or"tent"
for the tent map.
- nolds.examples.profiling()[source]¶
Runs a profiling test for the function
lyap_e
(mainly used for development)This function requires the package
cProfile
.
- nolds.examples.weron_2002_figure2(n=10000)[source]¶
Recreates figure 2 of [w] comparing the reported values by Weron to the values obtained by the functions in this package.
The experiment consists of n iterations where the hurst exponent of randomly generated gaussian noise is calculated. This is done with differing sequence lengths of 256, 512, 1024, …., 65536. The average estimated hurst exponent over all iterations is plotted for the following configurations:
weron
is the Anis-Lloyd-corrected Hurst exponent calculated by Weronrs50
is the Anis-Lloyd-corrected Hurst exponent calculated by Nolds with the same parameters as used by Weronweron_raw
is the uncorrected Hurst exponent calculated by Weronrs50_raw
is the uncorrected Hurst exponent calculated by Nolds with the same parameters as used by Weronrsn
is the Anis-Lloyd-corrected Hurst exponent calculated by Nolds with the default settings of Nolds
The values reported by Weron are only measured from the plot in the PDF version of the paper and can therefore have some small inaccuracies.
This function requires the package
matplotlib
.References:
[w]R. Weron, “Estimating long-range dependence: finite sample properties and confidence intervals,” Physica A: Statistical Mechanics and its Applications, vol. 312, no. 1, pp. 285–299, 2002.
- Kwargs:
- n (int):
number of iterations of the experiment (Weron used 10000, but this takes a while)
- nolds.examples.plot_hurst_hist()[source]¶
Plots a histogram of values obtained for the hurst exponent of uniformly distributed white noise.
This function requires the package
matplotlib
.
- nolds.examples.hurst_compare_nvals(data, nvals=None)[source]¶
Creates a plot that compares the results of different choices for nvals for the function hurst_rs.
- Args:
- data (array-like of float):
the input data from which the hurst exponent should be estimated
- Kwargs:
- nvals (array of int):
a manually selected value for the nvals parameter that should be plotted in comparison to the default choices