Generalized Linear Models (GLMs) Jonathan Pillow 1 Example 3: - - PowerPoint PPT Presentation

generalized linear models glms
SMART_READER_LITE
LIVE PREVIEW

Generalized Linear Models (GLMs) Jonathan Pillow 1 Example 3: - - PowerPoint PPT Presentation

Statistical modeling and analysis of neural data NEU 560, Spring 2018 Lecture 9 Generalized Linear Models (GLMs) Jonathan Pillow 1 Example 3: unknown neuron 100 75 (spike count) 50 25 0 -25 0 25 (contrast) Be the computational


slide-1
SLIDE 1

Generalized Linear Models (GLMs)

Statistical modeling and analysis of neural data NEU 560, Spring 2018 Lecture 9 Jonathan Pillow

1

slide-2
SLIDE 2

Example 3: unknown neuron

  • 25

25 25 50 75 100 (contrast) (spike count)

Be the computational neuroscientist: what model would you use?

2

slide-3
SLIDE 3

Example 3: unknown neuron

More general setup:

  • 25

25 25 50 75 100 (contrast) (spike count)

for some nonlinear function f

3

slide-4
SLIDE 4

Answer: stimulus likelihood function - useful for ML stimulus decoding!

Quick Quiz:

  • 1. as a function of y?
  • 2. as a function of ?

The distribution P(y|x, ) can be considered as a function of y, x, or .

spikes stimulus parameters

Answer: encoding distribution - probability distribution over spike counts Answer: likelihood function - the probability of the data given model params

  • 3. as a function of x?

What is P(y|x, ) :

4

slide-5
SLIDE 5

20 40 20 40 60

(contrast) (spike count)

stimulus decoding likelihood

5

slide-6
SLIDE 6

20 40 20 40 60

(contrast)

20 40 60

Stimulus likelihood function (for decoding)

(spike count)

What is this?

6

slide-7
SLIDE 7

GLMs

  • Be careful about terminology:

Linear Linear General Linear Model Generalized Linear Model

GLM GLM ≠

(Nelder 1972)

7

slide-8
SLIDE 8

2003 interview with John Nelder...

Stephen Senn: I must confess to having some confusion when I was a young statistician between general linear models and generalized linear models. Do you regret the terminology? John Nelder: I think probably I do. I suspect we should have found some more fancy name for it that would have stuck and not been confused with the general linear model, although general and generalized are not quite the same. I can see why it might have been better to have thought of something else.

Senn, (2003). Statistical Science

8

slide-9
SLIDE 9

Moral: Be careful when naming your model!

9

slide-10
SLIDE 10

Linear Noise

“Dimensionality Reduction”

(exponential family)

Examples:

  • 1. Gaussian
  • 2. Poisson

y = ~ ✓ · ~ x + ✏

  • 1. General Linear Model

10

slide-11
SLIDE 11
  • 2. Generalized Linear Model

Linear Examples:

  • 1. Gaussian
  • 2. Poisson

Noise

(exponential family)

Nonlinear

y = f(~ ✓ · ~ x) + ✏

11

slide-12
SLIDE 12
  • 2. Generalized Linear Model

Linear Noise

(exponential family)

Nonlinear Terminology: “distribution function” “parameter” = “link function”

12

slide-13
SLIDE 13

1 1 0 0 0 0 1 1 01 0 0 00 0 0 0

stimulus response

From spike counts to spike trains:

linear filter vector stimulus at time t

time

response at time t

first idea: linear-Gaussian model!

yt = ~ k · ~ xt + ✏t

yt = ~ k · ~ xt + noise

N(0, σ2)

13

slide-14
SLIDE 14

~ xt yt

1 1 0 0 0 0 1 1 01 0 0 00 0 0 0

stimulus response

linear filter vector stimulus at time t

yt = ~ k · ~ xt + noise

time

response at time t

t = 1

walk through the data

  • ne time bin at a time

N(0, σ2)

14

slide-15
SLIDE 15

~ xt yt

1 1 0 0 0 0 1 1 01 0 0 00 0 0 0

linear filter vector stimulus at time t

yt = ~ k · ~ xt + noise

time

response at time t

t = 2

walk through the data

  • ne time bin at a time

stimulus response

N(0, σ2)

15

slide-16
SLIDE 16

~ xt yt

