Introduction to the General Linear Model (GLM)

34
Introduction to the General Linear Model (GLM) 1 quantitative variable & 1 2-group variable 1a main effects model with no interaction 1b interaction model 1 quantitative variable & 1 3-group variable 2a main effects model with no interaction 2b interaction model

description

Introduction to the General Linear Model (GLM). 1 quantitative variable & 1 2-group variable 1a  main effects model with no interaction 1b  interaction model 1 quantitative variable & 1 3-group variable 2a  main effects model with no interaction 2b  interaction model. - PowerPoint PPT Presentation

Transcript of Introduction to the General Linear Model (GLM)

Page 1: Introduction to the General Linear Model (GLM)

Introduction to the General Linear Model (GLM)

1 quantitative variable & 1 2-group variable 1a main effects model with no interaction 1b interaction model

1 quantitative variable & 1 3-group variable 2a main effects model with no interaction 2b interaction model

Page 2: Introduction to the General Linear Model (GLM)

There are two important variations of each of these models

1. Main effects model

• Centered or coded terms for each variable

• No interaction – assumes regression slope homogeneity

• b-weights for binary & quant variables each represent main effect of that variable

2. Interaction model

• Centered or coded terms for each variable

• Term for interaction - does not assume reg slp homogen !!

• b-weights for binary & quant variables each represent the simple effect of that variable when the other variable = 0

• b-weight for the interaction term represented how the simple effect of one variable changes with changes in the value of the other variable (e.g., the extent and direction of the interaction)

Page 3: Introduction to the General Linear Model (GLM)

#1a centered quant variable & dummy coded 2-grp variable

y’ = b0 + b1x + b2z

“X” is a centered quantitative variable

X X – Xmean

“Z” is a dummy-coded 2-group variable (Cz = 0 & Tx = 1)

Z Tz = 1 Cz = 0

Page 4: Introduction to the General Linear Model (GLM)

#1a centered quant variable & dummy coded 2-grp variable

y’ = b0 + b1x + b2z

b0 mean of those in Cz with X=0 (mean)

b1 slope of Y-X regression line for Cz (=0)- slope same for both groups no interaction

b2 group difference for X=mean (=0) - group different same for all values of X no interaction

Page 5: Introduction to the General Linear Model (GLM)

0 1

0

20

30

4

0

50

60

y’ = b0 + b1X + b2Z

Cz

Tz

-2 -1 0 1 2 Xcen

b0 = ht of Cz line

b1 = slp of Cz line

b2 = htdif Cz & Tz

Z-lines have same slp(no interaction)

20 5 10

#1a quantitative (Xcen) & 2-group (Tz=1 Cz=0)

Page 6: Introduction to the General Linear Model (GLM)

#1b centered quant var, dummy coded 2-group var & their product term/interaction

y’ = b0 + b1x + b2z + b3xz

“X” is a centered quantitative variable

X X – Xmean

“Z” is a dummy-coded 2-group variable

Z Tz = 1 Cz = 0

“XZ” represents the interaction of “X” and “Z”

XZ X * Z

Page 7: Introduction to the General Linear Model (GLM)

#1b centered quant var, dummy coded 2-group var & their product term/interaction

y’ = b0 + b1x + b2z + b3xz

b0 mean of those in Cz with X= 0 (mean)

b1 slope of Y-X regression line for Cz (=0)*

b2 group difference for X=0 (mean)*

b3 how slope of y-x reg line for Tz (=1) differs from slope of y-x reg line for Cz (=0)

* Because the interaction is included, slopes may be different for different grps * Because the interaction is included, group differences may be different for

different X values

Page 8: Introduction to the General Linear Model (GLM)

0 1

0

20

30

4

0

50

60

Cz

Tz

-2 -1 0 1 2 Xcen

b0 = ht of Cz line

b1 = slp of Cz line

b2 = htdif Cz & Tz

b3 = slpdif Cz & Tz

