Analysis Code

– Analysis Code –

Many analyses in our lab embark on new territory with novel implementations of analysis routines and statistical testing. This site will organize some of these analyses in a ‘How-To’ or tutorial like style that provides (1) Background to an analysis approach, (2) specific matlab code showing the main steps to arrive at an analysis result, and (3) providing some outlook and links to outstanding questions related to the analysis.

The tutorials on this page extend and complement the tutorials of the basic analysis of spiketrain synchornization (using the pairwise phase consistency), the time frequency analysis of LFP and spike activity, and the functional connectivity analysis that are all described and explained in detail in tutorials at the fieldtrip toolbox website. Please see the matlab analysis links for these (openly available) toolbox tutorials.

  • Adaptive Spike RemovalSpikes introduce artificial phase lag to the LFP when they are recorded from the same channel. The scripts implement the adaptive spike removal method (ASR) that succeeds removing spike current leakage to the LFP across a broad range of frequencies. The details are described in: Banaie Boroujeni K, Tiesinga P, Womelsdorf T (2019) Adaptive spike-artifact removal from local field potentials uncovers prominent beta and gamma band neuronal synchronization. Journal of Neuroscience Methods. (


  • State-space analysis of neural population dynamics: A Step-by-step How-To describing how to classify different experimental conditions from the dynamic changes in population firing of neurons using time-resolved principal component analysis (‘State-Space Analysis)’.

  • Cross-Frequency Coupling Analysis Methods: A step-by-step How-To for applying Tort’s Modulation Index and Eric Maris’ weighted phase locking factor method to identify correlations of phases and amplitudes between LFPs recorded from pairs of electrodes.

  • Classification of Cell Types using data-driven k-means clustering: This How-to shows how to find out how many reliably distinct clusters of cells can be identified based on a multidimensional matrix of parameters about the cells, including their firing rate, firing variability, bursting propensity, action potential waveform shape, etc.
  • Decoding Neuronal Information about internal states (attention conditions) from neuronal firing rates. This How-to describes the sequence of analysis required to classify activations across multiple recorded neuronal activities according to internal states or task conditions.

This site will only infrequently be updated and not all links will be publicly open (you may contact us if you would like to get access to a locked tutorial).