1 1 0 0 0 0 1 1 01 0 0 00 0 0 0

linear filter vector stimulus at time t

yt = ~ k · ~ xt + noise

time

response at time t

t = 3

walk through the data

  • ne time bin at a time

stimulus response

N(0, σ2)

16

slide-17
SLIDE 17

~ xt

yt

1 1 0 0 0 0 1 1 01 0 0 00 0 0 0

linear filter vector stimulus at time t

yt = ~ k · ~ xt + noise

time

response at time t

t = 4

walk through the data

  • ne time bin at a time

stimulus response

N(0, σ2)

17

slide-18
SLIDE 18

~ xt yt

1 1 0 0 0 0 1 1 01 0 0 00 0 0 0

linear filter vector stimulus at time t

yt = ~ k · ~ xt + noise

time

response at time t

t = 5

walk through the data

  • ne time bin at a time

stimulus response

N(0, σ2)

18

slide-19
SLIDE 19

~ xt yt

1 1 0 0 0 0 1 1 01 0 0 00 0 0 0

linear filter vector stimulus at time t

yt = ~ k · ~ xt + noise

time

response at time t

t = 6

walk through the data

  • ne time bin at a time

stimulus response

N(0, σ2)

19

slide-20
SLIDE 20

Build up to following matrix version:

Y

X~ k

= + noise =

time design matrix

~ k

1

20

slide-21
SLIDE 21

Build up to following matrix version:

1 …

Y

X~ k

= + noise =

time

ˆ k = (XT X)−1XT Y

stimulus covariance spike-triggered avg (STA)

(maximum likelihood estimate for “Linear-Gaussian” GLM) least squares solution:

~ k

21

slide-22
SLIDE 22

Formal treatment: scalar version

model:

N(0, σ2)

yt = ~ k · ~ xt + ✏t

equivalent to writing:

yt|~ xt,~ k ∼ N(~ xt · ~ k, 2)

p(yt|~ xt,~ k) =

1 √ 2πσ2 e− (yt−~

xt·~ k)2 22

  • r

p(Y |X,~ k) =

T

Y

t=1

p(yt|~ xt,~ k)

For entire dataset:

(independence across time bins)

= (2πσ2)− T

2 exp(− PT

t=1 (yt−~ xt·~ k)2 22

)

Guassian noise with variance σ2

log P(Y |X,~ k) = − PT

t=1 (yt−~ xt·~ k)2 22

+ const

log-likelihood

22

slide-23
SLIDE 23

Formal treatment: vector version

Y

X~ k

=

~ k

=

time

+ ~ ✏

N(0, σ2I)

+

iid Gaussian noise vector

✏1 ✏2

✏3

equivalent to writing:

  • r

Y |X,~ k ∼ N(X~ k, 2I) P(Y |X,~ k) =

1 |2πσ2I|

T 2 exp

⇣ −

1 2σ2 (Y − X~

k)>(Y − X~ k) ⌘

Take log, differentiate and set to zero.

1

23

slide-24
SLIDE 24

~ k

time

probability of spike at bin t

Bernoulli GLM:

pt = f(~ xt · ~ k)

(coin flipping model, y = 0 or 1)

p(yt = 1|~ xt) = pt

nonlinearity

Equivalent ways of writing:

yt|~ xt,~ k ∼ Ber(f(~ xt · ~ k)) p(yt|~ xt,~ k) = f(~ xt · ~ k)yt ⇣ 1 − f(~ xt · ~ k) ⌘1−yt

  • r

But noise is not Gaussian!

log-likelihood:

L = PT

t=1

⇣ yt log f(~ xt · ~ k) + (1 − yt) log(1 − f(~ xt · ~ k)) ⌘

f( )

1

24

slide-25
SLIDE 25

Logistic regression

Logistic regression:

f(x) = 1 1 + e−x

logistic function

  • so logistic regression is a special case of a Bernoulli GLM

~ k

time

probability of spike at bin t

Bernoulli GLM:

pt = f(~ xt · ~ k)

(coin flipping model, y = 0 or 1)

p(yt = 1|~ xt) = pt

nonlinearity

f( )

1

25

slide-26
SLIDE 26

Poisson regression

firing rate

Poisson GLM:

(integer y≥0 ) nonlinearity

t = f(~ xt · ~ k) yt|~ xt,~ k ∼ Poiss(∆t)