y’ = b0 + b1X + b2Z + b3XZ

30 -5 15 15

#1b quantitative (X) & 2-group (Tz Cz) predictors w/ interaction

Page 9: Introduction to the General Linear Model (GLM)

0 1

0

20

30

4

0

50

60

-2 -1 0 1 2 Xcen

b0 = ht of Cz line

b1 = slp of Cz line

b2 = htdif Cz & Tz

b3 = slpdif Cz & Tz

y’ = b0 + b1X + b2Z + b3XZ

#1b quantitative (X) & 2-group (Tz Cz) predictors w/ interaction

Page 10: Introduction to the General Linear Model (GLM)

0 1

0

20

30

4

0

50

60

-2 -1 0 1 2 Xcen

b0 = ht of Cz line

b1 = slp of Cz line

b2 = htdif Cz & Tz

b3 = slpdif Cz & Tz

y’ = b0 + b1X + b2Z + b3XZ

#1b quantitative (X) & 2-group (Tz Cz) predictors w/ interaction

Page 11: Introduction to the General Linear Model (GLM)

0 1

0

20

30

4

0

50

60

-2 -1 0 1 2 Xcen

b0 = ht of Cz line

b1 = slp of Cz line

b2 = htdif Cz & Tz

b3 = slpdif Cz & Tz

y’ = b0 + b1X + b2Z + b3XZ

#1b quantitative (X) & 2-group (Tz Cz) predictors w/ interaction

Page 12: Introduction to the General Linear Model (GLM)

0 1

0

20

30

4

0

50

60

-2 -1 0 1 2 Xcen

b0 = ht of Cz line

b1 = slp of Cz line

b2 = htdif Cz & Tz

b3 = slpdif Cz & Tz

y’ = b0 + b1X + b2Z + b3XZ

#1b quantitative (X) & 2-group (Tz Cz) predictors w/ interaction

Page 13: Introduction to the General Linear Model (GLM)

0 1

0

20

30

4

0

50

60

-2 -1 0 1 2 Xcen

b0 = ht of Cz line

b1 = slp of Cz line

b2 = htdif Cz & Tz

b3 = slpdif Cz & Tz

y’ = b0 + b1X + b2Z + b3XZ

#1b quantitative (X) & 2-group (Tz Cz) predictors w/ interaction

Page 14: Introduction to the General Linear Model (GLM)

0 1

0

20

30

4

0

50

60

-2 -1 0 1 2 Xcen

b0 = ht of Cz line

b1 = slp of Cz line

b2 = htdif Cz & Tz

b3 = slpdif Cz & Tz

y’ = b0 + b1X + b2Z + b3XZ

#1b quantitative (X) & 2-group (Tz Cz) predictors w/ interaction

Page 15: Introduction to the General Linear Model (GLM)

0 1

0

20

30

4

0

50

60

-2 -1 0 1 2 Xcen

b0 = ht of Cz line

b1 = slp of Cz line

b2 = htdif Cz & Tz

b3 = slpdif Cz & Tz

y’ = b0 + b1X + b2Z + b3XZ

#1b quantitative (X) & 2-group (Tz Cz) predictors w/ interaction

Page 16: Introduction to the General Linear Model (GLM)

0 1

0

20

30

4

0

50

60

-2 -1 0 1 2 Xcen

b0 = ht of Cz line

b1 = slp of Cz line

b2 = htdif Cz & Tz

b3 = slpdif Cz & Tz

y’ = b0 + b1X + b2Z + b3XZ

#1b quantitative (X) & 2-group (Tz Cz) predictors w/ interaction

Page 17: Introduction to the General Linear Model (GLM)

0 1

0

20

30

4

0

50

60

-2 -1 0 1 2 Xcen

b0 = ht of Cz line

b1 = slp of Cz line

b2 = htdif Cz & Tz

b3 = slpdif Cz & Tz

y’ = b0 + b1X + b2Z + b3XZ

