### Cost functions

The extendable family of routines for the generation of annealed surrogate data can accomodate a variety of cost functions, needed to implement different constraints. In this version, the following modules are available.

#### Autocorrelation function

`randomize_``auto``_`cool`_`perm`-D# [-W#] [`general options`] [`cooling options`] [`permutation options`]` file

> `-D` number of lags for autocorrelation
> `-W` type of average: 0=max(c), 1=|c|/lag, 2=(c/lag)**2, 3=max(c)/lag (default 0)

The specified number of shortest lags of the autocorrelation function without periodic continuation is matched with the data. The cost is given by the maximum deviation in any lag, weighted by 1/lag.

This cost function has been implemented in randomize_auto_exp_random.

#### Periodic autocorrelation function

`randomize_``autop``_`cool`_`perm`-D# [-W#] [`general options`] [`cooling options`] [`permutation options`]` file

> `-D` number of lags for autocorrelation
> `-W` type of average: 0=max(c), 1=|c|/lag, 2=(c/lag)**2, 3=max(c)/lag (default 0)

The specified number of shortest lags of the periodically continued autocorrelation function is matched with the data. The cost is given by the maximum deviation in any lag, weighted by 1/lag.

This cost function has been implemented in randomize_autop_exp_random.

#### Autocorrelation of unevenly sampled data

`randomize_``uneven``_`cool`_random` `-d# -D#` `[-W#]` [general options`] [`cooling options`] [`permutation options`]` file

> `-d` time span of one bin
> `-D` total time spanned
> `-W` type of average: 0=max(c), 1=|c|/lag, 2=(c/lag)**2 (default 0)

This cost function has been implemented in randomize_uneven_exp_random.

#### Autocorrelation of spike trains

`randomize_``spikeauto``_`cool`_random -d# -D# [-i -W#] [`general options`] [`cooling options`] [`permutation options`]` file

> `-d` time span of one bin
> `-D` total time spanned
> `-i` expect intervals rather than times
> `-W` type of average: 0=max(c), 1=|c|/lag, 2=(c/lag)**2 (default 0)

For an explanation of the inter-event spectrum see spikespec. S(f) is computed for `#` frequencies between 0 and `-F` (no binning). By default, a sequence of event times is expected. If the flag `-i` is set, the data is taken to be inter-event intervals.

This cost function has been implemented in randomize_spikeauto_exp_random.

#### Spectrum of spike trains

`randomize_``spikespec``_`cool`_event [-F# -## -i -W#] [`general options`] [`cooling options`] [`permutation options`]` file

> `-F` maximal frequency (2*l / total time)
> `-#` number of frequencies (F* total time /2)
> `-i` expect intervals rather than times
> `-W` type of average: 0=max(s) 1=|s|/f 2=(s/f)**2 3=|s| (default 0)

For an explanation of the inter-event autocorrelation function, see spikeauto. By default, a sequence of event times is expected. If the flag `-i` is set, the data is taken to be inter-event intervals.

This cost function has been implemented in randomize_spikespec_exp_event.

#### Plans for future releases

I am working on

- crosscorrelations with a reference signal
- running mean/variance for nonstationary data

Please tell me if you have implemented any other interesting constraints.

constrained randomization * Table of Contents * TISEAN home