Time-varying signals: cross- and auto-correla5on, - - PowerPoint PPT Presentation

time varying signals cross and auto correla5on
SMART_READER_LITE
LIVE PREVIEW

Time-varying signals: cross- and auto-correla5on, - - PowerPoint PPT Presentation

Time-varying signals: cross- and auto-correla5on, correlograms NEU 466M Instructor: Professor Ila R. Fiete Spring 2016 Sta5s5cal measures We


slide-1
SLIDE 1

Time-­‑varying ¡signals: ¡ ¡ cross-­‑ ¡and ¡auto-­‑correla5on, ¡ correlograms ¡

NEU ¡466M ¡ Instructor: ¡Professor ¡Ila ¡R. ¡Fiete ¡ Spring ¡2016 ¡

slide-2
SLIDE 2

Sta5s5cal ¡measures ¡

  • We ¡first ¡considered ¡simple ¡sta5s5cal ¡measures ¡

for ¡single ¡variables ¡(mean, ¡variance). ¡

  • We ¡next ¡considered ¡measures ¡for ¡the ¡

rela5onship ¡between ¡two ¡(sta5onary) ¡random ¡ variables ¡(covariance, ¡Pearson’s ¡correla5on ¡ coefficient; ¡regression). ¡ ¡

  • Extension ¡to ¡K ¡variables: ¡pairwise ¡rela5onships ¡

(covariance ¡matrix). ¡

  • Now, ¡extension ¡to ¡5me-­‑series: ¡rela5onships ¡

between ¡different ¡5me-­‑varying ¡signals. ¡ ¡

slide-3
SLIDE 3

Time-­‑series ¡data ¡

g: ¡a ¡temporally ¡varying ¡signal ¡ ¡ sampled ¡at ¡discrete ¡intervals ¡ h: ¡another ¡5me-­‑varying ¡signal, ¡ ¡ sampled ¡at ¡the ¡same ¡5mes ¡

How ¡many ¡variables? ¡In ¡g ¡alone? ¡ ¡

{· · · gt−1, gt, gt+1 · · · }

{· · · ht−1, ht, ht+1 · · · }

slide-4
SLIDE 4

Time-­‑series ¡data ¡

g: ¡a ¡temporally ¡varying ¡signal ¡ ¡ sampled ¡at ¡discrete ¡intervals ¡

  • Time-­‑series ¡not ¡sta5onary. ¡

¡

  • Could ¡think ¡of ¡response ¡at ¡each ¡5me ¡point ¡as ¡separate ¡

(though ¡typically ¡not ¡independent) ¡variable. ¡

  • If ¡length(g) ¡= ¡T, ¡then ¡T ¡variables ¡in ¡g. ¡ ¡

¡

  • Same ¡5me-­‑point ¡in ¡repe55ons ¡of ¡the ¡series ¡from ¡same ¡

ini5al ¡condi5on: ¡mul5ple ¡samples ¡of ¡that ¡variable. ¡

{· · · gt−1, gt, gt+1 · · · }

slide-5
SLIDE 5

Finding ¡structure ¡between ¡5me-­‑series ¡

g: ¡a ¡temporally ¡varying ¡signal ¡ ¡ sampled ¡at ¡discrete ¡intervals ¡ h: ¡another ¡5me-­‑varying ¡signal, ¡ ¡ sampled ¡at ¡the ¡same ¡5mes ¡

How ¡about ¡trying ¡previously ¡seen ¡sta5s5cal ¡measures? ¡ ¡

{· · · gt−1, gt, gt+1 · · · }

{· · · ht−1, ht, ht+1 · · · }

compute cov(g, h)

slide-6
SLIDE 6

100 200 300 400 500 600 700 800 900 1000 −1 −0.8 −0.6 −0.4 −0.2 0.2 0.4 0.6 0.8 1 time response

Example ¡of ¡two ¡5me-­‑series ¡

C(g, h) = 0, hghi ⇡ 0

