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-logisticshows a bifurcation plot of the logistic map and compares the true lyapunov exponent to the estimates obtained withlyap_eandlyap_r.lyapunov-tentshows the same plot aslyapunov-logistic, but for the tent map.profilingruns a profiling test with the packagecProfile.hurst-weron2plots a reconstruction of figure 2 of the weron 2002 paper about the hurst exponent.hurst-histplots a histogram of hurst exponents obtained for random noise.hurst-nvalscreates a plot that compares the results of different choices for nvals for the functionhurst_rs.sampen-tolcompares old and new default tolerance values forsampen.hurst_mf_stockexample function recreates a plot from Di Matteo (2003).barabasi_1991_figure2andbarabasi_1991_figure3recreate the respective plots from Barabasi et al. (1991)lorenzcalculates all main measures ofnoldsfor 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_randlyap_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:
weronis the Anis-Lloyd-corrected Hurst exponent calculated by Weronrs50is the Anis-Lloyd-corrected Hurst exponent calculated by Nolds with the same parameters as used by Weronweron_rawis the uncorrected Hurst exponent calculated by Weronrs50_rawis the uncorrected Hurst exponent calculated by Nolds with the same parameters as used by Weronrsnis 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