time bin size

<latexit sha1_base64="jbjLJotpTeHkZkaMEURNb7zEwW8=">ACaXicbVBNb9NAEN2YAm34SsF0ctChJRKEDlcgANSBRw4Va1EaKU4tcbrcbvK7traHYdExv+KPwPXcuyP6Dr1gaMtKOn97M7r6kUNJRGP7uBHc27t67v7nVfDw0eMnve2d7y4vrcCxyFVuTxJwqKTBMUlSeFJYBJ0oPE5mnxv9eI7Wydx8o2WBUw1nRmZSAHkq7h0Ug2VMP6P5IqbX0Xy2xz/yKLMgqkH0BRUBj5TflkJMe6eVt9Z101/UHE+rN+uWOu71w2G4Kn4bjFrQZ20dxtudjSjNRanRkFDg3GQUFjStwJIUCutuVDosQMzgDCceGtDoptXq4zV/5ZmUZ7n1xBfsf9OVKCdW+rEOzXQuVvXGvJ/2qSk7P20kqYoCY24vigrFaecNynyVFoUpJYegLDSv5WLc/Cxkc+6240M/hC51mDSyoda+4aCz+o1YdEKiya30XpKt8H47fDMDwK+/uf2gA32S57yQZsxN6xfaVHbIxE+wX+8Mu2N/OZbATPAueX1uDTjvzlN2oH8FWym8YQ=</latexit>

log-likelihood: encoding distribution:

<latexit sha1_base64="QI4yjr0Tf7x9U0q9+/kijSmtHCo=">ACgXicbVHLThsxFHWGtND0QWiX3VhESKFqowkbWqFKiG6IJKBFJlosju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-Gaussian” GLM:

Y |X,~ k ∼ N(X~ k, 2I)

  • 2. Bernoulli GLM:
  • 3. Poisson GLM:

yt|~ xt,~ k ∼ Poiss(∆t) yt|~ xt,~ k ∼ Ber(f(~ xt · ~ k))

<latexit sha1_base64="UNt4lEq3y3m8KLk2pIT2tsWp4c=">ACbXicbZDNThsxFIWdofw0LRBA6qZQWY0QsCaYdOyqITaTRcsqERKqkyIPM6dxIp/RvYdSjSaZ+Fpum3XfQseAWeYRQm9kq2j890rX58k8JhGP5tBEsvldW142X71e39hsbW1/dya3HLrcSGN7CXMghYuCpTQywlUi4SqZf5vzqBqwTRl/iLIOBYmMtUsEZemvYOo0Vwlnsjgv6Sf6I0ab0ViaMU0Pe/HN9Ige06olSYuorGgNhq12Amros9FVIs2qetiuNXYi0eG5wo0csmc60dhoOCWRcQtmMcwcZ41M2hr6Xmilwg6L6Y0n3vTOiqbH+aKSV+9EwZRzM5X4zvm6bpHNzf+xfo7px0EhdJYjaP74UJpLiobOA6MjYGjnHnBuBV+V8onzDKOPtZmM9bwkxulmB4VPpbSX8DptFwAtzW4XQA+0LK4jtFkpQ80WozvueiedE474bewfa5TnaNvCXvySGJyAdyRr6SC9IlnNyRX+Q3+dO4D94Eu8G7x9agUc/skCcVHDwAMYS9SQ=</latexit> <latexit sha1_base64="HP+VfMA0E+XGBPwmKdZYtaDvzk=">ACcnicbZHLahsxFIbl6S1L7GTZSioNQUbGjPTZJFSkg3WXThQl07eFyjkc84wroM0hknZpi3ydNkm2z6IN1HdgfaOj0g8ev/dJD0K8mkcBiGP2vBo8dPnj7bel5/8fLV6+1Gc+e7M7nl0OdGjtMmAMpNPRoIRhZoGpRMIgmX9e8cECrBNGf8NlBmPFZlqkgjP01qTxKVYMLziTxZeSHtPzG1GY2lmNG0P48W8Q/dpO9o/7/wBflmxDp0WmE3XBd9KJKtEhVvUmz9iaeGp4r0Mglc24UhRmOC2ZRcAlPc4dZIzP2QxGXmqmwI2L9UNL+t47U5oa64dGunb/7iYc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