Stochastic Process Theory and Spectral Estimation Bijan Pesaran Center for Neural Science New York...

49
Stochastic Process Theory and Spectral Estimation Bijan Pesaran Center for Neural Science New York University

description

Overview  Stochastic process theory  Spectral estimation

Transcript of Stochastic Process Theory and Spectral Estimation Bijan Pesaran Center for Neural Science New York...

Page 1: Stochastic Process Theory and Spectral Estimation Bijan Pesaran Center for Neural Science New York University.

Stochastic Process Theory and Spectral EstimationBijan PesaranCenter for Neural ScienceNew York University

Page 2: Stochastic Process Theory and Spectral Estimation Bijan Pesaran Center for Neural Science New York University.

Data is modeled as a stochastic process

0.6 1.1

0.4

0.2

0

Am

plitu

de (m

V)

Time (s)

Spikes

LFP Similar considerations for EEG, MEG, ECoG, intracellular

membrane potentials, intrinsic and extrinsic optical images, 2-photon line scans and so on

Page 3: Stochastic Process Theory and Spectral Estimation Bijan Pesaran Center for Neural Science New York University.

Overview Stochastic process theory

Spectral estimation

Page 4: Stochastic Process Theory and Spectral Estimation Bijan Pesaran Center for Neural Science New York University.

Stochastic process theory Defining stochastic processes Time translation invariance; Ergodicity Moments (Correlation functions) and spectra Example Gaussian processes

Page 5: Stochastic Process Theory and Spectral Estimation Bijan Pesaran Center for Neural Science New York University.

Stochastic processes Each time series is a realization of a stochastic

process Given a sequence of observations, at times, a

stochastic process is characterized by the probability distribution

Akin to rolling a die for each time series Probability distribution for time series

Alternative is deterministic process No stochastic variability

1 2, , , Tp x x x

Page 6: Stochastic Process Theory and Spectral Estimation Bijan Pesaran Center for Neural Science New York University.

Defining stochastic processes High dimensional random variables

Rolling one die picks a point in high dimensional space. Function in ND space.

Indexed families of random variables Roll many dice

1 2, , , Tp x x x p x

tx

Page 7: Stochastic Process Theory and Spectral Estimation Bijan Pesaran Center for Neural Science New York University.

Challenge of data analysis We can never know the full probability

distribution of the data Curse of dimensionality

Page 8: Stochastic Process Theory and Spectral Estimation Bijan Pesaran Center for Neural Science New York University.

Parametric methods Parametric methods infer the PDF by

considering a parameterized subspace

Employ relatively strong models of underlying process

Page 9: Stochastic Process Theory and Spectral Estimation Bijan Pesaran Center for Neural Science New York University.

Non-parametric methods Non-parametric methods use the observed

data to infer statistical properties of the PDF

Employ relatively weak models of the underlying process

Page 10: Stochastic Process Theory and Spectral Estimation Bijan Pesaran Center for Neural Science New York University.

Stationarity Stochastic processes don’t exactly repeat

themselves

They have statistical regularities: Stationarity E x t T E x t

E x t T x t T E x t x t

x t T x t

1 2 3 1 2 3E x t T x t T x t T E x t x t x t

Page 11: Stochastic Process Theory and Spectral Estimation Bijan Pesaran Center for Neural Science New York University.

Ergodicity Ensemble averages are equivalent to time

averages

Often assumed in experimental work More stringent than stationarity

is not ergodic unless only one constant Is activity with time-varying constant ergodic?

10

limT

TTx t T E x t

x t c

Page 12: Stochastic Process Theory and Spectral Estimation Bijan Pesaran Center for Neural Science New York University.

Gaussian processes

Ornstein Uhlenbeck process

Weiner process

111 2 2/2

1, , , exp2 det

N i jN ij ijp x x x x C x

C

ij i jC E x t x t

Page 13: Stochastic Process Theory and Spectral Estimation Bijan Pesaran Center for Neural Science New York University.

Fourier Transform

Parseval’s Theorem (Total power is conserved)

2 iftX f e x t dt

2 iftx t e X f df

2 212x t dt X f df

Real functions: *X f X f

Page 14: Stochastic Process Theory and Spectral Estimation Bijan Pesaran Center for Neural Science New York University.

Examples of Fourier Transforms

2

22

1 exp22

t

2 21

2exp

' 'x t h t t dt

X H

2 f

1 2

Time domain Frequency domain

Page 15: Stochastic Process Theory and Spectral Estimation Bijan Pesaran Center for Neural Science New York University.

Time translation invariance Leads directly to spectral analysis

Fourier basis is eigenbasis of

x t x t T T a t Tat aT ate e e e T x t x tT aTe

T

Page 16: Stochastic Process Theory and Spectral Estimation Bijan Pesaran Center for Neural Science New York University.

Implications for second moment If process is stationary, second moment is

time translation invariant

Hence, for

Because

2 ifTX f e X fT * *' 'E X f X f E X f X f T T

2 ' * *' 'i f f Te E X f X f E X f X f