#1b quantitative (X) & 2-group (Tz Cz) predictors w/ interaction

Page 18: Introduction to the General Linear Model (GLM)

0 1

0

20

30

4

0

50

60

-2 -1 0 1 2 Xcen

b0 = ht of Cz line

b1 = slp of Cz line

b2 = htdif Cz & Tz

b3 = slpdif Cz & Tz

y’ = b0 + b1X + b2Z + b3XZ

#1b quantitative (X) & 2-group (Tz Cz) predictors w/ interaction

Page 19: Introduction to the General Linear Model (GLM)

#2a centered quant var & dummy coded 3-grp var

y’ = b0 + b1x + b2z1 + b3z2

“X” is centered quantitative variable

X X – Xmean

“Z1” & “Z2” are dummy-codes for the 3-group variable

Z1 Tz1 = 1 Tz2 = 0 Cz = 0

Z2 Tz1 = 0 Tz2 = 1 Cz = 0

Page 20: Introduction to the General Linear Model (GLM)

#2a centered quant var & dummy coded 3-grp var

y’ = b0 + b1x + b2z1 + b3z2

b0 mean of those in Cz with X=0 (mean)

b1 slope of Y-X regression line for Cz (=0)- slope same for all groups no interaction

b2 Tz1 - Cz difference for X=mean (=0) - group different same for all values of X no interaction

b3 Tz2 - Cz difference for X=mean (=0) - group different same for all values of X no interaction

Page 21: Introduction to the General Linear Model (GLM)

0 1

0

20

30

40

5

0

60

Cz

Tz2

Tz1

-2 -1 0 1 2 X

b0 = ht of Cz line

b2 = htdif Cz & Tz1

b3 = htdif Cz & Tz2

b1 = slp of Cz line

y’ = b0 + b1X + b2Z1 + b3Z2

Z-lines have same slp(no interaction)

35 -155 5

#2a quantitative (Xcen) & 3-group Z1 Tz1 = 1 Tz2 = 0 Cz = 0

Z2 Tz1=0 Tz2 = 1 Cz = 0

Page 22: Introduction to the General Linear Model (GLM)

#2b centered quant var, dummy coded 3-group var & their product terms/interaction

y’ = b0 + b1x + b2z1 + b3z2 + b4xz1 + b5xz2

“X” is centered quantitative variableX X – Xmean

“Z1” & “Z2” are dummy-codes for the 3-group variable

Z1 Tz1 = 1 Tz2 = 0 Cz = 0

Z2 Tz1 = 0 Tz2 = 1 Cz = 0

“XZ1” & “XZ2” represent the interaction of “X” and “Z” XZ1 X * Z1

XZ2 X * Z2

Page 23: Introduction to the General Linear Model (GLM)

#2b centered quant var, dummy coded 3-group var & their product terms/interaction

y’ = b0 + b1x + b2z1 + b3z2 + b4xz1 + b5xz2

b0 mean of those in Cz with X= 0 (mean)

b1 slope of Y-X regression line for Cz

b2 Tz1 - Cz difference for X=0 (mean)*

b3 Tz2 - Cz difference for X=0 (mean)*

b4 how slope of y-x reg line for Tz1 differs from slope of y-x reg line for Cz *b4 how slope of y-x reg line for Tz2 differs from slope of y-x reg line for Cz *

*Because the interaction is included, group differences may be different for different X values

* Because the interaction is included, slopes may be different for different grps

Page 24: Introduction to the General Linear Model (GLM)

0 1

0 2

0 3

0

40

50

60

y’ = b0 + b1Xcen + b2Z1 + b3Z2 + b4XZ1 + b5XZ2

CxTx1

Tx2

-2 -1 0 1 2 Xcen

b0 = ht of Cz line

b2 = htdif Cz & Tz1

b3 = htdif Cz & Tz2

b1 = slp of Cz line

b4 = slpdif Cz & Tz1

