Chronux Tutorial: Part I

Slides:



Advertisements
Similar presentations
Introduction Relative weights can be estimated by fitting a linear model using responses from individual trials: where g is the linking function. Relative.
Advertisements

CSC 4510 – Machine Learning Dr. Mary-Angela Papalaskari Department of Computing Sciences Villanova University Course website:
FilteringComputational Geophysics and Data Analysis 1 Filtering Geophysical Data: Be careful!  Filtering: basic concepts  Seismogram examples, high-low-bandpass.
The General Linear Model Or, What the Hell’s Going on During Estimation?
Model Adequacy Checking in the ANOVA Text reference, Section 3-4, pg
Multiple Regression. Outline Purpose and logic : page 3 Purpose and logic : page 3 Parameters estimation : page 9 Parameters estimation : page 9 R-square.
Environmental Data Analysis with MatLab Lecture 16: Orthogonal Functions.
Chronux Tutorial: Part II LOCFIT
LFPs 1: Spectral analysis Kenneth D. Harris 11/2/15.
Environmental Data Analysis with MatLab Lecture 23: Hypothesis Testing continued; F-Tests.
Spectral analysis II: Applications Bijan Pesaran Center for Neural Science New York University.
Spectral analysis for point processes. Error bars. Bijan Pesaran Center for Neural Science New York University.
Analysis Protocols Electrophysiology. Data Analysis Data Analysis Tasks Analysis Methods (Algorithms) Experimental Information Measurement Physics Data.
Local Field Potentials, Spikes and Modeling Strategies for Both Robert Haslinger Dept. of Brain and Cog. Sciences: MIT Martinos Center for Biomedical Imaging:
Point process and hybrid spectral analysis.
Environmental Data Analysis with MatLab Lecture 11: Lessons Learned from the Fourier Transform.
Environmental Data Analysis with MatLab Lecture 12: Power Spectral Density.
Nov 4, Detection, Classification and Tracking of Targets in Distributed Sensor Networks Presented by: Prabal Dutta Dan Li, Kerry Wong,
Environmental Data Analysis with MatLab Lecture 17: Covariance and Autocorrelation.
Spectral analysis Kenneth D. Harris 18/2/15. Continuous processes A continuous process defines a probability distribution over the space of possible signals.
The Empirical FT continued. What is the large sample distribution of the EFT?
Linear Regression Basics II Fin250f: Lecture 7.1 Spring 2010 Brooks, chapter ,3.7, 3.8.
Environmental Data Analysis with MatLab Lecture 5: Linear Models.
Statistical analysis and modeling of neural data Lecture 17 Bijan Pesaran 12 November, 2007.
Environmental Data Analysis with MatLab Lecture 3: Probability and Measurement Error.
Lecture 19: Tues., Nov. 11th R-squared (8.6.1) Review
Environmental Data Analysis with MatLab Lecture 24: Confidence Limits of Spectra; Bootstraps.
Lecture 24: Thurs. Dec. 4 Extra sum of squares F-tests (10.3) R-squared statistic (10.4.1) Residual plots (11.2) Influential observations (11.3,
Chapter 11 Multiple Regression.
Laurent Itti: CS599 – Computational Architectures in Biological Vision, USC Lecture 7: Coding and Representation 1 Computational Architectures in.
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL FADTTS: Functional Analysis of Diffusion Tensor Tract Statistics Hongtu Zhu, Ph.D. Department of Biostatistics.
Multiple Linear Regression Response Variable: Y Explanatory Variables: X 1,...,X k Model (Extension of Simple Regression): E(Y) =  +  1 X 1 +  +  k.
RCT tutorial 1 RC tutorial David Verstraeten. RCT tutorial 2 Reservoir Computing Random and fixed Trained.
Environmental Data Analysis with MatLab Lecture 20: Coherence; Tapering and Spectral Analysis.
LFPs Kenneth D. Harris 11/2/15. Local field potentials Slow component of intracranial electrical signal Physical basis for scalp EEG.
Stats for Engineers Lecture 9. Summary From Last Time Confidence Intervals for the mean t-tables Q Student t-distribution.
EEG Classification Using Maximum Noise Fractions and spectral classification Steve Grikschart and Hugo Shi EECS 559 Fall 2005.
Ch4 Describing Relationships Between Variables. Section 4.1: Fitting a Line by Least Squares Often we want to fit a straight line to data. For example.
FMRI Methods Lecture7 – Review: analyses & statistics.
Various topics Petter Mostad Overview Epidemiology Study types / data types Econometrics Time series data More about sampling –Estimation.
MATLAB Harri Saarnisaari, Part of Simulations and Tools for Telecommunication Course.
Chapter 10: Analyzing Experimental Data Inferential statistics are used to determine whether the independent variable had an effect on the dependent variance.
The Campbell Collaborationwww.campbellcollaboration.org C2 Training: May 9 – 10, 2011 Introduction to meta-analysis.
Multiple Regression Petter Mostad Review: Simple linear regression We define a model where are independent (normally distributed) with equal.
Lecture 4: Statistics Review II Date: 9/5/02  Hypothesis tests: power  Estimation: likelihood, moment estimation, least square  Statistical properties.
STA 286 week 131 Inference for the Regression Coefficient Recall, b 0 and b 1 are the estimates of the slope β 1 and intercept β 0 of population regression.
Lecture#10 Spectrum Estimation
Wavelet Spectral Analysis Ken Nowak 7 December 2010.
Marshall University School of Medicine Department of Biochemistry and Microbiology BMS 617 Lecture 11: Models Marshall University Genomics Core Facility.
Tutorial I: Missing Value Analysis
Stochastic Process Theory and Spectral Estimation Bijan Pesaran Center for Neural Science New York University.
CGH Data BIOS Chromosome Re-arrangements.
Stochastic Process Theory and Spectral Estimation
Jump to first page Inferring Sample Findings to the Population and Testing for Differences.
Bayesian inference Lee Harrison York Neuroimaging Centre 23 / 10 / 2009.
Environmental Data Analysis with MatLab 2 nd Edition Lecture 22: Linear Approximations and Non Linear Least Squares.
Statistics and probability Dr. Khaled Ismael Almghari Phone No:
1 C.A.L. Bailer-Jones. Machine Learning. Data exploration and dimensionality reduction Machine learning, pattern recognition and statistical data modelling.
PRISM: PROCESSING AND REVIEW INTERFACE FOR STRONG MOTION DATA SOFTWARE
The general linear model and Statistical Parametric Mapping
Machine learning, pattern recognition and statistical data modelling
Heather L. Dean, Maureen A. Hagan, Bijan Pesaran  Neuron 
Volume 69, Issue 3, Pages (February 2011)
Migration and the Labour Market
Heather L. Dean, Maureen A. Hagan, Bijan Pesaran  Neuron 
The general linear model and Statistical Parametric Mapping
Gamma and Beta Bursts Underlie Working Memory
Attenuation of high-frequency (30–200 Hz) thalamocortical EEG rhythms as correlate of anaesthetic action: evidence from dexmedetomidine  G. Plourde, F.
Tuning to Natural Stimulus Dynamics in Primary Auditory Cortex
Respiration entrains higher-frequency oscillations in PC, amygdala, and hippocampus. Respiration entrains higher-frequency oscillations in PC, amygdala,
Presentation transcript:

Chronux Tutorial: Part I Hemant Bokil Cold Spring Harbor Laboratory

Dan Hill Chris Fall Samar Mehta Hirak Parikh Andrew Sornborger People Hemant Bokil Catherine Loader Partha Mitra Peter Andrews Contributors Dan Hill Chris Fall Samar Mehta Hirak Parikh Andrew Sornborger

Outline Introduction to Chronux ► Aim ► Website ● Download ● Documentation ► Key functions Analysis of LIP data - Example 2 of the previous talk : rates, spike and LFP spectra and coherences, coherences between cells Analysis protocol F-test for line noise

Chronux: Aim To provide a comprehensive set of tools for the analysis of neurobiological time series data

Current version Spectral analysis Locfit MATLAB® local regression and likelihood based analyses MATLAB® Toolboxes Spike sorting Univariate and multivariate time series data. Continuous data (e.g. LFPs) and point process data (e.g. spikes). Multiple modalities: Image data (examples in Chris Fall’s talk) Extensive online and within-Matlab help GUI under active development, release in a few months

Website (www.chronux.org) Slide will highlight two things in the website – the place to download chronux and the m2html documentation. The next few slides show screenshots of the documentation.

Documentation Chronux documentation is built using m2html and graphviz. On going to the documentation page, you will first see a list of folders. The important ones from the standpoint of the user are (i) continuous (circle continuous), (ii) point binned (circle pointbinned), (iii) pointtimes (circle pointtimes) (iv) hybrid, (v) locfit and (vi) spikesort. The routines in ‘continuous’ are applicable to continuous process data (such as LFP), those in ‘pointtimes’ directory are applicable to spike times, and those in the ‘pointbinned’ are applicable to binned spike counts. The ‘hybrid’ directory contains routines that involve one continuous and one point process (e.g. the spike-field coherence routine is in this directory). Note that in addition to help for each routine, the website also contains graphs describing the interdependence of the different routines and thus serves as an aid to understanding.

Key routines for continuous processes Denoising Slow variations (e.g. movements of a patient for EEG data) 50/60 Hz line noise locdetrend.m: Loess method rmlinesc.m rmlinesmovingwinc.m Removing slow variations and removing line noise are two very common tasks of any analysis of neural recordings. Chronux implements the Loess method for detrending where the data is fit with a local line using overlapping windows. Unlike bandpass filtering, the Loess method does not suffer from problems at the edges. For the 50/60 Hz line noise, Chronux implements the Harmonic F-test due to David Thomson. We will discuss this at the end of the tutorial.

Spectra, Coherences etc Fourier transforms using multiple tapers: mtfftc.m Spectrum: mtspectrumc.m Coherency:mtcoherencyc.m Spectrogram: mtspecgramc.m Coherogram:mtcohgramc.m Local regression and likelihood The basic routines are listed here for continuous processes. Corresponding routines for spike times have names ending in pt, and corresponding routines for binned spike counts have names ending in pb. Note that almost all Chronux routines come with error bars. Regression and likelihood: locfit.m Plotting the fit: lfplot.m Plotting local confidence bands: lfband.m Plotting global confidence bands: scb.m

Chronux data format Continuous/binned point process data matrices with dimension time x channels/trials e.g. 1000 x 10 dimensional matrix interpreted as 1000 samples 10 channels/trials Spikes times struct array with dimension = number of channels/trials e.g. data(1).times=[0.3 0.35 0.42 0.6] data(2).times=[0.2 0.22 0.35] 2 spike trains with 4 and 3 spikes Chronux’s standard data format is listed here. We will also expand the Chronux internal format shortly to include cell arrays. We will incorporate other ways of storing data by including filters to convert data from other formats to the Chronux format – filters to convert from the plexon format to the Chronux format will be released soon.

Important parameter in mulitple Chronux functions params: structure with multiple fields Fs: sampling frequency (slightly different interpretation for spike times tapers: controls the number of tapers pad: controls the padding fpass: frequency range of interest err: controls error computation trialave: controls whether or not to average over trials

Example II: Spike rates, spectra and coherence (from the previous lecture) Simultaneous two-cell recording from Macaque area LIP – dataset DynNeuroLIP.mat Reach and Saccade Cue Delay Cue Delay Reach and Saccade Task Slide from the morning’s lectures. Pesaran et al (Unpublished)

Example II 3 local field potentials (LFP) and 2 single units, LFP sampled at 1 kHz Trial: 3 seconds of data for 9 trials to one of the directions: 1 s (Baseline), 2 s (Delay + post movement) Baseline: 1 second of data for 74 trials (pooled across all directions) Description of data

Tasks Compute the following for the Memory trials Spike rates LFP and spike spectra Spike-field coherence Spike-Spike coherence Compare spike-spike coherence during the memory period and the baseline period.

The main script for this tutorial lip_master_script.m Calls other scripts to run through the various analyses Type lip_master_script at the Matlab command prompt and press return

The main script for this tutorial lip_master_script.m Calls other scripts to run through the various analyses Type lip_master_script at the Matlab command prompt and press return

Basic locfit usage (rate estimate) Spike rate: 1 trial Basic locfit usage (rate estimate) >> fit=locfit(data,'family','rate'); >> lfplot(fit); >> lfband(fit); Density estimate: replace 'rate‘ by ‘dens’ Regression >> fit=locfit(x,y);

Setting the bandwidth –fixed (h), nearest neighbor (nn) h: fixed/absolute bandwidth e.g. h=1 is interpreted as 1 s if data is in seconds nn: fixed fraction of the total number of points e.g. nn=0.3 takes the 30% closest points to a given point Default: nn=0.7, h=0 >> fit=locfit(data,'family','rate‘,’nn’,0.3); >> lfplot(fit); >> lfband(fit);

Multiple trials pool the spikes and compute fit rescale fits and confidence intervals Pause at this place

LFP spectrum : mtspectrumc.m >>[S,f]=mtspectrumc(data); >> plot(f,10*log10(S)) S: spectrum f: frequency

Sampling frequency Set params.Fs plot_vector: Allows plotting Default = 1 >>params.Fs=1000; >>[S,f]=mtspectrumc(data,params); >> plot_vector(S,f); plot_vector: Allows plotting errors and choice of color and scale (default: log scale for S) >> plot_vector(S,f,’n’); %Uses linear scale for S

Restricting frequencies of interest Set params.fpass Default = [0 params.Fs/2] >>params.Fs=1000; >>params.fpass=[0 100]; >>[S,f]=mtspectrumc(data,params); >> plot_vector(S,f)

Changing the padding Set params.pad Allowed values: -1 0 1 2 ... Default=0 Allowed values: -1 0 1 2 ... For N=500, NFFT: 500 512 1024 2048 … Default: 0 >> params.pad=2; >>[S,f]=mtspectrumc(data,params); >> plot_vector(S,f)

Smoothing (changing the bandwidth) Set params.tapers : of the form [TW K] Default = [3 5] TW: time-bandwidth product K<2TW: well concentrated Slepian sequences Note the ‘r’ argument of plot_vector. That sets the color for the plot, in this case, red. >>params.tapers=[5 9]; >>[S,f]=mtspectrumc(data,params); >> plot_vector(S,f,[],[],’r’)

Averaging over trials Set params.trialave=1 >>[S,f]=mtspectrumc(data,params); >> plot_vector(S,f) Note: computing the spectrum separately for each trial and averaging will work for the spectrum, but not for the Jackknife error bars

params.err=[2 p]: Jackknife Set params.err Errors params.err = [1 p]: params.err=[2 p]: Jackknife Set params.err Serr: (1-p)% confidence interval of S >>p=0.05; >>params.err=[1 p]; >>[S,f,Serr]=mtspectrumc(data,params); >>plot_vector(S,f,[],Serr); >> hold on >>p=0.05; >>params.err=[2 p]; >>[S,f,Serr]=mtspectrumc(data,params); >>plot(f,10*log10(Serr(1,:)),’r’); >>plot(f,10*log10(Serr(2,:)),’r’);

Spike spectrum mtspectrumpt.m >>params.err=[1 p]; >>[S,f,R,Serr]=mtspectrumpt(data,params);

Spectrogram: mtspecgramc Set duration and step size of moving window:movingwin >> movingwin=[0.5 0.05]; >> [S,t,f]=mtspecgramc(data,movingwin,params);

Spike spectrogram mtspecgrampt.m >>[S,t,f,R]=mtspecgrampt(data,movingwin,params);

Coherence between LFP and spikes coherencycpt.m >>params.err=[1 p]; >>[C,phi,S12,S1,S2,f,zerosp,confC,phistd]=coherencycpt(datalfp, datasp,params); C: coherence Phi: phase confC: Probability(C>confC)=p phistd: asymptotic standard deviation of phase

Coherence between cells coherencypt.m >> params.err=[2 p]; >> [C,phi,S12,S1,S2,f,zerosp,confC,phistd,Cerr]=coherencypt(datasp1,… datasp2,params); Phistd: Jackknifed standard deviation of the phase Cerr: (1-p)% confidence intervals for C

Comparison of coherences and spectra Two experimental conditions with unequal number of trials Coherence and spectral estimates are biased and the bias depends on sample size Would like a simple hypothesis test with a corresponding p value Bokil et al., J Neurosci Methods. 2006 Aug 28

Comparison of coherences and spectra If z=tanh-1 (C) E(z)=tanh-1(Cpop)+1/(2m-2) V(z)=’(m) For two coherence estimates C1,C2 define test statistic Null hypothesis: C1,pop=C2,pop  z~N(0,1) Bokil et al., J Neurosci Methods. 2006 Aug 28

Chronux code for comparing coherences [dz,vdz,Adz]=two_group_test_coherence(J1c1,J2c1,J1c2,J2c2,p,'y',f); Fourier transforms Bokil et al, 2006

Electrophysiology Analysis Protocol

Electrophysiolgy: Data Conditioning

Removing 50/60 Hz N samples: X1, X2, …, XN Model: X(t)=a cos(2f0t+)+(t) Potential Method: Least squares (t) is non-white in general non-linear in f0 and 

Thomson’s F test Idea: Equation can be transformed to a linear regression in frequency Notice

Thomson’s F test Data Slepian Noise At f=f0 where k=1,2,…, 2TW-1 Multiply both sides by kth Slepian sequence ukn and Fourier transform where k=1,2,…, 2TW-1 Data Slepian Noise At f=f0

Thomson’s F-test Normal variables Used in touch-tone phones to detect the key