modeling your spiking data with generalized linear models

32
Modeling Your Spiking Data with Generalized Linear Models

Upload: phillip-george

Post on 27-Dec-2015

241 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: Modeling Your Spiking Data with Generalized Linear Models

Modeling Your Spiking Datawith

Generalized Linear Models

Page 2: Modeling Your Spiking Data with Generalized Linear Models

Outline

I. Part One: Specifying modelsa. The generalized linear model formb. Fitting parameters

II. Part Two: Evaluating model qualitya. Parameter Uncertaintyb. Relative: Akaike info. criterion (AIC)c. Absolute: Time rescaling theorem

Page 3: Modeling Your Spiking Data with Generalized Linear Models

stimulus

cognitive state

physical state

behavior “covariate”

spikehistory

What are Spiking Models?

spiking

Page 4: Modeling Your Spiking Data with Generalized Linear Models

Neuron 1Neuron 2Neuron 3

Today’s Case Study:CA1 Hippocampal Place Cells

Page 5: Modeling Your Spiking Data with Generalized Linear Models

Challenges in Modeling Spikes

• Your neurons are in a vast network

• Each neuron has many biophysical parameters

• Biological noise

• Memory distributed across the network

( | ; )p ensemble spiking covariates

Solution: Stochastic Models

Page 6: Modeling Your Spiking Data with Generalized Linear Models

Data Likelihood &Maximum Likelihood (ML) Parameter Fitting

( ) ( | ; )L f ensemble spiking covariates

( )L

ML

Page 7: Modeling Your Spiking Data with Generalized Linear Models

Introducing Generalized Linear Models

SystemEEG, LFPcovariates

( | )p neural activity covariates

Y X Linear Regression(Gaussian Model of Variability)

Systemspikescovariates

Page 8: Modeling Your Spiking Data with Generalized Linear Models

Stochastic Models

Linear Regression

(output | input,history)p

Properties of GLM:

• Convex likelihood surface

• Estimators asymptotically have minimum MSE

Generalized Linear Models

(GLM)

Neural Spiking Models

Page 9: Modeling Your Spiking Data with Generalized Linear Models

Point Process Data Likelihood

Intensity Model:

Observed Spike Data:

Data Likelihood, one neuron:

1

(Spike Train | ) exp( log( ) )T

k k kk

L t N t

( ) ( )k k kN N t t N t

( | )kk k tt H

0

Pr(Spike in ( , ) | )( | ) lim t

tt

t t t Ht H

t

The Conditional Intensity Function:

In Discrete Time:

Page 10: Modeling Your Spiking Data with Generalized Linear Models

The Generalized Linear Model

1

( ) ( | ) exp{ ( ) ( ) ( ) ( )}K

k kk

L f y T y C H y D

To establish a Generalized Linear Model set the natural parameter to be a linear function of the covariates

In this case:

( )C

01

( )J

j jj

C x

The Exponential Family of Distributions

01