b5 = slpdif Cz & Tz2

30 5 15 5 2 -8

#2b quantitative (Xcen) & 3-group Z1 Tz1 = 1 Tz2 = 0 Cz = 0

Z2 Tz1=0 Tz2 = 1 Cz = 0

and interactions XZ1 = X*Z1 XZ2 = X*Z2

Page 25: Introduction to the General Linear Model (GLM)

0 1

0 2

0 3

0

40

50

60

y’ = b0 + b1Xcen + b2Z1 + b3Z2 + b4XZ1 + b5XZ2

-2 -1 0 1 2 Xcen

b0 = ht of Cz line

b2 = htdif Cz & Tz1

b3 = htdif Cz & Tz2

b1 = slp of Cz line

b4 = slpdif Cz & Tz1

b5 = slpdif Cz & Tz2

#2b quantitative (Xcen) & 3-group Z1 Tz1 = 1 Tz2 = 0 Cz = 0

Z2 Tz1=0 Tz2 = 1 Cz = 0

and interactions XZ1 = X*Z1 XZ2 = X*Z2

Page 26: Introduction to the General Linear Model (GLM)

0 1

0 2

0 3

0

40

50

60

y’ = b0 + b1Xcen + b2Z1 + b3Z2 + b4XZ1 + b5XZ2

-2 -1 0 1 2 Xcen

b0 = ht of Cz line

b2 = htdif Cz & Tz1

b3 = htdif Cz & Tz2

b1 = slp of Cz line

b4 = slpdif Cz & Tz1

b5 = slpdif Cz & Tz2

#2b quantitative (Xcen) & 3-group Z1 Tz1 = 1 Tz2 = 0 Cz = 0

Z2 Tz1=0 Tz2 = 1 Cz = 0

and interactions XZ1 = X*Z1 XZ2 = X*Z2

Page 27: Introduction to the General Linear Model (GLM)

0 1

0 2

0 3

0

40

50

60

y’ = b0 + b1Xcen + b2Z1 + b3Z2 + b4XZ1 + b5XZ2

-2 -1 0 1 2 Xcen

b0 = ht of Cz line

b2 = htdif Cz & Tz1

b3 = htdif Cz & Tz2

b1 = slp of Cz line

b4 = slpdif Cz & Tz1

b5 = slpdif Cz & Tz2

#2b quantitative (Xcen) & 3-group Z1 Tz1 = 1 Tz2 = 0 Cz = 0

Z2 Tz1=0 Tz2 = 1 Cz = 0

and interactions XZ1 = X*Z1 XZ2 = X*Z2

Page 28: Introduction to the General Linear Model (GLM)

0 1

0 2

0 3

0

40

50

60

y’ = b0 + b1Xcen + b2Z1 + b3Z2 + b4XZ1 + b5XZ2

-2 -1 0 1 2 Xcen

b0 = ht of Cz line

b2 = htdif Cz & Tz1

b3 = htdif Cz & Tz2

b1 = slp of Cz line

b4 = slpdif Cz & Tz1

b5 = slpdif Cz & Tz2

#2b quantitative (Xcen) & 3-group Z1 Tz1 = 1 Tz2 = 0 Cz = 0

Z2 Tz1=0 Tz2 = 1 Cz = 0

and interactions XZ1 = X*Z1 XZ2 = X*Z2

Page 29: Introduction to the General Linear Model (GLM)

0 1

0 2

0 3

0

40

50

60

y’ = b0 + b1Xcen + b2Z1 + b3Z2 + b4XZ1 + b5XZ2

-2 -1 0 1 2 Xcen

b0 = ht of Cz line

b2 = htdif Cz & Tz1

b3 = htdif Cz & Tz2

b1 = slp of Cz line

b4 = slpdif Cz & Tz1

b5 = slpdif Cz & Tz2

#2b quantitative (Xcen) & 3-group Z1 Tz1 = 1 Tz2 = 0 Cz = 0

Z2 Tz1=0 Tz2 = 1 Cz = 0

and interactions XZ1 = X*Z1 XZ2 = X*Z2

Page 30: Introduction to the General Linear Model (GLM)

0 1

0 2

0 3

0

40

50

60

y’ = b0 + b1Xcen + b2Z1 + b3Z2 + b4XZ1 + b5XZ2

-2 -1 0 1 2 Xcen

b0 = ht of Cz line

b2 = htdif Cz & Tz1

b3 = htdif Cz & Tz2

b1 = slp of Cz line

b4 = slpdif Cz & Tz1

b5 = slpdif Cz & Tz2

#2b quantitative (Xcen) & 3-group Z1 Tz1 = 1 Tz2 = 0 Cz = 0

Z2 Tz1=0 Tz2 = 1 Cz = 0

and interactions XZ1 = X*Z1 XZ2 = X*Z2

Page 31: Introduction to the General Linear Model (GLM)

0 1

0 2

0 3

0

40

50

60

y’ = b0 + b1Xcen + b2Z1 + b3Z2 + b4XZ1 + b5XZ2

-2 -1 0 1 2 Xcen

b0 = ht of Cz line

b2 = htdif Cz & Tz1

b3 = htdif Cz & Tz2

b1 = slp of Cz line

b4 = slpdif Cz & Tz1

b5 = slpdif Cz & Tz2

#2b quantitative (Xcen) & 3-group Z1 Tz1 = 1 Tz2 = 0 Cz = 0

Z2 Tz1=0 Tz2 = 1 Cz = 0

and interactions XZ1 = X*Z1 XZ2 = X*Z2

Page 32: Introduction to the General Linear Model (GLM)

0 1

0 2

0 3

0

40

50

60

y’ = b0 + b1Xcen + b2Z1 + b3Z2 + b4XZ1 + b5XZ2

-2 -1 0 1 2 Xcen

b0 = ht of Cz line

b2 = htdif Cz & Tz1

b3 = htdif Cz & Tz2

b1 = slp of Cz line

b4 = slpdif Cz & Tz1

b5 = slpdif Cz & Tz2

#2b quantitative (Xcen) & 3-group Z1 Tz1 = 1 Tz2 = 0 Cz = 0

Z2 Tz1=0 Tz2 = 1 Cz = 0

and interactions XZ1 = X*Z1 XZ2 = X*Z2

Page 33: Introduction to the General Linear Model (GLM)

0 1

0 2

0 3

0

40

50

60

y’ = b0 + b1Xcen + b2Z1 + b3Z2 + b4XZ1 + b5XZ2

-2 -1 0 1 2 Xcen

b0 = ht of Cz line

b2 = htdif Cz & Tz1

b3 = htdif Cz & Tz2

b1 = slp of Cz line

b4 = slpdif Cz & Tz1

b5 = slpdif Cz & Tz2

#2b quantitative (Xcen) & 3-group Z1 Tz1 = 1 Tz2 = 0 Cz = 0

Z2 Tz1=0 Tz2 = 1 Cz = 0

and interactions XZ1 = X*Z1 XZ2 = X*Z2

Page 34: Introduction to the General Linear Model (GLM)

0 1

0 2

0 3

0

40

50

60

y’ = b0 + b1Xcen + b2Z1 + b3Z2 + b4XZ1 + b5XZ2

-2 -1 0 1 2 Xcen

b0 = ht of Cz line

b2 = htdif Cz & Tz1

b3 = htdif Cz & Tz2

b1 = slp of Cz line

b4 = slpdif Cz & Tz1

b5 = slpdif Cz & Tz2

#2b quantitative (Xcen) & 3-group Z1 Tz1 = 1 Tz2 = 0 Cz = 0

Z2 Tz1=0 Tz2 = 1 Cz = 0

and interactions XZ1 = X*Z1 XZ2 = X*Z2