* ' 0E X f X f

'f f

Page 17: Stochastic Process Theory and Spectral Estimation Bijan Pesaran Center for Neural Science New York University.

Stationarity Stationarity means neighboring frequencies

are uncorrelated

Not true for neighboring times

Also due to stationarity,

*E X f X f S f f f

exp 2C if S f df

' 0E x t x t (In general)

Page 18: Stochastic Process Theory and Spectral Estimation Bijan Pesaran Center for Neural Science New York University.

Ornstein Uhlenbeck Process Exponentially decaying correlation function

Obtained by passing passing white noise through a ‘leaky’ integrator

Spectrum is Lorentzian

'2, ' t tC t t e

d x t x t tdt

2' 'E t t t t

2

21 2S f

f

Page 19: Stochastic Process Theory and Spectral Estimation Bijan Pesaran Center for Neural Science New York University.

Ornstein Uhlenbeck process

2

21 2S f

f

2~S f

2

22S f

f

( 1)f

( 1)f

Page 20: Stochastic Process Theory and Spectral Estimation Bijan Pesaran Center for Neural Science New York University.

Markovian process “Future depends on the past given the

present”

Simplifies joint probability density

1 2 1 1, ,...,n n n n np x t x t t t p x t x t

nx t 1nx t 2nx t 3nx t

nx t 1nx t 2nx t 3nx t

1 1 1 2,n n n n n np x t x t p x t x t p x t x t

nx t 1nx t 2nx t 3nx t

Page 21: Stochastic Process Theory and Spectral Estimation Bijan Pesaran Center for Neural Science New York University.

Wiener process

Page 22: Stochastic Process Theory and Spectral Estimation Bijan Pesaran Center for Neural Science New York University.

Cross-spectrum and coherence

*XYS f f f E X f Y f

exp 2XYS f if E x t y t d

XY

XY

X Y

S fC f

S f S f

Page 23: Stochastic Process Theory and Spectral Estimation Bijan Pesaran Center for Neural Science New York University.

Coherence Coherence measures the linear association

between two time series.

Cross-spectrum is the Fourier transform of the cross-correlation function

y t ax t t

2 ifY f aX f e f

Page 24: Stochastic Process Theory and Spectral Estimation Bijan Pesaran Center for Neural Science New York University.

Coherence

Frequency-dependent time delay

2

2

if

XY

X

aeC fa S f S f

dfdf

Page 25: Stochastic Process Theory and Spectral Estimation Bijan Pesaran Center for Neural Science New York University.

Advantages of coherence functions Neighboring bins are uncorrelated

Error bars relatively easy to calculate Stable statistical estimators Separate signals together that have different

frequencies Normalized quantities

Allow averaging and comparisons

Page 26: Stochastic Process Theory and Spectral Estimation Bijan Pesaran Center for Neural Science New York University.

Spectral estimation for continuous processes

Page 27: Stochastic Process Theory and Spectral Estimation Bijan Pesaran Center for Neural Science New York University.

Spectral estimation for continuous processes Spectral estimation: Periodogram

Bias Variance

Nonparametric quadratic estimators: Tapering Multitaper estimates using Slepians

Spectrum and coherence

Page 28: Stochastic Process Theory and Spectral Estimation Bijan Pesaran Center for Neural Science New York University.

Example LFP spectrum

Periodogram – Single Trial Multitaper estimate- Single Trial, 2NT=10

Page 29: Stochastic Process Theory and Spectral Estimation Bijan Pesaran Center for Neural Science New York University.

Spectral estimation problemThe Fourier transform requires an infinite

sequence of data

In reality, we only have finite sequences of data and so we calculate truncated DFT

2 iftX f e x t

/2

2

/2

Tift

TT

X f e x t

Page 30: Stochastic Process Theory and Spectral Estimation Bijan Pesaran Center for Neural Science New York University.

What happens if we have a finite sequence of data?

/2

2

/2

Tift

T

e x t

'/2 1/22 ' 2 '

1/2/2

Tift if t

T

e df e X f

/2

' '

/2

exp 2T

t T

D f f i f f t

1/2 ' ' '

1/2TX f df D f f X f

Finite sequence means DFT is convolution of and D f X f

Page 31: Stochastic Process Theory and Spectral Estimation Bijan Pesaran Center for Neural Science New York University.

Fourier transform of a rectangular window is the Dirichlet kernel: The Fourier

transform of a rectangular window

Convolution in frequency = product in time

D f

exp 2t

D f ift h t

sin 1sinT

f TD f

f

/2

/2

exp 2 exp 2T

t T t

ift x t ift x t w t

1/2 ' ' '

1/2TX f df X f D f f

Page 32: Stochastic Process Theory and Spectral Estimation Bijan Pesaran Center for Neural Science New York University.

Bias Bias is the difference between the expected

value of an estimator and the true value.

The Dirichlet kernel is not a delta function, therefore the sample estimate is biased and doesn’t equal the true value.

ˆBIAS E X f X f

Page 33: Stochastic Process Theory and Spectral Estimation Bijan Pesaran Center for Neural Science New York University.

