Estimating Delay Embedding Parameters
The following functions can estimate good values that can be used in reconstruct
for either the delay time or the number of temporal neighbors.
Delay Time
#DelayEmbeddings.estimate_delay
— Function.
estimate_delay(s, method::String) -> τ
Estimate an optimal delay to be used in reconstruct
or embed
. Return the exponential decay time τ
rounded to an integer.
The method
can be one of the following:
"first_zero"
: find first delay at which the auto-correlation function becomes 0."first_min"
: return delay of first minimum of the auto-correlation function.
Embedding Dimension
#DelayEmbeddings.estimate_dimension
— Function.
estimate_dimension(s::AbstractVector, τ::Int, γs = 1:5, method = "afnn"; kwargs...)
Compute a quantity that can estimate an optimal amount of temporal neighbors γ
to be used in reconstruct
or embed
.
Description
Given the scalar timeseries s
and the embedding delay τ
compute a quantity for each γ ∈ γs
based on the "nearest neighbors" in the embedded time series.
The quantity that is calculated depends on the algorithm defined by the string method
:
"afnn"
(default) is Cao's "Averaged False Nearest Neighbors" method [1], which gives a ratio of distances between nearest neighbors. This ratio saturates around1.0
near the optimal value ofγ
(seeafnn
)."fnn"
is Kennel's "False Nearest Neighbors" method [2], which gives the number of points that cease to be "nearest neighbors" when the dimension increases. This number drops down to zero near the optimal value ofγ
. This method accepts the keyword argumentsrtol
andatol
, which stand for the "tolerances" required by Kennel's algorithm (seefnn
)."f1nn"
is Krakovská's "False First Nearest Neighbors" method [3], which gives the ratio of pairs of points that cease to be "nearest neighbors" when the dimension increases. This number drops down to zero near the optimal value ofγ
(seef1nn
).
Please be aware that in DynamicalSystems.jlγ
stands for the amount of temporal neighbors and not the embedding dimension (D = γ + 1
, see also embed
).
References
[1] : Liangyue Cao, Physica D, pp. 43-50 (1997)
[2] : M. Kennel et al., Phys. Review A 45(6), 3403-3411 (1992).
[3] : Anna Krakovská et al., J. Complex Sys. 932750 (2015)
#DelayEmbeddings.fnn
— Function.
fnn(s::AbstractVector, τ:Int, γs = 1:5; rtol=10., atol=2.)
Calculate the number of "false nearest neighbors" (FNN) of the datasets created from s
with a sequence of τ
-delayed temporal neighbors.
Description
Given a dataset made by embedding s
with γ
temporal neighbors and delay τ
, the "false nearest neighbors" (FNN) are the pairs of points that are nearest to each other at dimension γ
, but are separated at dimension γ+1
. Kennel's criteria for detecting FNN are based on a threshold for the relative increment of the distance between the nearest neighbors (rtol
, eq. 4 in [1]), and another threshold for the ratio between the increased distance and the "size of the attractor" (atol
, eq. 5 in [1]). These thresholds are given as keyword arguments.
The returned value is a vector with the number of FNN for each γ ∈ γs
. The optimal value for γ
is found at the point where the number of FNN approaches zero.
Please be aware that in DynamicalSystems.jlγ
stands for the amount of temporal neighbors and not the embedding dimension (D = γ + 1
, see also embed
).
See also: estimate_dimension
, afnn
, f1nn
.
References
[1] : M. Kennel et al., "Determining embedding dimension for phase-space reconstruction using a geometrical construction", Phys. Review A 45(6), 3403-3411 (1992).
#DelayEmbeddings.afnn
— Function.
afnn(s::AbstractVector, τ:Int, γs = 1:5, p = Inf)
Compute the parameter E₁ of Cao's "averaged false nearest neighbors" method for determining the minimum embedding dimension of the time series s
, with a sequence of τ
-delayed temporal neighbors [1].
Description
Given the scalar timeseries s
and the embedding delay τ
compute the values of E₁
for each γ ∈ γs
, according to Cao's Method (eq. 3 of [1]).
This quantity is a ratio of the averaged distances between the nearest neighbors of the reconstructed time series, which quantifies the increment of those distances when the number of temporal neighbors changes from γ
to γ+1
.
Please be aware that in DynamicalSystems.jlγ
stands for the amount of temporal neighbors and not the embedding dimension (D = γ + 1
, see also embed
).
Return the vector of all computed E₁
s. To estimate a good value for γ
from this, find γ
for which the value E₁
saturates at some value around 1.
Note: This method does not work for datasets with perfectly periodic signals.
See also: estimate_dimension
, fnn
, f1nn
.
References
[1] : Liangyue Cao, Physica D, pp. 43-50 (1997)
#DelayEmbeddings.f1nn
— Function.
f1nn(s::AbstractVector, τ:Int, γs = 1:5)
Calculate the ratio of "false first nearest neighbors" (FFNN) of the datasets created from s
with a sequence of τ
-delayed temporal neighbors.
Description
Given a dataset made by embedding s
with γ
temporal neighbors and delay τ
, the "first nearest neighbors" (FFNN) are the pairs of points that are nearest to each other at dimension γ
that cease to be nearest neighbors at dimension γ+1
[1].
The returned value is a vector with the ratio between the number of FFNN and the number of points in the dataset for each γ ∈ γs
. The optimal value for γ
is found at the point where this ratio approaches zero.
Please be aware that in DynamicalSystems.jlγ
stands for the amount of temporal neighbors and not the embedding dimension (D = γ + 1
, see also embed
).
See also: estimate_dimension
, afnn
, fnn
.
References
[1] : Anna Krakovská et al., "Use of false nearest neighbours for selecting variables and embedding parameters for state space reconstruction", J Complex Sys 932750 (2015), DOI: 10.1155/2015/932750
#DelayEmbeddings.stochastic_indicator
— Function.
stochastic_indicator(s::AbstractVector, τ:Int, γs = 1:4) -> E₂s
Compute an estimator for apparent randomness in a reconstruction with γs
temporal neighbors.
Description
Given the scalar timeseries s
and the embedding delay τ
compute the values of E₂
for each γ ∈ γs
, according to Cao's Method (eq. 5 of [1]).
Use this function to confirm that the input signal is not random and validate the results of estimate_dimension
. In the case of random signals, it should be E₂ ≈ 1 ∀ γ
.
References
[1] : Liangyue Cao, Physica D, pp. 43-50 (1997)
Mutual Information
Coming soon...