log ( | ( )k

J

k t j j kj

t H x t

This model form makes ML parameter estimation easy.

Page 11: Modeling Your Spiking Data with Generalized Linear Models

ML estimation is easier with this GLM:Convex Likelihood

( ) ( | ; )L f ensemble spiking covariates

( )L

ML

Page 12: Modeling Your Spiking Data with Generalized Linear Models

Convex Likelihood

1

( ) exp log( )T

k k kk

L t n t

/

1

log( ) logT

k k k kk

l L x n n t

'log ( )k kx Intensity Model

/

1

exp

T

k k k kk

lx n x x

2

/ / /2

1 1

exp 0

T T

k k k k k kk k

lx x x x x

Page 13: Modeling Your Spiking Data with Generalized Linear Models

Fitting GLM

• In general, no closed form ML estimator

• Use numerical optimization, such as MATLAB’s glmfit

Page 14: Modeling Your Spiking Data with Generalized Linear Models

1. extends the concept of linear regression

2. allows for modeling spikes

3. easy to fit model parameters

Summary: GLM, Part I

Page 15: Modeling Your Spiking Data with Generalized Linear Models

1: Plot raw data 

>> load glm_data.mat>> who

Page 16: Modeling Your Spiking Data with Generalized Linear Models
Page 17: Modeling Your Spiking Data with Generalized Linear Models

Example call to glmfit

b = glmfit([xN yN],spikes_binned,'poisson');

Page 18: Modeling Your Spiking Data with Generalized Linear Models

Visualizing model from glmfit

lambda = exp(b(1) + b(2)*x_new + b(3)*y_new);

Page 19: Modeling Your Spiking Data with Generalized Linear Models

Quadratic model with glmfit

b = glmfit([xN yN xN.^2 yN.^2 xN.*yN],… spikes_binned,'poisson');

Visualizing this model from glmfit

lambda = exp(b(1) + b(2)*x_new …+ b(3)*y_new + b(4)*x_new.^2 …+ b(5)*y_new.^2 …+ b(6)*x_new.*y_new);

Page 20: Modeling Your Spiking Data with Generalized Linear Models

Fitting other covariates with glmfit

b=glmfit([vxN vxN.^2],spikes_binned,'poisson');

Visualizing this model from glmfit

plot(velocities,exp(b(1)+b(2)*velocities… +b(3)*velocities.^2),'r');

Page 21: Modeling Your Spiking Data with Generalized Linear Models

Part II: Model Quality

1. Parameter uncertainty

2. Relative: Akaike Info. Criterion (AIC)

3. Absolute: Time rescaling theorem

Page 22: Modeling Your Spiking Data with Generalized Linear Models

ML Parameter Uncertainty

( ) ( | ; )L f ensemble spiking covariates

ML

( )L

ML

2

2

log ( | )( )

ˆobs

obs

ML

f xI

Page 23: Modeling Your Spiking Data with Generalized Linear Models

ML Parameter Uncertainty

>> load glm_data.mat

>> [b,dev,stats] = glmfit( put inputs here);

stats.se – standard error on parameter estimates

stats.p – significance of parameter estimates

errorbar(1:length(b), b , 2*stats.se );

Page 24: Modeling Your Spiking Data with Generalized Linear Models

Akaike Info. Criterion

• Approximates relative Kullback-Leibler divergence between real distribution and model

• Formula:

( )

( )log

;g Y

g YE

f Y

ˆ2log ( | ) 2MLAIC p data P

Page 25: Modeling Your Spiking Data with Generalized Linear Models

Computing AIC from glmfit

>> [b,dev,stats] = glmfit( put inputs here);

>> AIC = dev+2*length(b)

Page 26: Modeling Your Spiking Data with Generalized Linear Models

5. Time Rescaling Theorem

Let’s return to the probability distribution for a single ISI:

0

| ( ) ( | ( )) exp | ( )t

p t x t t x t u x u du and make a change of variables,

0

|t

z u x u du ( ) | exp

dtp z p t x t z

dz Then the distribution

is exponential with parameter . 1

Page 27: Modeling Your Spiking Data with Generalized Linear Models

Illustration: Time Rescaling

0 50 100 150 200 2500

10

20

30

40

50

Time (ms)

Conditio

nal In

tensity (

Hz)

0 50 100 150 200 2500

0.5

1

1.5

2

2.5

3

3.5

4

Time (ms)

Rescale

d T

ime

t1

z1

z2

z3

t3t2

Res

cale

d T

ime

Inte

nsit

y (H

z)

Page 28: Modeling Your Spiking Data with Generalized Linear Models

Time Rescaling Statistic: KS Plots

Graphical measure of goodness-of-fit, based on time rescaling, comparing an empirical and model cumulative distribution function. If the model is correct, then the rescaled ISIs are independent, identically distributed random variables whose ordered quantiles should produce a 45° line [Ogata, 1988].

Uniform CDF (Model Predicted ISI CDF)

Em

piri

cal R

esca

led

ISI

CD

F

Page 29: Modeling Your Spiking Data with Generalized Linear Models

Construct KS Plot for Linear Model

>> glm_ks

Page 30: Modeling Your Spiking Data with Generalized Linear Models

Construct KS Plot for Quadratic Model

Modify glm_ks.m

lambdaEst = exp( b_quad(1) + b_quad(2)*xN + b_quad(3)*yN + b_quad(4)*xN.^2 + b_quad(5)*yN.^2 + b_quad(6)*xN.*yN );

Page 31: Modeling Your Spiking Data with Generalized Linear Models

Questions to Ask by Modeling Spikes

• What stimulus features drive the spiking?

• How does the spiking vary with a covariate (stimulus, behavioral measure, cognitive state, or spike history,)?

• How well does the spiking represent a covariate ?

• How do neurons or brain regions cooperate in spiking?

• What physical processes determine the spiking?

Page 32: Modeling Your Spiking Data with Generalized Linear Models

Summary: GLM, Part II

1. extends the concept of linear regression

2. allows for modeling spikes

3. easy to fit model parameters

4. Fisher information and parameter uncertainty

5. Relative model quality: AIC

6. Absolute model quality: Time Rescaling