Program to calculate the nonlinear measure (NLM) from time series data
Isao Tokuda,
Institute for Theoretical Biology,
Humboldt University of Berlin, Germany
Description
The program
(nlm.c)
computes the nonlinear measure from time series
data composed of a single dynamical variable.
The data set and the parameters have to be provided in two files
and the results of the program, namely,
deterministic-versus-stochastic (DVS) plot and the nonlinear
measure (NLM) are written into two other files (see below).
The algorithm for obtaining the DVS plot has been proposed by
M. Casdagli [1] and the nonlinear measure has been calculated
from the DVS plot by Tokuda et. al [2].
The present program
(nlm.c)
is the one used in [2].
The input files are:
The output files are:
The file
parameters.txt
has to contain the following parameters
given as plain numbers (ascii), arranged as shown below:
- length: Length of the data set
(e.g., 2000, if the data is composed of 2000 points)
- dim: Embedding dimension [2]
(e.g., 3 to set the embedding dimension three)
The linked file
parameters.txt
sets the parameters as length = 2000 and dim = 3
just to show as an example.
Please rewrite the parameter
file for your own use.
The file
data.txt
has to contain a series of dynamical data given
as real numbers.
The linked file
data.txt
gives a time series data generated from the Lorenz
equation to show a sample data file.
To apply the program to your own data, please
substitute
your data file by naming it as
data.txt .
When the program is done, two output files are produced.
- The file
dvs_plot.txt
will contain signal-to-noise ratio
and percentage of the number of neighbors. This file can be
used to generate the DVS-plot (see Fig. 4, 5(a), 7, 8, 9
of [2]).
-
The file
nlm_value.txt
will contain the NLM outcome.
The above linked output files have been generated by
applying the program to the lorenz data
(data.txt)
with
(length, dim) = (2000, 3)
to show as an example.
References:
- M. Casdagli:
Chaos and deterministic versus stochastic nonlinear modelling
J. R. Stat. Soc. B. 54: 303-328 (1992).
- I. Tokuda, T. Riede, J. Neubauer, M.J. Owren, H. Herzel:
Nonlinear analysis of irregular animal vocalizations,
Journal of the Acoustical Society of America 111:
2908-2919 (2002).
Usage
- Compile the program
(nlm.c)
with a normal gcc compiler as
% gcc nlm.c -lm
The object file can be
a.out
or any other name like
nlm.out
as you prefer.
- Execute the program with
% a.out
where the input data file
data.txt
and the parameter file
parameters.txt
should be provided as explained in the
Description
.
- The program computes the nonlinear measure of
the input data and provides the results as
% Nonlinear Measure = 10.682033 [dB]
The program also produces an output file
dvs_plot.txt
, which can be used to display
deterministic-versus-stochastic (DVS) plot.
Via gnuplot, this can be simply done by
gnuplot> plot "dvs_plot.txt" w linesp
Examples
Examples of applying the program to dog barks
are shown here.
The program
This part is only important for users who want to modify or
understand the code.
Variables (most important ones):
- dim: Embedding dimension
- xx(t): Data field with size length,
- nnn: Number of nearest neighbors to estimate linear
predictive coefficients
- step: Incremental step to change the nnn. This decides
preciseness of the DVS plot and
computational
time. Please modify as you wish.
- wd(dim): Linear predictive coefficients
Functions (detailed descriptions in function header):
- SNR: Computation of the signal-to-noise ratio
- NearestNeighbor: Finding nearest neighbors
- LPC_Estimate: Computation of linear predictive coefficients
- Variance: Variance of data
- Quick_Sort: Sorting algorithm
Note
The author is not responsible for any problems or difficulties
encountered in implementing or applying this software.
Please report problems to
Isao Tokuda (
i.tokuda@biologie.hu-berlin.de).
This page has been maintained by
I. Tokuda
updated on 9 Dec., 2004