Skip to main content
  • Poster presentation
  • Open access
  • Published:

Using dynamic time warping for quantifying effects of sinusoidal oscillation deviations during EEG time series prediction and for finding interesting EEG and fMRI changes

Dynamic time warping (DTW) has successfully been used in feature extraction and analysis of brain data [1, 2]. However, DTW and other dynamic programming (DP) methods are not nearly as widespread in neuroscientific contexts, as they are in bioinformatics, where they are central [3]. DP algorithms are extremely powerful and efficient [4], so we explored further uses of DTW in the analysis of brain data. The first part a) applies DTW to successfully find locally interesting signal changes in EEG and functional magnetic resonance imaging (fMRI) data. In the second part b) we focused on harmonic analysis. Harmonic analysis as conducted via Fourier Transform (FT) or Wavelet Transform (WT) is extremely widespread in analyzing brain data, especially electroencephalography (EEG) data. The fundamental assumption of these methods is that a complex function (the time series waveform) can be represented as a superposition of sinusoidal oscillations. While comparing spectra is useful, it is incorrect to assume that the entirety of the spectral density is due to oscillatory activity proper (especially sinusoidal) [5]. We wanted to get some idea of the amount and effects of non-sinusoidal oscillations in EEG data.

In a) we quantify the amount of local signal dissimilarity, which is often equivalent to where there is interesting sudden activity, and in b) we quantify how much non-sinusoidal activity there is in spectra computed in a standard way. For a) we apply the method on a data set from a simultaneous EEG/fMRI session with 18 subjects that has been used in other published works before [6] and show that we can easily detect movement, changes in brain state accompanying large reaction time changes during a choice reaction time task, and other interesting events in the EEG and fMRI data sets. The method is applicable to both modalities, as DTW is very general and can be used with any type of time series. The method we used works by either running DTW on a selected time interval (or volume) against sequential intervals (or volumes), or by running it as a sliding-window for detecting sudden local signal changes in the EEG or fMRI. For b) we show that the spectral power, as it's typically computed, includes non-sinusoidal activity, when compared to the signal compared against a series of equal-length (to the signal) sinusoidal waves of varying frequencies. We also found when the sinusoidal-oscillation deviations occurred during an EEG time series extrapolation which we performed using a deep learning Toolbox. The EEG time series prediction gave another point of view for the oscillation changes. We find that the prediction breakdown points are related to sudden oscillation changes, which are presumably time points when other neural oscillator generators become active and mixed in the signal. We interpret both prediction breakdowns and momentary oscillatory deviations as being possible reflections of sudden phase changes in the local or global brain state related, which may be related to EEG microstate changes. We hope to bring to attention the flexibility and power of DP to the neuroscientific community.


  1. Karamzadeh N, Medvedev A, Azari A, Gandjbakhche A, Najafizadeh L: Capturing Dynamic Patterns of Task-Based Functional Connectivity with EEG. Neuroimage. 2013, 311-317. February 1

    Google Scholar 

  2. Zheng Y, Liu Q, Chen E, Ge Y, Zhao JL: Time Series Classification Using Multi-Channels Deep Convolutional Neural Networks. WAIM 2014, LCNS. 2014, 8485: 298-310.

    Google Scholar 

  3. Giegerich R: A systematic approach to dynamic programming in bioinformatics. Bioinformatics. 2000, 16 (8): 665-677.

    Article  PubMed  CAS  Google Scholar 

  4. Bertsekas DP: Dynamic Programming and Optimal Control. Athena Scientific. 2007, ISBN: 1-886529-26-4, 4th

    Google Scholar 

  5. Miller KJ, Sorensen LB, Ojemann JG, Nijs Md: Power-Law Scaling in the Brain Surface Electric Potential. PLoS Comput Biol. 5 (12): e1000609-doi:10.1371/journal.pcbi.1000609

  6. Hellyer PJ, Shanahan M, Scott G, Wise RJS, Sharp DJ, Leech R: The Control of Global Brain Dynamics: Opposing Actions of Frontoparietal Control and Default Mode Networks on Attention. The Journal of Neuroscience. 2014, 34 (2): 451-461. 8 January doi: 10.1523/JNEUROSCI.1853-13.2014

    Article  PubMed  CAS  PubMed Central  Google Scholar 

Download references


We thank Dr. Robert Leech for useful discussions and comments.

Author information

Authors and Affiliations


Corresponding author

Correspondence to Dinov Martin.

Rights and permissions

This article is published under license to BioMed Central Ltd. This is an Open Access article distributed under the terms of the Creative Commons Attribution License (, which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited. The Creative Commons Public Domain Dedication waiver ( applies to the data made available in this article, unless otherwise stated.

Reprints and permissions

About this article

Check for updates. Verify currency and authenticity via CrossMark

Cite this article

Martin, D. Using dynamic time warping for quantifying effects of sinusoidal oscillation deviations during EEG time series prediction and for finding interesting EEG and fMRI changes. BMC Neurosci 16 (Suppl 1), P63 (2015).

Download citation

  • Published:

  • DOI: