Functional Data - Stanford Universitystatweb.stanford.edu/~jtaylo/courses/stats203/notes/fda.pdfFull...

21
- p. 1/12 Statistics 203: Introduction to Regression and Analysis of Variance Functional Data Jonathan Taylor

Transcript of Functional Data - Stanford Universitystatweb.stanford.edu/~jtaylo/courses/stats203/notes/fda.pdfFull...

Page 1: Functional Data - Stanford Universitystatweb.stanford.edu/~jtaylo/courses/stats203/notes/fda.pdfFull model for finger tapping data Voxel in the motor cortex Marginally significant

- p. 1/12

Statistics 203: Introduction to Regressionand Analysis of Variance

Functional Data

Jonathan Taylor

Page 2: Functional Data - Stanford Universitystatweb.stanford.edu/~jtaylo/courses/stats203/notes/fda.pdfFull model for finger tapping data Voxel in the motor cortex Marginally significant

● Today’s class

● What is fMRI?

● Block design – finger tapping

● Hemodynamic response

function● Convolved design – finger

tapping

● Components of Errx,t

● Full model for finger tapping

data● Voxel in the motor cortex

● Marginally significant voxel

● Real experiment: reward

anticipation

● Combining subjects: fixed

effect analysis

- p. 2/12

Today’s class

■ Functional data.■ A functional t-test.■ Mean, variance, covariance functions.■ Functional data I care about – fMRI.

Page 3: Functional Data - Stanford Universitystatweb.stanford.edu/~jtaylo/courses/stats203/notes/fda.pdfFull model for finger tapping data Voxel in the motor cortex Marginally significant

● Today’s class

● What is fMRI?

● Block design – finger tapping

● Hemodynamic response

function● Convolved design – finger

tapping

● Components of Errx,t

● Full model for finger tapping

data● Voxel in the motor cortex

● Marginally significant voxel

● Real experiment: reward

anticipation

● Combining subjects: fixed

effect analysis

- p. 3/12

Functional data

Page 4: Functional Data - Stanford Universitystatweb.stanford.edu/~jtaylo/courses/stats203/notes/fda.pdfFull model for finger tapping data Voxel in the motor cortex Marginally significant

● Today’s class

● What is fMRI?

● Block design – finger tapping

● Hemodynamic response

function● Convolved design – finger

tapping

● Components of Errx,t

● Full model for finger tapping

data● Voxel in the motor cortex

● Marginally significant voxel

● Real experiment: reward

anticipation

● Combining subjects: fixed

effect analysis

- p. 4/12

Functional data

■ Last class, we talked about smoothing one function at a time.◆ B splines;◆ smoothing splines;◆ kernel smoothers.

■ In a functional data setting we observe many functions atonce, we might also observe many covariates for each curve.

■ Example I will talk about later: functions are space-timeimages, covariates are simple: “motion correction” and “slowdrift.”

Page 5: Functional Data - Stanford Universitystatweb.stanford.edu/~jtaylo/courses/stats203/notes/fda.pdfFull model for finger tapping data Voxel in the motor cortex Marginally significant

● Today’s class

● What is fMRI?

● Block design – finger tapping

● Hemodynamic response

function● Convolved design – finger

tapping

● Components of Errx,t

● Full model for finger tapping

data● Voxel in the motor cortex

● Marginally significant voxel

● Real experiment: reward

anticipation

● Combining subjects: fixed

effect analysis

- p. 5/12

A two-sample functional t-test

■ Suppose we observe a group of n paired curves: maybe thegrowth curves of twins separated at birth over the first 18years of life but raised in different countries with a bigdifference in standard of living.

■ Nutrition is known to have an effect on population height:twins’ curves might be different.

■ We can describe this data as(Yi1,t, Yi2,t), 1 ≤ i ≤ n, 0 ≤ t ≤ 18 where twins Y·1 are incountry # 1 and Y·2 are in country # 2 with

Yij,t = µi,t + δt · 1{j=1} + εij,t.

■ The measurement noise ε can be assumed independentacross subjects and set of twins put probably is dependent intime (µi would be a random effect curve for the i-th set oftwins), and δ is the “nutrition effect”

■ Although we never observe the whole curve, we should thinkof actually having an entire curve.

Page 6: Functional Data - Stanford Universitystatweb.stanford.edu/~jtaylo/courses/stats203/notes/fda.pdfFull model for finger tapping data Voxel in the motor cortex Marginally significant

● Today’s class

● What is fMRI?

● Block design – finger tapping

● Hemodynamic response

function● Convolved design – finger

tapping

● Components of Errx,t

● Full model for finger tapping

data● Voxel in the motor cortex

● Marginally significant voxel

● Real experiment: reward

anticipation

● Combining subjects: fixed

effect analysis

- p. 6/12

Functional t-test

■ For each t, and each pair compute

δt =1

n

n∑

i=1

Yi1,t − Yi2,t,

■ Also, compute

σ2(δt) =1

n − 1

n∑

i=1

(Yi1,t − Yi2,t − δt)2

■ Natural to use

Tt =δt

σ(δt)

to test H0,t : δt = 0, i.e. at age t the “country effect” is 0.■ Test for no effect H0 = ∩tH0,t: use

Tmax = maxt∈[0,18]

|Tt|.

Page 7: Functional Data - Stanford Universitystatweb.stanford.edu/~jtaylo/courses/stats203/notes/fda.pdfFull model for finger tapping data Voxel in the motor cortex Marginally significant

● Today’s class

● What is fMRI?

● Block design – finger tapping

● Hemodynamic response

function● Convolved design – finger

tapping

● Components of Errx,t

● Full model for finger tapping

data● Voxel in the motor cortex

● Marginally significant voxel

● Real experiment: reward

anticipation

● Combining subjects: fixed

effect analysis

- p. 7/12

Smooth noise

■ Problem: what is the distribution of Tmax? It is not χ2!Depends on properties of ε.

■ Maybe we model each noise εij as a smooth Gaussianprocess on [0, 18].

■ What is a Gaussian process? A random function such thatfor every collection {t1, . . . , tk} the random vector

(εt1 , . . . , εtk)

is multivariate normal.■ A Gaussian process εt is completely determined by

µt = E(µt), Rt,s = Cov(εt, εs)

■ If n is large (so Tt is almost Gaussian itself) then thedistribution of

εmax = maxt∈[0,18]

εt

depends on Var(εt) (known as Rice’s formula).

Page 8: Functional Data - Stanford Universitystatweb.stanford.edu/~jtaylo/courses/stats203/notes/fda.pdfFull model for finger tapping data Voxel in the motor cortex Marginally significant

● Today’s class

● What is fMRI?

● Block design – finger tapping

● Hemodynamic response

function● Convolved design – finger

tapping

● Components of Errx,t

● Full model for finger tapping

data● Voxel in the motor cortex

● Marginally significant voxel

● Real experiment: reward

anticipation

● Combining subjects: fixed

effect analysis

- p. 8/12

Another approach

■ Perhaps a more typical FDA approach would be “dimension”reduction. That is, take each curve Yij,t and express it as alinear combination of basis functions bk(t) – the projection ofYij,t onto the basis

Yij,t =∑

k

cij,kbk(t) + rij,t

Sometimes the remainder rij,t = 0 and no dimensionreduction is used.

■ In any case, once you have expressed each curve in a givenbasis, the two-sample t-test problem becomes a standardregression problem involving the cofficients cij,k which is the“new data.”

■ With this basis approach, it is possible to impose penalties(i.e. on the second derivatives, etc.) as long as you knowhow to compute the penalties in your specific basis.

Page 9: Functional Data - Stanford Universitystatweb.stanford.edu/~jtaylo/courses/stats203/notes/fda.pdfFull model for finger tapping data Voxel in the motor cortex Marginally significant

● Today’s class

● What is fMRI?

● Block design – finger tapping

● Hemodynamic response

function● Convolved design – finger

tapping

● Components of Errx,t

● Full model for finger tapping

data● Voxel in the motor cortex

● Marginally significant voxel

● Real experiment: reward

anticipation

● Combining subjects: fixed

effect analysis

- p. 9/12

Penalty example: second derivative

■ Suppose we choose to express each curve Yij,t as a linearcombination of cos waves of the form

bk(t) = cos (2πkt/18) , 1 ≤ k ≤ m.

■ Then

b′′k(t) = ckbk(t),

∫ 18

0

bk(t)bj(t)dt = δjkc′k.

■ This means that

∫ T

0

(∑

k

akb′′k(t)

)2

dt =∑

k

a2kc2

kc′k.

■ Smoothing spline problem to estimate δ (penalty on integralof δ′′(t)2) becomes a ridge problem.

Page 10: Functional Data - Stanford Universitystatweb.stanford.edu/~jtaylo/courses/stats203/notes/fda.pdfFull model for finger tapping data Voxel in the motor cortex Marginally significant

● Today’s class

● What is fMRI?

● Block design – finger tapping

● Hemodynamic response

function● Convolved design – finger

tapping

● Components of Errx,t

● Full model for finger tapping

data● Voxel in the motor cortex

● Marginally significant voxel

● Real experiment: reward

anticipation

● Combining subjects: fixed

effect analysis

- p. 10/12

Smoothing spline and ridge

■ Suppose we look at the two-sample problem in the Fourierbasis but we impose a second derivative penalty. Let

Yij,t =

m∑

k=1

cij,kbk(t)

be the “dimension reduced” Yij,t’s and

δt =∑

k

δkbk(t)

be a linear combination of sine waves.■ Problem findδt that minimizes

Lλ(δ) =

n∑

i=1

(Yi1,t − Yi2,t − δt

)2

dt + λ

∫ 18

0

δ′′(t)2 dt.

■ Both integrals reduce to sums involving δk’s and cij,k’s:equivalent to a ridge problem.

Page 11: Functional Data - Stanford Universitystatweb.stanford.edu/~jtaylo/courses/stats203/notes/fda.pdfFull model for finger tapping data Voxel in the motor cortex Marginally significant

● Today’s class

● What is fMRI?

● Block design – finger tapping

● Hemodynamic response

function● Convolved design – finger

tapping

● Components of Errx,t

● Full model for finger tapping

data● Voxel in the motor cortex

● Marginally significant voxel

● Real experiment: reward

anticipation

● Combining subjects: fixed

effect analysis

- p. 11/12

fMRI

Page 12: Functional Data - Stanford Universitystatweb.stanford.edu/~jtaylo/courses/stats203/notes/fda.pdfFull model for finger tapping data Voxel in the motor cortex Marginally significant

● Today’s class

● What is fMRI?

● Block design – finger tapping

● Hemodynamic response

function● Convolved design – finger

tapping

● Components of Errx,t

● Full model for finger tapping

data● Voxel in the motor cortex

● Marginally significant voxel

● Real experiment: reward

anticipation

● Combining subjects: fixed

effect analysis

- p. 12/12

What is fMRI?

■ fMRI (Functional Magnetic Resonance Imaging) is aspace-time recording of “metabolic activity” in the humanbrain

■ “paradigm” (motor task, i.e. finger tapping or cognitive task,i.e. face recognition) increases nerve cell activity in areasassociated with the “paradigm”

■ increased nerve cell activity increases metabolic demand foroxygen, increases metabolic activity results in a laggedincrease in oxygenated Hg (hemoglobin)

■ relationship between input “paradigm” and BOLD ismodelled through a transfer function, the HemodynamicResponse Function (HRF)

BOLDx,t = βInputx · (HRF ∗ Input)t +

k∑

i=1

βi,xXi + Errx,t.

Page 13: Functional Data - Stanford Universitystatweb.stanford.edu/~jtaylo/courses/stats203/notes/fda.pdfFull model for finger tapping data Voxel in the motor cortex Marginally significant

- p. 13/12

Block design – finger tapping

0 50 100 150 200 250

0.0

0.2

0.4

0.6

0.8

1.0

Time

Pro

toco

l

Page 14: Functional Data - Stanford Universitystatweb.stanford.edu/~jtaylo/courses/stats203/notes/fda.pdfFull model for finger tapping data Voxel in the motor cortex Marginally significant

- p. 14/12

Hemodynamic response function

0 5 10 15 20

−0.

20.

20.

61.

0

Time

HR

F

Page 15: Functional Data - Stanford Universitystatweb.stanford.edu/~jtaylo/courses/stats203/notes/fda.pdfFull model for finger tapping data Voxel in the motor cortex Marginally significant

- p. 15/12

Convolved design – finger tapping

0 50 100 150 200 250

050

100

150

200

Time

Pro

toco

l

Page 16: Functional Data - Stanford Universitystatweb.stanford.edu/~jtaylo/courses/stats203/notes/fda.pdfFull model for finger tapping data Voxel in the motor cortex Marginally significant

● Today’s class

● What is fMRI?

● Block design – finger tapping

● Hemodynamic response

function● Convolved design – finger

tapping

● Components of Errx,t

● Full model for finger tapping

data● Voxel in the motor cortex

● Marginally significant voxel

● Real experiment: reward

anticipation

● Combining subjects: fixed

effect analysis

- p. 16/12

Components of Errx,t

■ physiological noise◆ cardiac noise◆ repiratory noise◆ basal metabolism

■ motion artifacts■ saturation of signal■ other sources of error: lumped into “noise term” εx,t

Page 17: Functional Data - Stanford Universitystatweb.stanford.edu/~jtaylo/courses/stats203/notes/fda.pdfFull model for finger tapping data Voxel in the motor cortex Marginally significant

● Today’s class

● What is fMRI?

● Block design – finger tapping

● Hemodynamic response

function● Convolved design – finger

tapping

● Components of Errx,t

● Full model for finger tapping

data● Voxel in the motor cortex

● Marginally significant voxel

● Real experiment: reward

anticipation

● Combining subjects: fixed

effect analysis

- p. 17/12

Full model for finger tapping data

BOLDx,t = βInputx · (HRF ∗ Input)t +

6∑

j=1

Tj,tβMotionj,x +

2∑

j=0

βTimej,x tj + εx,t.

■ Usually, model is fit voxel-by-voxel, usually spatial ignoringcorrelation between εx1,· and εx2,·.

■ Most common model is a two-stage procedure: first find a(smoothed) AR(1) coefficient image at each voxel in thebrain: estimate standard errors and coefficients with thisAR(1) value at each voxel.Sometimes, even correlation within time series at a singlepoint is ignored and model is fit by OLS.

■ Many people work on “improving” this basic model.

Page 18: Functional Data - Stanford Universitystatweb.stanford.edu/~jtaylo/courses/stats203/notes/fda.pdfFull model for finger tapping data Voxel in the motor cortex Marginally significant

- p. 18/12

Voxel in the motor cortex

0 50 100 150 200 250

560

570

580

590

Time

BO

LD s

igna

l

Page 19: Functional Data - Stanford Universitystatweb.stanford.edu/~jtaylo/courses/stats203/notes/fda.pdfFull model for finger tapping data Voxel in the motor cortex Marginally significant

- p. 19/12

Marginally significant voxel

0 50 100 150 200 250

640

650

660

Time

BO

LD s

igna

l

Page 20: Functional Data - Stanford Universitystatweb.stanford.edu/~jtaylo/courses/stats203/notes/fda.pdfFull model for finger tapping data Voxel in the motor cortex Marginally significant

● Today’s class

● What is fMRI?

● Block design – finger tapping

● Hemodynamic response

function● Convolved design – finger

tapping

● Components of Errx,t

● Full model for finger tapping

data● Voxel in the motor cortex

● Marginally significant voxel

● Real experiment: reward

anticipation

● Combining subjects: fixed

effect analysis

- p. 20/12

Real experiment: reward anticipation

■ B. Knutson, my psychologist collaborator is interested inreward anticipation.

■ Subjects play simple video game, and are told whether theycan win, lose or draw on each round.

■ If we contrast “win” (reward) vs. “draw” (neutral), we will findareas that are sensitive to anticipating reward.

Page 21: Functional Data - Stanford Universitystatweb.stanford.edu/~jtaylo/courses/stats203/notes/fda.pdfFull model for finger tapping data Voxel in the motor cortex Marginally significant

● Today’s class

● What is fMRI?

● Block design – finger tapping

● Hemodynamic response

function● Convolved design – finger

tapping

● Components of Errx,t

● Full model for finger tapping

data● Voxel in the motor cortex

● Marginally significant voxel

● Real experiment: reward

anticipation

● Combining subjects: fixed

effect analysis

- p. 21/12

Combining subjects: fixed effect analysis

■ For each subject i, compute

TRwAnt,ix =

βRwAnt,ix

SE(βRwAnt,i

x ).

■ Transform subject-specific comparisons to Tailarach space(common coordinates).

■ Form group map

Tx =1√n

n∑

i=1

TRwAnt,ix .

■ Analogous to the role of Tt in “growth curve” example.■ Where to set the threshold? The uncorrected 0.05 threshold

is 1.96. The generalizations of Rice’s formula set thethreshold around 4.5 or so. Let’s look at the difference.