Changes

,  11:37, 14 August 2015
updated with good example
Line 193: Line 193:
=== Testing for Nonlinearity ===

=== Testing for Nonlinearity ===
This section is discussed on the [http://www.mpipks-dresden.mpg.de/~tisean/Tisean_3.0.1/docs/chaospaper/node29.html#SECTION00080000000000000000 TISEAN documentation page]. One of the functions discussed is {{Codeline|d2}}. It is used to estimate the correlation sum, correlation dimension and correlation entropy of a time series. The time series used here will be the Henon map.
+
This section is discussed on the [http://www.mpipks-dresden.mpg.de/~tisean/Tisean_3.0.1/docs/chaospaper/node35.html#SECTION00090000000000000000 TISEAN documentation page]. The focus of this section will be the function {{Codeline|surrogates}}. It uses surrogate data to determine weather data is nonlinear. Let us first create the input data which will be a stationary Gaussian linear stochastic process. It is measured by {{Codeline|s(xn) &#61; xn^3}}. We then run it through {{Codeline|surrogates}} and plot the data.
{{Code|Calculation correlation sum, dimension and entropy|<syntaxhighlight lang="octave" style="font-size:13px">
+
{{Code|Creating data from Gaussian process|<syntaxhighlight lang="octave" style="font-size:13px">
# Create maps
+
# Create Gaussian process data
hen      = henon (10000);
+
g = zeros (2000,1);
# Calculate the correlation sum, dimension and entropy
+
for i = 2:2000
vals = d2 (hen, 'd', 1, 'm', 5, 't',50);
+
g(i) = 0.7 * g(i-1) + (-6 + sum (rand ([size(1), 12]), 3));
# Plot correlation sum
+
endfor
subplot (2,3,1)
+
# Create a measurement of it
do_plot_corr = @(x) loglog (x{1}(:,1),x{1}(:,2),'b');
+
spike = g.^3;
hold on
+
# Create the surrogate
arrayfun (do_plot_corr, {vals.c2});
+
sur  = surrogates (spike);
hold off
+
# Plot the data
xlabel ("Epsilon")
+
subplot (2,1,1)
ylabel ("Correlation sums")
+
plot (spike,'g');
title ("c2");
+
title ("spike")
# Plot correlation entropy
+
subplot (2,1,2)
subplot (2,3,4)
+
plot (sur,'b');
do_plot_entrop  = @(x) semilogx (x{1}(:,1),x{1}(:,2),'g');
+
title ("surrogate")
hold on
−
arrayfun (do_plot_entrop, {vals.h2});
−
hold off
−
xlabel ("Epsilon")
−
ylabel ("Correlation entropies");
−
title ("h2")
−
# Plot correlation dimension
−
subplot (2,3,[2 3 5 6])
−
do_plot_slope = @(x) semilogx (x{1}(:,1),x{1}(:,2),'r');
−
hold on
−
arrayfun (do_plot_slope, {vals.d2});
−
hold off
−
xlabel ("Epsilon")
−
ylabel ("Local slopes")
−
title ("d2");
−
</syntaxhighlight>}}
−
[[File:d2_out.png|400px|center]]
−
The output of {{Codeline|d2}} can be further processed using the following functions: {{Codeline|av_d2}}, {{Codeline|c2t}}, {{Codeline|c2g}}. This tutorial will show how to use {{Codeline|av_d2}} which smooths the output of {{Codeline|d2}} (usually used to smooth the "{{Codeline|d2}}" field of the output).
−
{{Code|Smooth output of d2|<syntaxhighlight lang="octave" style="font-size:13px">
−
# Smooth d2 output
−
figure 2
−
smooth = av_d2 (vals,'a',2);
−
# Plot the smoothed output
−
do_plot_slope = @(x) semilogx (x{1}(:,1),x{1}(:,2),'b');
−
hold on
−
arrayfun (do_plot_slope, {smooth.d2});
−
hold off
−
xlabel ("Epsilon")
−
ylabel ("Local slopes")
−
title ("Smooth");

</syntaxhighlight>}}

</syntaxhighlight>}}
+

[[File:tisean_av_d2_out.png|400px|center]]

[[File:tisean_av_d2_out.png|400px|center]]
Optionally the line "{{Codeline|figure 2}}" can be omitted, which will cause the smoothed version to be superimposed on the "raw" version that came straight from {{Codeline|d2}}.
+
It is crucial that the input to surro

[[Category:Octave-Forge]]

[[Category:Octave-Forge]]
156

edits