PhaseSlopeIndex.jl
This is a Julia implementation of the Phase Slope Index method. Please refer to http://doc.ml.tu-berlin.de/causality/ for more information.
Outline
Functions
The only exported function is data2psi
:
PhaseSlopeIndex.data2psi
— Functiondata2psi(data, seglen ; segshift, eplen, freqlist, method,
nboot, segave, subave, detrend)
calculates phase slope index (PSI)
Arguments
data::AbstractArray
: NxM array for N data points in M channelsseglen::Integer
: segment length (determines the frequency resolution). If definingfreqlist
,seglen
must be the same as sampling frequency.
optional arguments
segshift::Integer
: number of bins by which neighboring segments are shifted (default isseglen / 2
)eplen::Integer
: length of epochs (default is number of samples)freqlist::AbstractArray
: a UnitRange or 2D-Array where each column is a frequency band (default is full range). Note that the DC component (0th frequency of FFT) is discarded and the values in thefreqlist
shall be Integer Hz values.method::String
: standard deviation estimation method (default is"jackknife"
)subave::Bool
: iftrue
, subtract average across Cross Spectra segments (default isfalse
)segave::Bool
: iftrue
, average across Cross Spectra segments (default istrue
)nboot::Integer
: number of bootstrap resampling iterations (default is100
)detrend::Bool
: iftrue
, performs a 0th-order detrend across raw segments (default isfalse
)window::Function
: window function with interval length as sole necessary argument (default isHanning
)verbose::Bool
: iftrue
, warnings and info logs would be echoed. (default isfalse
)
Returns
psi::AbstractArray
: Phase Slope Index with shape(channel, channel, frequency bands)
psi_std::AbstractArray
: PSI estimated standard deviation with shape(channel, channel, frequency bands)
Citation
Please cite the following paper if you use this code in published work:
Nolte, G., Ziehe, A., Nikulin, V., Schlögl, A., Krämer, N., Brismar, T., & Müller, K.R. (2008), Robustly Estimating the Flow Direction of Information in Complex Physical Systems, Phys. Rev. Lett., 100, 234101.
Acknowledgement
This work was funded by the German Federal Ministry of Education and Research (BMBF) in the project ALICE III under grant ref. 01IS18049B.