Software Open Access

Software for Analysis of Multifractal Time Series

Published: May 29, 2002. Version: 1.0.0


Please include the standard citation for PhysioNet:

Goldberger AL, Amaral LAN, Glass L, Hausdorff JM, Ivanov PCh, Mark RG, Mietus JE, Moody GB, Peng C-K, Stanley HE. PhysioBank, PhysioToolkit, and PhysioNet: Components of a New Research Resource for Complex Physiologic Signals (2003). Circulation. 101(23):e215-e220.

Software Description

Software for calculating multifractal partitions and moments of a time series is available here. To begin, download these files:

  • multifractal.c
  • mf_moments_lt.awk
  • Makefile
  • testfiles.tar.gz

In order to to use this code correctly, it is recommended you review:

J.F. Muzy, E. Bacry and A. Arneodo. Multifractal formalism for fractal signals: The structure-function approach versus the wavelet-transform modulus-maxima method. Physical Review E 47:875-884, 1993.

We also recommend the PhysioNet tutorial "A Brief Overview of Multifractal Time Series".

 

Requirements

  • A C compiler; gcc is recommended
  • awk (or gawk) pattern scanning and processing language
  • make (optional but recommended)
  • tar (recommended for unpacking the test files)

All of these are standard on Unix, Linux, and Mac OS X systems, and are freely available for Windows as parts of Cygwin).

 

Compiling

If you have a make utility, you can use it to compile and test the software, simply by typing ``make check'' (look in Makefile to see what this command does). Otherwise, compile ibs.c and link it with the C standard math library. For example, if you use the GNU C compiler (recommended), you can do this by:

     gcc -o multifractal -O multifractal.c -lm

 

Usage

For brief instructions about how to run the program, type its name at a command prompt:

    multifractal

which should produce a message similar to:

    multifractal INPUT N QMIN QMAX DW MODE >OUTPUT
       INPUT  name of file containing the input time series
       N      number of points (lines) in INPUT
       QMIN   minimum MF order (moment, q)
       QMAX   maximum MF order
       DW     order of the Gaussian derivative wavelet (0-7)
       MODE   the type of output to be produced, one of:
                 1: partition functions (text)
                 2: maxima lines (text)
                 3: wavelet cascade (PPM image)

    INPUT is a text file containing two columns of numbers; the
    first is ignored, and the second contains the data values.

Note that when the Hurst exponent of the input series is negative (i.e., when its DFA scaling exponent is less than 1), it is necessary to integrate the series before using it as input to this software!

 

Output formats

As noted above, multifractal can produce three different types of output. The output type is selected by passing 1, 2, or 3 as the sizth argument on the command line; the results of these choices are:

  • 1: (text, partition functions) The first column is the scale and the remaining columns give the partition functions for all MF orders in the selected range. All output values are log10-transformed.
  • 2: (text, maxima lines) The first column is the index of the time series (time index), and the second is the scale where the maximum appears at that time. The scales are log10-transformed.
  • 3: (PPM image, wavelet cascade) This file can be viewed using the freely available display application included in ImageMagick, as well as a variety of other image viewers.

The tau(q) and multifractal spectra of the input time series can be obtained from the partition functions (MODE 1) using mf_moments_lt.awk; see below.

 

Example of multifractal analysis

The input to multifractal is a text file containing two columns of numbers (time and data values).

An example multifractal time series, for which the spectrum tau(q) and the MF spectrum D(h) are analytically known, is provided in the file log_normal_sigma0.1, which can be obtained by unpacking testfiles.tar.gz:

    tar xfvz testfiles.tar.gz

To generate this example time series, we used the log-normal wavelet cascade algorithm, with parameters nu = -ln(2)/4 and sigma = 0.1, as described in:

 

A. Arneodo, E. Bacry, and J. F. Muzy. Random cascades on wavelet dyadic trees. J. Math. Phys. 39:4142 (1998).

 

First, we generate the multifractal partition function, using the command:

    multifractal log_normal_sigma0.1 32768 -5 5 3 1 >out.zq

where:

  • log_normal_sigma0.1 is the name of the input file (text, two columns)
  • 32768 is the number of points (lines in the input file)
  • -5 specifies the minimum MF order (moment q)
  • 5 specifies the maximum MF order
  • 3 specifies that the third derivative Gaussian wavelet is to be used; values between 0 (Gaussian) and 7 (seventh derivative) are acceptable
  • 1 indicates that the program should produce the partition function; other legal values are 2 (produce maxima lines) and 3 (produce a PPM image of the wavelet cascade)
  • out.zq is the name of the output file, to which the partition functions are to be written

Note that multifractal performs a computationally intensive process that may require a minute or more to complete, even on a fast PC. Be patient!

After obtaining the partition function (out.zq in our case), we may calculate the tau(q) spectrum and the multifractal spectrum D(h), using the awk program, mf_moments_lt.awk:

    awk -f mf_moments_lt.awk -v a=1 -v b=2.53 out.zq >out.tq

In this command, we have specified the range over which the scaling is calculated (between log10(scale)=1 and log10(scale)=2.53; the -v option indicates that a parameter assigment follows, and the parameters a and b are the upper and lower limits of the scaling range). The program reads out.zq (the output that we have just obtained from multifractal), and it writes the corresponding tau(q) and D(h) curves into out.tq.

 

Further information

If you have questions or comments about this software, please contact the author, Yossi Ashkenazy.


Share
Access

Access Policy:
Anyone can access the files, as long as they conform to the terms of the specified license.

License (for files):
Open Data Commons Attribution License v1.0

Discovery

Topics:
complexity

Corresponding Author
You must be logged in to view the contact information.

Files

Total uncompressed size: 8.8 MB.

Access the files

Folder Navigation: <base>
Name Size Modified
COPYING (download) 17.6 KB 2019-04-12
Changelog (download) 215 B 2019-04-12
Makefile (download) 955 B 2019-04-12
mf_moments_lt.awk (download) 2.2 KB 2019-04-12
multifractal.c (download) 10.6 KB 2019-04-12
testfiles.tar.gz (download) 8.8 MB 2019-04-12