Normalized Dirichlet kernel

Narrowband bias: Local bias due to central lobe Broadband bias: Bias from distant frequencies due to sidelobes

2f T

20% height

Page 34: Stochastic Process Theory and Spectral Estimation Bijan Pesaran Center for Neural Science New York University.

Data tapers We can do better than multiplying the data by

a rectangular kernel. Choose a function that tapers the data to zero

towards the edge of the segment Many choices of data taper exist: Hanning

taper, Hamming taper, triangular taper and so on

Page 35: Stochastic Process Theory and Spectral Estimation Bijan Pesaran Center for Neural Science New York University.

Triangular taper

Fejer kernel, for triangular taper, compared with Dirichlet kernel, for rectangular taper.

12 1t

w tT

Reduces sidelobes

Broadens central lobe

Page 36: Stochastic Process Theory and Spectral Estimation Bijan Pesaran Center for Neural Science New York University.

Spectral concentration problem Tapering the data reduces sidelobes but broadens the

central lobes.

Are there “optimal” tapers?

Find strictly time-localized functions, ,

whose Fourier transforms are maximally localized on the frequency interval [-W,W]

w t1, ,t T

Page 37: Stochastic Process Theory and Spectral Estimation Bijan Pesaran Center for Neural Science New York University.

Optimal tapers The DFT, , of a finite series,

Find series that maximizes energy in a [-W,W] frequency band

w t U f

2

1

Tift

t

U f w t e

2

1/2 2

1/2

W

WU f

U f

Page 38: Stochastic Process Theory and Spectral Estimation Bijan Pesaran Center for Neural Science New York University.

Discrete Prolate Spheroidal Sequences Solved by Slepian, Landau and Pollack

Solutions are an orthogonal family of sequences which are solutions to the following eigenvalue functions

1

sin 2T

t

W t tw t w t

t t

Page 39: Stochastic Process Theory and Spectral Estimation Bijan Pesaran Center for Neural Science New York University.

Slepian functions Eigenvectors of eigenvalue equation Orthonormal on [-1/2,1/2] Orthogonal on [-W,W] K=2WT-1 eigenvalues are close to 1, the rest

are close to 0. Correspond to 2WT-1 functions within [-

W,W]

Page 40: Stochastic Process Theory and Spectral Estimation Bijan Pesaran Center for Neural Science New York University.

Power of the kth Slepian function within the bandwidth [-W,W]

Page 41: Stochastic Process Theory and Spectral Estimation Bijan Pesaran Center for Neural Science New York University.
Page 42: Stochastic Process Theory and Spectral Estimation Bijan Pesaran Center for Neural Science New York University.

Comparing Slepian functions

Systematic trade-off between narrowband and broadband bias

Page 43: Stochastic Process Theory and Spectral Estimation Bijan Pesaran Center for Neural Science New York University.

Advantages of Slepian tapers

Using multiple tapers recovers edge of time window

2k

k

w t 2

kk

U f

2WT=6

Page 44: Stochastic Process Theory and Spectral Estimation Bijan Pesaran Center for Neural Science New York University.

Multitaper spectral estimation Each data taper provides uncorrelated

estimate. Average over them to get spectral estimate.

Treat different trials as additional tapers and average over them as well

2

1

1 KMTX k

k

S f X fK

1

exp 2T

k kt

X f w t x t ift

Page 45: Stochastic Process Theory and Spectral Estimation Bijan Pesaran Center for Neural Science New York University.

Cross-spectrum and coherency Cross-spectrum

Coherency

*

1

1 KMTXY k k

k

S f X f Y fK

MTXYMT

XY MT MTX Y

S fC f

S f S f

Page 46: Stochastic Process Theory and Spectral Estimation Bijan Pesaran Center for Neural Science New York University.

Advantages of multiple tapers Increasing number of tapers reduces variance

of spectral estimators.

Explicitly control trade-off between narrowband bias, broadband bias and variance “Better microscope”

Local frequency basis for analyzing signals

21MT MTX XV S f E S f

K

Page 47: Stochastic Process Theory and Spectral Estimation Bijan Pesaran Center for Neural Science New York University.

Time-frequency resolution

Control resolution in the time-frequency plane using parameters of T and W in Slepians

Frequency

Time

T

2W

Page 48: Stochastic Process Theory and Spectral Estimation Bijan Pesaran Center for Neural Science New York University.

Example LFP spectrograms

Time (s)

Freq

uenc

y (H

z)

-0.5 0 0.5 1 1.50

50

100

5

10

15

20

25

Multitaper estimate- T = 0.5s, W = 10Hz

Time (s)

Freq

uenc

y (H

z)

-0.5 0 0.5 1 1.50

50

100

150

5

10

15

20

25

Multitaper estimate- T = 0.2s, W = 25Hz

Page 49: Stochastic Process Theory and Spectral Estimation Bijan Pesaran Center for Neural Science New York University.

Summary Time series present particular challenges for

statistical analysis

Spectral analysis is a valuable form of time series analysis