Correct ¡but ¡unsa5sfying: ¡ ¡g, ¡h ¡similarly ¡5me-­‑varying ¡func5ons: ¡the ¡same ¡func5on ¡with ¡a ¡π/2 ¡shi[. ¡ ¡

dt = 0.001 t = [0 : dt : 1 − dt]; g = sin(20 ∗ pi ∗ t); h = cos(20 ∗ pi ∗ t); figure; hold on; plot(g); plot(h,0 r0); ylabel(0response0) xlabel(0time0)

slide-7
SLIDE 7

Defini5on: ¡cross-­‑correla5on ¡func5on ¡ Cg,h(n) =

X

m=−∞

g∗(m)h(m + n) [· · · g∗

−3 g∗ −2 g∗ −1 g∗ 0 g∗ 1 g∗ 2 g∗ 3 · · · ]

[· · · h−3 h−2 h−1 h0 h1 h2 h3 · · · ]

take time-by-time product, add all terms

n = 0 :

slide-8
SLIDE 8

Cg,h(n) =

X

m=−∞

g∗(m)h(m + n) [· · · g∗

−3 g∗ −2 g∗ −1 g∗ 0 g∗ 1 g∗ 2 g∗ 3 · · · ]

[· · · h−2 h−1 h0 h1 h2 h3 h4 · · · ] h − tape shifted leftwards by 1

n = 1 :

Defini5on: ¡cross-­‑correla5on ¡func5on ¡

slide-9
SLIDE 9

Measure ¡of ¡relatedness ¡at ¡different ¡5me ¡shi[s ¡

Cg,h(n) =

X

m=−∞

g∗(m)h(m + n)

  • The ¡cross-­‑correla5on ¡func5on ¡is ¡a ¡measure ¡of ¡covariance ¡

between ¡g, ¡h ¡at ¡different ¡rela5ve ¡5me-­‑shi[s ¡(for ¡zero-­‑ mean ¡or ¡mean-­‑subtracted ¡signals). ¡ ¡ ¡ ¡

  • How ¡is ¡g ¡at ¡any ¡5me ¡(linearly) ¡related ¡to ¡h ¡n ¡5me-­‑steps ¡

away? ¡ ¡

slide-10
SLIDE 10

Cross-­‑correla5on ¡func5on ¡for ¡finite-­‑length ¡signals ¡

Cg,h(n) =

N−n

X

m=1

g∗(m)h(m + n) {g1, · · · , gN} {h1, · · · , hN}

g, ¡h: ¡5me-­‑series ¡of ¡length ¡N ¡

Total ¡length ¡of ¡cross-­‑correla5on: ¡2N-­‑1 ¡ Zero-­‑shi[ed ¡entry: ¡N ¡

average ¡over ¡ ¡ (N-­‑|n|) ¡terms ¡

slide-11
SLIDE 11

¡

  • ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡: ¡ ¡does ¡not ¡commute ¡(contrast ¡

with ¡covariance). ¡ ¡

  • In ¡fact, ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡: ¡ ¡shi[ing ¡h ¡to ¡right ¡

rela5ve ¡to ¡g: ¡equivalent ¡to ¡shi[ing ¡g ¡to ¡le5 ¡rela5ve ¡ to ¡h. ¡(Same ¡plot, ¡flipped ¡5me ¡axis.) ¡ ¡

  • Ordering ¡mabers: ¡tells ¡which ¡signal ¡leads ¡the ¡other. ¡ ¡

Proper5es ¡of ¡the ¡cross-­‑correla5on ¡

Cgh(n) = Chg(−n) Cgh(n) 6= Chg(n)

slide-12
SLIDE 12

100 200 300 400 500 600 700 800 900 1000 −1 −0.8 −0.6 −0.4 −0.2 0.2 0.4 0.6 0.8 1 time response

(Previous) ¡example ¡

5me ¡index ¡

slide-13
SLIDE 13

Cross-­‑correla5on ¡of ¡example ¡series ¡

figure; plot(xcorr(h, g),0 k0) xlabel(0time index (n)0) ylabel(0Cgh(n)0)

Signals ¡of ¡length ¡N ¡= ¡1000. ¡Cross-­‑correla5on ¡of ¡length ¡2N-­‑1. ¡ ¡

200 400 600 800 1000 1200 1400 1600 1800 2000 −500 −400 −300 −200 −100 100 200 300 400 500 time index (n) Cgh(n)

5me ¡index ¡

slide-14
SLIDE 14

600 700 800 900 1000 1100 1200 1300 1400 −500 −400 −300 −200 −100 100 200 300 400 500 time index (n) Cgh(n)

Cross-­‑correla5on ¡of ¡example ¡series ¡

  • In ¡Cgh(n): ¡peak ¡at ¡le[. ¡Interpreta5on: ¡h ¡leads ¡g, ¡or ¡h ¡must ¡be ¡shi[ed ¡right ¡

(nega5ve ¡n) ¡to ¡line ¡up ¡with ¡g. ¡In ¡present ¡example, ¡cosine ¡(h) ¡leads ¡sine ¡(g) ¡in ¡

  • phase. ¡ ¡

¡

  • Mul5ple ¡peaks: ¡periodic ¡re-­‑alignment ¡of ¡cos ¡with ¡sin ¡at ¡mul5ples ¡of ¡period ¡
  • Cau5on! ¡Cgh(t) ¡is ¡ ¡xcorr(h,g) ¡in ¡Matlab: ¡note ¡reversed ¡order ¡of ¡g, ¡h! ¡ ¡ ¡

Matlab: ¡signals ¡of ¡length ¡N ¡have ¡0-­‑shi[ ¡at ¡N ¡in ¡xcorr ¡

figure; plot(xcorr(h, g),0 k0) xlabel(0time index (n)0) ylabel(0Cgh(n)0)

slide-15
SLIDE 15

Cross-­‑correla5on ¡of ¡example ¡series ¡

figure; plot(xcorr(h, g),0 k0) xlabel(0time index (n)0) ylabel(0Cgh(n)0)

Decay ¡in ¡amplitude ¡due ¡to ¡finite ¡length ¡of ¡g, ¡h: ¡shi[ ¡n ¡is ¡a ¡sum ¡over ¡N-­‑|n| ¡terms, ¡so ¡ amplitude ¡will ¡go ¡to ¡0 ¡as ¡shi[ ¡goes ¡to ¡N. ¡ ¡

200 400 600 800 1000 1200 1400 1600 1800 2000 −500 −400 −300 −200 −100 100 200 300 400 500 time index (n) Cgh(n)

5me ¡index ¡

slide-16
SLIDE 16

Autocorrela5on ¡func5on ¡

  • Special ¡case ¡of ¡cross-­‑correla5on: ¡signal ¡

correla5on ¡with ¡itself ¡at ¡all ¡5me ¡shi[s. ¡ ¡

  • Commonly ¡used ¡to ¡detect ¡temporal ¡paberns ¡

(periodic ¡or ¡otherwise) ¡within ¡noisy ¡5me-­‑ series ¡data. ¡ ¡

  • Symmetric; ¡central ¡peak ¡always ¡at ¡0 ¡5me-­‑lag. ¡
slide-17
SLIDE 17

Autocorrela5on ¡example ¡

600 700 800 900 1000 1100 1200 1300 1400 −500 −400 −300 −200 −100 100 200 300 400 500 time index (n) Cgg(n)

5me ¡index ¡

slide-18
SLIDE 18

BACK ¡TO ¡A ¡MODELING ¡ PERSPECTIVE ¡

Overview ¡

slide-19
SLIDE 19

Time-­‑series ¡data ¡

g: ¡a ¡temporally ¡varying ¡signal ¡ ¡ sampled ¡at ¡discrete ¡intervals ¡

  • If ¡g ¡is ¡5me-­‑series ¡of ¡length ¡N, ¡then ¡N ¡variables ¡within ¡g. ¡ ¡
  • But ¡then ¡should ¡construct ¡NxN ¡covariance ¡matrix ¡with ¡(α,β) ¡

entry ¡given ¡by ¡cov(gαgβ), ¡and ¡N(N+1)/2 ¡dis5nct ¡entries. ¡ ¡

  • Autocorrela5on: ¡only ¡(2N-­‑1)/2 ¡dis5nct ¡entries ¡(1/2 ¡because ¡
  • f ¡symmetry ¡about ¡0-­‑5me ¡lag). ¡ ¡

{g1, · · · , gN}

slide-20
SLIDE 20

Autocorrela5on ¡and ¡5me-­‑series ¡data ¡

¡ What ¡are ¡we ¡throwing ¡out ¡when ¡studying ¡only ¡the ¡autocorrelaIon ¡

  • f ¡a ¡Ime-­‑series ¡g ¡(N ¡disInct ¡entries), ¡compared ¡to ¡the ¡NxN ¡ ¡

covariance ¡matrix ¡of ¡its ¡components ¡(N(N+1)/2 ¡disInct ¡entries)? ¡ ¡ ¡ ¡

slide-21
SLIDE 21

Autocorrela5on ¡and ¡5me-­‑series ¡data ¡

  • One ¡entry ¡in ¡cross-­‑correla5on ¡measures ¡rela5onship ¡

between ¡terms ¡in ¡g ¡at ¡a ¡fixed ¡5me-­‑lag, ¡summed ¡over ¡ all ¡=mes. ¡

  • Assump5on ¡of ¡=me ¡transla=on-­‑invariance: ¡

rela5onship ¡between ¡terms ¡in ¡g ¡at ¡lag ¡n ¡is ¡similar, ¡ regardless ¡of ¡star5ng ¡5me. ¡ ¡(E.g. ¡whenever ¡a ¡cell ¡ spikes, ¡it ¡will ¡tend ¡not ¡to ¡spike ¡for ¡2 ¡ms: ¡refractory ¡

  • period. ¡Pabern ¡independent ¡of ¡actual ¡spike ¡5me.) ¡
  • Same ¡assump5on ¡in ¡cross-­‑correla5on. ¡ ¡
slide-22
SLIDE 22

Summary ¡

  • Time-­‑series ¡inherently ¡more ¡complex ¡than ¡random ¡draws ¡

from ¡a ¡sta5onary ¡system. ¡

  • Look ¡for: ¡transla5on-­‑invariant ¡temporal ¡paberns ¡within ¡

and ¡across ¡5me-­‑series. ¡

  • Auto-­‑ ¡and ¡cross-­‑correla5on ¡func5ons. ¡
  • Each ¡term ¡an ¡average ¡across ¡the ¡en5re ¡5me-­‑series: ¡

reduced ¡noise. ¡ ¡

slide-23
SLIDE 23

SPIKE ¡TRAINS: ¡CROSS-­‑CORRELATION ¡ AND ¡SIMPLE ¡STATISTICS ¡

Applica5on ¡

slide-24
SLIDE 24

Mo5on ¡detec5on ¡in ¡the ¡blowfly ¡

Image ¡by ¡Muhammad ¡Mahdi ¡Karim, ¡published ¡under ¡ GNU ¡Free ¡Documenta5on ¡License, ¡Version ¡1.2 ¡ ¡ ¡

slide-25
SLIDE 25

H1 ¡neuron: ¡horizontal ¡mo5on ¡sensing ¡

Single ¡H1 ¡neuron ¡ in ¡lobula ¡plate ¡of ¡ ¡ each ¡hemisphere ¡ Lobula ¡plate: ¡ ¡ highest ¡visual ¡ ¡ area, ¡before ¡ ¡ motor ¡output. ¡

slide-26
SLIDE 26

H1 ¡response ¡during ¡horizontal ¡visual ¡mo5on ¡

  • Data: ¡Rob ¡de ¡Ruyter ¡van ¡Steveninck ¡
  • 500 ¡Hz, ¡spikes ¡and ¡whole-­‑field ¡horizontal ¡mo5on ¡s5mulus ¡

100 200 300 400 500 600 700 800 900 1000 −150 −100 −50 50 100 150 sample number (500 Hz) stim, H1 spks

slide-27
SLIDE 27

Spike ¡autocorrela5on ¡

5.999 5.9992 5.9994 5.9996 5.9998 6 6.0002 6.0004 6.0006 6.0008 6.001 x 10

5

0.5 1 1.5 2 2.5 3 3.5 4 4.5 5 x 10

4

sample number C(rho, rho)

slide-28
SLIDE 28

Spike ¡autocorrela5on ¡

5.999 5.9992 5.9994 5.9996 5.9998 6 6.0002 6.0004 6.0006 6.0008 6.001 x 10

5

0.5 1 1.5 2 2.5 3 3.5 4 4.5 5 x 10

4

sample number C(rho, rho)

Large ¡narrow ¡peak ¡at ¡zero. ¡Why? ¡ What ¡does ¡its ¡height ¡mean? ¡

slide-29
SLIDE 29

Spike ¡autocorrela5on ¡

5.999 5.9992 5.9994 5.9996 5.9998 6 6.0002 6.0004 6.0006 6.0008 6.001 x 10

5

0.5 1 1.5 2 2.5 3 3.5 4 4.5 5 x 10

4

sample number C(rho, rho)

Sharp ¡narrow ¡dip. ¡What ¡does ¡this ¡mean? ¡ Where ¡could ¡it ¡come ¡from? ¡ ¡

slide-30
SLIDE 30

Spike ¡autocorrela5on ¡

5.999 5.9992 5.9994 5.9996 5.9998 6 6.0002 6.0004 6.0006 6.0008 6.001 x 10

5

0.5 1 1.5 2 2.5 3 3.5 4 4.5 5 x 10

4

sample number C(rho, rho)

Posi5ve ¡slowly ¡decaying ¡transient. ¡ What ¡does ¡this ¡mean? ¡Where ¡could ¡ it ¡come ¡from? ¡ ¡

slide-31
SLIDE 31

S5mulus ¡autocorrela5on ¡

5.999 5.9992 5.9994 5.9996 5.9998 6 6.0002 6.0004 6.0006 6.0008 6.001 x 10

5

5 10 15 x 10

8

sample number C(stim, stim)

slide-32
SLIDE 32

S5mulus ¡autocorrela5on ¡

5.999 5.9992 5.9994 5.9996 5.9998 6 6.0002 6.0004 6.0006 6.0008 6.001 x 10

5

5 10 15 x 10

8

sample number C(stim, stim)

Medium-­‑width ¡peak ¡at ¡zero. ¡ ¡ What ¡does ¡its ¡height ¡mean? ¡

slide-33
SLIDE 33

S5mulus, ¡spike ¡autocorrela5ons ¡

5.999 5.9992 5.9994 5.9996 5.9998 6 6.0002 6.0004 6.0006 6.0008 6.001 x 10

5

−0.2 0.2 0.4 0.6 0.8 1 1.2 sample number C(rho, rho), C(stim, stim)

Can ¡s5mulus ¡correla5ons ¡explain ¡spike ¡correla5ons? ¡

slide-34
SLIDE 34

S5mulus, ¡spike ¡cross-­‑correla5on ¡

5.997 5.998 5.999 6 6.001 6.002 6.003 x 10

5

−2 2 4 6 8 10 12 14 16 x 10

5

sample number (500 Hz) C(stim, rho)

When ¡s5mulus ¡goes ¡up ¡(more ¡ posi5ve ¡velocity), ¡response ¡ increases: ¡posi5ve ¡peak. ¡ Response ¡lags ¡s5mulus ¡(peak ¡to ¡right ¡of ¡zero-­‑shi[). ¡ ¡ ¡

slide-35
SLIDE 35

S5mulus, ¡spike ¡cross-­‑correla5on ¡

5.997 5.998 5.999 6 6.001 6.002 6.003 x 10

5

−2 2 4 6 8 10 12 14 16 x 10

5

sample number (500 Hz) C(stim, rho)

What ¡does ¡s5mulus, ¡response ¡cross-­‑correla5on ¡really ¡mean, ¡ ¡ from ¡modeling ¡perspec5ve? ¡

slide-36
SLIDE 36

WHAT ¡DOES ¡IT ¡MEAN ¡TO ¡BUILD ¡A ¡ MODEL ¡OF ¡OBSERVATIONS ¡IN ¡THIS ¡ EXPERIMENT? ¡

Back ¡to ¡original ¡goal: ¡Modeling ¡

slide-37
SLIDE 37

Modeling ¡

  • Rela5vely ¡simple/compact ¡descrip5on ¡of ¡data, ¡

good ¡predic5on ¡performance. ¡ ¡

  • Extrac5ng ¡“features” ¡of ¡data ¡as ¡a ¡way ¡to ¡

model ¡it. ¡ ¡

  • To ¡determine ¡predictability, ¡important ¡to ¡

cross-­‑validate ¡models/fits. ¡ ¡

slide-38
SLIDE 38

Modeling ¡spike ¡train ¡data ¡

Model: ¡Simple, ¡predic5ve ¡descrip5on. ¡But ¡of ¡ what? ¡

  • Given ¡s5mulus, ¡ ¡predict ¡spikes? ¡
  • Given ¡spikes, ¡“predict” ¡s5mulus? ¡
slide-39
SLIDE 39

Modeling ¡spike ¡train ¡data ¡

Model: ¡Simple, ¡predic5ve ¡descrip5on. ¡But ¡of ¡ what? ¡

  • Given ¡s5mulus, ¡ ¡predict ¡spikes? ¡
  • Given ¡spikes, ¡“predict” ¡s5mulus? ¡

Encoding ¡model ¡ Decoding ¡model ¡

Yes, ¡both! ¡

slide-40
SLIDE 40

Summary ¡

  • Autocorrela5ons ¡of ¡s5mulus, ¡response ¡tell ¡us ¡about ¡

structure ¡within ¡s5mulus, ¡response. ¡ ¡

  • Comparison ¡of ¡the ¡autocorrela5ons ¡helps ¡understand ¡

differences ¡in ¡the ¡structure ¡and ¡mo5vates ¡us ¡to ¡search ¡for ¡ causes ¡for ¡these ¡differences. ¡ ¡

  • Cross-­‑correla5on ¡tells ¡us ¡about ¡some ¡rela5onships ¡

between ¡s5mulus ¡and ¡response: ¡5me-­‑lags, ¡sign ¡of ¡ rela5onship, ¡etc. ¡ ¡ ¡

  • Beber ¡understanding ¡of ¡what ¡s5mulus, ¡response ¡cross-­‑

correla5on ¡is ¡telling ¡us? ¡ ¡ ¡