Potsdam Institute for Climate Impact Research (PIK)
Interdisciplinary Center for Dynamics of Complex Systems (University of Potsdam)
TOCSY - Toolboxes for Complex Systems
PIK/ Antique/ Blue
Home Home | ACE - Nonlinear Regression Analysis ACE | Adaptive Filtering Procedure Adaptive Filtering | NEXCF - Correlation for Time Series with Arbitrary (Non-Equidistant) Time Scales NEXCF | Cross Recurrence Plot Toolbox CRP Toolbox | Commandline Recurrence Plots Commandline RPs | Identification of Coupling Direction Coupling Direction | Dynamical Invariants by Recurrence Plots K2 | DSProlog DSProlog | System Identification Tool System Identification | Wavelet and Coherence Analysis SOWAS  

NEXCF – Cross-Correlation Estimates for Non-Equidistantly Sampled Time Series

(for MATLAB®)


General Notes

NEXCF estimates auto- and cross-correlation functions for time series with arbitrary, non-equidistantly sampled time series using a Gaussian kernel-based technique.


Installation and Usage

To install, simply copy the file nexcf.m into your path. You will find an example by calling help nexcf.

C = NEXCF(TX, X, TY, Y) returns the Gaussian kernel cross-correlation function estimates between the time series X and Y, for which the sampling times are given in the column vectors TX and TY. The lags for which the correlation functions are estimated are given in the vector lag =-T:DT:T, where DT is usually the mean or median sampling interval. If this vector is not provided, it is created such that lag=-T:DT:T with T = range([max(TX(1),TY(1)),min(TX(end),TY(end))])/2 and DT = T/10. If it is not specified, the default kernel width is 0.25*DT.

C = NEXCF(TX, X, TY, Y, LAG, H) computes the correlation using a kernel width H, given in units of DT. H=0.25 amounts to a kernel width of 0.25*DT.

C = NEXCF(TX, X, TY, Y, LAG) returns the cross-correlation function at lags given in the vector LAG.

[C,LAGS] = NEXCF(...) returns the correlation function and the vector of time lags (LAGS).


Example

    We take two time series from stochastic processes X and Y, {tx,x} and {ty,y}, which are defined as follows:
    % Sampling times 
    tx = (1:1001)'; ty = (1:1001)'; 
    
    % Original signals 
    x = randn(1001,1);
    x(2:end) = 0.5*x(1:end-1)+randn(1000,1); 
    y = randn(1001,1);
    y(2:end) = 0.7*x(1:end-1)+randn(1000,1);
    
    We have, however, in reality, observed only 50% of the points in y, yielding a time series {tymiss,ymiss}:
    rem = randi(length(ty), floor(length(ty)*0.5),1); 
    ty_miss = ty; ty_miss(rem) = [];
    y_miss = y; y_miss(rem) = [];
    
    We can now calculate the ACF for the time series {tymiss,ymiss} as follows:
    First we create a lag vector,
    lag = -50:50;
    
    and we define the kernel width we want to employ:
    H = 0.25; 
    
    Now the ACF of {tymiss;ymiss} is given by
    Cy = nexcf(ty_miss, y_miss, ty_miss, y_miss, lag, H); 
    plot(lag,Cy), xlabel('Lag'), ylabel('Auto-correlation C_{y}')
    
    ACF calculated by NEXCF and the CCF, indicating in this example the lag and the magnitude of the coupling, is given by
    Cxy = nexcf(tx, x, ty, y, lag, H);
    plot(lag,Cxy), xlabel('Lag'), ylabel('Cross-correlation C_{xy}')
    CCF calculated by NEXCF
      

References

  1. Rehfeld, K., Marwan, N., Heitzig, J., Kurths, J.: Comparison of correlation analysis techniques for irregularly sampled time series, Nonlin. Proc. Geophys., 18(3), 389-404, 2011.


Download

nexcf.m


Author

Kira Rehfeld





Creative Commons License

© 2004-2012 SOME RIGHTS RESERVED
University of Potsdam, Interdisciplinary Center for Dynamics of Complex Systems, Germany
Potsdam Institute for Climate Impact Research, Transdisciplinary Concepts and Methods, Germany

This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 2.0 Germany License.

Please respect the copyrights! The content is protected by the Creative Commons License. If you use the provided programmes, text or figures, you have to refer to the given publications and this web site (tocsy.pik-potsdam.de) as well.

@MEMBER OF PROJECT HONEY POT
Spam Harvester Protection Network
provided by Unspam