GLM is flexibleweb.mit.edu/fsl_v5.0.10/fsl/doc/wiki/attachments/GLM/JMglm.pdf · – 2-way ANOVA...
Transcript of GLM is flexibleweb.mit.edu/fsl_v5.0.10/fsl/doc/wiki/attachments/GLM/JMglm.pdf · – 2-way ANOVA...
![Page 1: GLM is flexibleweb.mit.edu/fsl_v5.0.10/fsl/doc/wiki/attachments/GLM/JMglm.pdf · – 2-way ANOVA – EVs are easy, but contrasts are trickier • Factor effects – 1-way – 2-way](https://reader035.fdocuments.in/reader035/viewer/2022071417/6115074f6ce18a060e57c952/html5/thumbnails/1.jpg)
Recall
• GLM is flexible – One Sample T Test – ANOVA – Two sample T Test – Paired T test
• What do the models look like?
![Page 2: GLM is flexibleweb.mit.edu/fsl_v5.0.10/fsl/doc/wiki/attachments/GLM/JMglm.pdf · – 2-way ANOVA – EVs are easy, but contrasts are trickier • Factor effects – 1-way – 2-way](https://reader035.fdocuments.in/reader035/viewer/2022071417/6115074f6ce18a060e57c952/html5/thumbnails/2.jpg)
1-Sample T Test
Overall mean
![Page 3: GLM is flexibleweb.mit.edu/fsl_v5.0.10/fsl/doc/wiki/attachments/GLM/JMglm.pdf · – 2-way ANOVA – EVs are easy, but contrasts are trickier • Factor effects – 1-way – 2-way](https://reader035.fdocuments.in/reader035/viewer/2022071417/6115074f6ce18a060e57c952/html5/thumbnails/3.jpg)
Mean group 1
Mean group 2
2-Sample T Test
![Page 4: GLM is flexibleweb.mit.edu/fsl_v5.0.10/fsl/doc/wiki/attachments/GLM/JMglm.pdf · – 2-way ANOVA – EVs are easy, but contrasts are trickier • Factor effects – 1-way – 2-way](https://reader035.fdocuments.in/reader035/viewer/2022071417/6115074f6ce18a060e57c952/html5/thumbnails/4.jpg)
2-Sample T Test OR
![Page 5: GLM is flexibleweb.mit.edu/fsl_v5.0.10/fsl/doc/wiki/attachments/GLM/JMglm.pdf · – 2-way ANOVA – EVs are easy, but contrasts are trickier • Factor effects – 1-way – 2-way](https://reader035.fdocuments.in/reader035/viewer/2022071417/6115074f6ce18a060e57c952/html5/thumbnails/5.jpg)
Understanding a model
• If you’re unsure about a model or the contrasts – Plug in numbers – Look at graphs (fMRI data)
• Always ask yourself if your model is doing what you want it to
![Page 6: GLM is flexibleweb.mit.edu/fsl_v5.0.10/fsl/doc/wiki/attachments/GLM/JMglm.pdf · – 2-way ANOVA – EVs are easy, but contrasts are trickier • Factor effects – 1-way – 2-way](https://reader035.fdocuments.in/reader035/viewer/2022071417/6115074f6ce18a060e57c952/html5/thumbnails/6.jpg)
For example…
• For the 2 sample T test – Set – Then G1=8 and G2=3 – So is the mean of group 2
and is the difference between the groups
– What are the contrasts to test • Mean of G2 • Mean of G1 • G1-G2
![Page 7: GLM is flexibleweb.mit.edu/fsl_v5.0.10/fsl/doc/wiki/attachments/GLM/JMglm.pdf · – 2-way ANOVA – EVs are easy, but contrasts are trickier • Factor effects – 1-way – 2-way](https://reader035.fdocuments.in/reader035/viewer/2022071417/6115074f6ce18a060e57c952/html5/thumbnails/7.jpg)
For example…
• For the 2 sample T test – Set – Then G1=8 and G2=3 – So is the mean of group 2
and is the difference between the groups
– What are the contrasts to test • Mean of G2 • Mean of G1 • G1-G2
![Page 8: GLM is flexibleweb.mit.edu/fsl_v5.0.10/fsl/doc/wiki/attachments/GLM/JMglm.pdf · – 2-way ANOVA – EVs are easy, but contrasts are trickier • Factor effects – 1-way – 2-way](https://reader035.fdocuments.in/reader035/viewer/2022071417/6115074f6ce18a060e57c952/html5/thumbnails/8.jpg)
For example…
• For the 2 sample T test – Set – Then G1=8 and G2=3 – So is the mean of group 2
and is the difference between the groups
– What are the contrasts to test • Mean of G2 • Mean of G1 • G1-G2
![Page 9: GLM is flexibleweb.mit.edu/fsl_v5.0.10/fsl/doc/wiki/attachments/GLM/JMglm.pdf · – 2-way ANOVA – EVs are easy, but contrasts are trickier • Factor effects – 1-way – 2-way](https://reader035.fdocuments.in/reader035/viewer/2022071417/6115074f6ce18a060e57c952/html5/thumbnails/9.jpg)
Paired T Test
• A common mistake is to use a 2-sample t test instead of a paired test
• Tire example
• 2-sample T test p=0.58 • Paired T test p<0.001
Automobile Tire A Tire B 1 10.6 10.2 2 9.8 9.4 3 12.3 11.8 4 9.7 9.1 5 8.8 8.3
![Page 10: GLM is flexibleweb.mit.edu/fsl_v5.0.10/fsl/doc/wiki/attachments/GLM/JMglm.pdf · – 2-way ANOVA – EVs are easy, but contrasts are trickier • Factor effects – 1-way – 2-way](https://reader035.fdocuments.in/reader035/viewer/2022071417/6115074f6ce18a060e57c952/html5/thumbnails/10.jpg)
Why so different?
![Page 11: GLM is flexibleweb.mit.edu/fsl_v5.0.10/fsl/doc/wiki/attachments/GLM/JMglm.pdf · – 2-way ANOVA – EVs are easy, but contrasts are trickier • Factor effects – 1-way – 2-way](https://reader035.fdocuments.in/reader035/viewer/2022071417/6115074f6ce18a060e57c952/html5/thumbnails/11.jpg)
Why so different?
Mean A
Mean B
![Page 12: GLM is flexibleweb.mit.edu/fsl_v5.0.10/fsl/doc/wiki/attachments/GLM/JMglm.pdf · – 2-way ANOVA – EVs are easy, but contrasts are trickier • Factor effects – 1-way – 2-way](https://reader035.fdocuments.in/reader035/viewer/2022071417/6115074f6ce18a060e57c952/html5/thumbnails/12.jpg)
Why so different?
Difference is OK
![Page 13: GLM is flexibleweb.mit.edu/fsl_v5.0.10/fsl/doc/wiki/attachments/GLM/JMglm.pdf · – 2-way ANOVA – EVs are easy, but contrasts are trickier • Factor effects – 1-way – 2-way](https://reader035.fdocuments.in/reader035/viewer/2022071417/6115074f6ce18a060e57c952/html5/thumbnails/13.jpg)
Why so different?
Residuals are HUGE!
![Page 14: GLM is flexibleweb.mit.edu/fsl_v5.0.10/fsl/doc/wiki/attachments/GLM/JMglm.pdf · – 2-way ANOVA – EVs are easy, but contrasts are trickier • Factor effects – 1-way – 2-way](https://reader035.fdocuments.in/reader035/viewer/2022071417/6115074f6ce18a060e57c952/html5/thumbnails/14.jpg)
Paired T Test
Adjust for the mean of each pair
![Page 15: GLM is flexibleweb.mit.edu/fsl_v5.0.10/fsl/doc/wiki/attachments/GLM/JMglm.pdf · – 2-way ANOVA – EVs are easy, but contrasts are trickier • Factor effects – 1-way – 2-way](https://reader035.fdocuments.in/reader035/viewer/2022071417/6115074f6ce18a060e57c952/html5/thumbnails/15.jpg)
Paired T Test
Mean A
Mean B
![Page 16: GLM is flexibleweb.mit.edu/fsl_v5.0.10/fsl/doc/wiki/attachments/GLM/JMglm.pdf · – 2-way ANOVA – EVs are easy, but contrasts are trickier • Factor effects – 1-way – 2-way](https://reader035.fdocuments.in/reader035/viewer/2022071417/6115074f6ce18a060e57c952/html5/thumbnails/16.jpg)
Paired T Test
Difference is same
Residual variance much smaller
![Page 17: GLM is flexibleweb.mit.edu/fsl_v5.0.10/fsl/doc/wiki/attachments/GLM/JMglm.pdf · – 2-way ANOVA – EVs are easy, but contrasts are trickier • Factor effects – 1-way – 2-way](https://reader035.fdocuments.in/reader035/viewer/2022071417/6115074f6ce18a060e57c952/html5/thumbnails/17.jpg)
Paired T Test GLM
Mean of each pair
Difference
![Page 18: GLM is flexibleweb.mit.edu/fsl_v5.0.10/fsl/doc/wiki/attachments/GLM/JMglm.pdf · – 2-way ANOVA – EVs are easy, but contrasts are trickier • Factor effects – 1-way – 2-way](https://reader035.fdocuments.in/reader035/viewer/2022071417/6115074f6ce18a060e57c952/html5/thumbnails/18.jpg)
ANOVA 1-way ANOVA 2-way ANOVA
A
B
![Page 19: GLM is flexibleweb.mit.edu/fsl_v5.0.10/fsl/doc/wiki/attachments/GLM/JMglm.pdf · – 2-way ANOVA – EVs are easy, but contrasts are trickier • Factor effects – 1-way – 2-way](https://reader035.fdocuments.in/reader035/viewer/2022071417/6115074f6ce18a060e57c952/html5/thumbnails/19.jpg)
Modeling ANOVA with GLM
• Cell means model – 1-way ANOVA – 2-way ANOVA – EVs are easy, but contrasts are trickier
• Factor effects – 1-way – 2-way – EVs take more thought, but contrasts are
easier • ANOVA uses F tests
![Page 20: GLM is flexibleweb.mit.edu/fsl_v5.0.10/fsl/doc/wiki/attachments/GLM/JMglm.pdf · – 2-way ANOVA – EVs are easy, but contrasts are trickier • Factor effects – 1-way – 2-way](https://reader035.fdocuments.in/reader035/viewer/2022071417/6115074f6ce18a060e57c952/html5/thumbnails/20.jpg)
Modeling ANOVA with GLM
• Cell means model – 1-way ANOVA – 2-way ANOVA – EVs are easy, but contrasts are trickier
• Factor effects – 1-way – 2-way – EVs take more thought, but contrasts are
easier • ANOVA = F tests!
![Page 21: GLM is flexibleweb.mit.edu/fsl_v5.0.10/fsl/doc/wiki/attachments/GLM/JMglm.pdf · – 2-way ANOVA – EVs are easy, but contrasts are trickier • Factor effects – 1-way – 2-way](https://reader035.fdocuments.in/reader035/viewer/2022071417/6115074f6ce18a060e57c952/html5/thumbnails/21.jpg)
1 Way ANOVA - Cell Means
![Page 22: GLM is flexibleweb.mit.edu/fsl_v5.0.10/fsl/doc/wiki/attachments/GLM/JMglm.pdf · – 2-way ANOVA – EVs are easy, but contrasts are trickier • Factor effects – 1-way – 2-way](https://reader035.fdocuments.in/reader035/viewer/2022071417/6115074f6ce18a060e57c952/html5/thumbnails/22.jpg)
1 Way ANOVA - Cell Means
![Page 23: GLM is flexibleweb.mit.edu/fsl_v5.0.10/fsl/doc/wiki/attachments/GLM/JMglm.pdf · – 2-way ANOVA – EVs are easy, but contrasts are trickier • Factor effects – 1-way – 2-way](https://reader035.fdocuments.in/reader035/viewer/2022071417/6115074f6ce18a060e57c952/html5/thumbnails/23.jpg)
1 Way ANOVA - Cell Means
![Page 24: GLM is flexibleweb.mit.edu/fsl_v5.0.10/fsl/doc/wiki/attachments/GLM/JMglm.pdf · – 2-way ANOVA – EVs are easy, but contrasts are trickier • Factor effects – 1-way – 2-way](https://reader035.fdocuments.in/reader035/viewer/2022071417/6115074f6ce18a060e57c952/html5/thumbnails/24.jpg)
1 Way ANOVA - Cell Means
![Page 25: GLM is flexibleweb.mit.edu/fsl_v5.0.10/fsl/doc/wiki/attachments/GLM/JMglm.pdf · – 2-way ANOVA – EVs are easy, but contrasts are trickier • Factor effects – 1-way – 2-way](https://reader035.fdocuments.in/reader035/viewer/2022071417/6115074f6ce18a060e57c952/html5/thumbnails/25.jpg)
• In general – # of regressors for a factor = # levels-1 – Factor with 4 levels
•
1 Way ANOVA - Factor Effects
![Page 26: GLM is flexibleweb.mit.edu/fsl_v5.0.10/fsl/doc/wiki/attachments/GLM/JMglm.pdf · – 2-way ANOVA – EVs are easy, but contrasts are trickier • Factor effects – 1-way – 2-way](https://reader035.fdocuments.in/reader035/viewer/2022071417/6115074f6ce18a060e57c952/html5/thumbnails/26.jpg)
mean
1 Way ANOVA - Factor Effects
![Page 27: GLM is flexibleweb.mit.edu/fsl_v5.0.10/fsl/doc/wiki/attachments/GLM/JMglm.pdf · – 2-way ANOVA – EVs are easy, but contrasts are trickier • Factor effects – 1-way – 2-way](https://reader035.fdocuments.in/reader035/viewer/2022071417/6115074f6ce18a060e57c952/html5/thumbnails/27.jpg)
1 Way ANOVA - Factor Effects
2 3
![Page 28: GLM is flexibleweb.mit.edu/fsl_v5.0.10/fsl/doc/wiki/attachments/GLM/JMglm.pdf · – 2-way ANOVA – EVs are easy, but contrasts are trickier • Factor effects – 1-way – 2-way](https://reader035.fdocuments.in/reader035/viewer/2022071417/6115074f6ce18a060e57c952/html5/thumbnails/28.jpg)
1 Way ANOVA - Factor Effects
![Page 29: GLM is flexibleweb.mit.edu/fsl_v5.0.10/fsl/doc/wiki/attachments/GLM/JMglm.pdf · – 2-way ANOVA – EVs are easy, but contrasts are trickier • Factor effects – 1-way – 2-way](https://reader035.fdocuments.in/reader035/viewer/2022071417/6115074f6ce18a060e57c952/html5/thumbnails/29.jpg)
1 Way ANOVA - Factor Effects
![Page 30: GLM is flexibleweb.mit.edu/fsl_v5.0.10/fsl/doc/wiki/attachments/GLM/JMglm.pdf · – 2-way ANOVA – EVs are easy, but contrasts are trickier • Factor effects – 1-way – 2-way](https://reader035.fdocuments.in/reader035/viewer/2022071417/6115074f6ce18a060e57c952/html5/thumbnails/30.jpg)
1 Way ANOVA - Factor Effects
![Page 31: GLM is flexibleweb.mit.edu/fsl_v5.0.10/fsl/doc/wiki/attachments/GLM/JMglm.pdf · – 2-way ANOVA – EVs are easy, but contrasts are trickier • Factor effects – 1-way – 2-way](https://reader035.fdocuments.in/reader035/viewer/2022071417/6115074f6ce18a060e57c952/html5/thumbnails/31.jpg)
1 Way ANOVA - Factor Effects
![Page 32: GLM is flexibleweb.mit.edu/fsl_v5.0.10/fsl/doc/wiki/attachments/GLM/JMglm.pdf · – 2-way ANOVA – EVs are easy, but contrasts are trickier • Factor effects – 1-way – 2-way](https://reader035.fdocuments.in/reader035/viewer/2022071417/6115074f6ce18a060e57c952/html5/thumbnails/32.jpg)
2 Way ANOVA (3x2)
![Page 33: GLM is flexibleweb.mit.edu/fsl_v5.0.10/fsl/doc/wiki/attachments/GLM/JMglm.pdf · – 2-way ANOVA – EVs are easy, but contrasts are trickier • Factor effects – 1-way – 2-way](https://reader035.fdocuments.in/reader035/viewer/2022071417/6115074f6ce18a060e57c952/html5/thumbnails/33.jpg)
A1
A2
A3
B1 B2
No effect means the marginals would be the same
2 Way ANOVA (3x2)
Null: A1=A2=A3 equivalently A1-A3=0 and A2-A3=0
![Page 34: GLM is flexibleweb.mit.edu/fsl_v5.0.10/fsl/doc/wiki/attachments/GLM/JMglm.pdf · – 2-way ANOVA – EVs are easy, but contrasts are trickier • Factor effects – 1-way – 2-way](https://reader035.fdocuments.in/reader035/viewer/2022071417/6115074f6ce18a060e57c952/html5/thumbnails/34.jpg)
2 Way ANOVA (3x2)
![Page 35: GLM is flexibleweb.mit.edu/fsl_v5.0.10/fsl/doc/wiki/attachments/GLM/JMglm.pdf · – 2-way ANOVA – EVs are easy, but contrasts are trickier • Factor effects – 1-way – 2-way](https://reader035.fdocuments.in/reader035/viewer/2022071417/6115074f6ce18a060e57c952/html5/thumbnails/35.jpg)
2 Way ANOVA (3x2)
![Page 36: GLM is flexibleweb.mit.edu/fsl_v5.0.10/fsl/doc/wiki/attachments/GLM/JMglm.pdf · – 2-way ANOVA – EVs are easy, but contrasts are trickier • Factor effects – 1-way – 2-way](https://reader035.fdocuments.in/reader035/viewer/2022071417/6115074f6ce18a060e57c952/html5/thumbnails/36.jpg)
2 Way ANOVA (3x2)
![Page 37: GLM is flexibleweb.mit.edu/fsl_v5.0.10/fsl/doc/wiki/attachments/GLM/JMglm.pdf · – 2-way ANOVA – EVs are easy, but contrasts are trickier • Factor effects – 1-way – 2-way](https://reader035.fdocuments.in/reader035/viewer/2022071417/6115074f6ce18a060e57c952/html5/thumbnails/37.jpg)
2 Way ANOVA (3x2)
A1
A2
A3
B1 B2
No effect means the lines would be parallel
![Page 38: GLM is flexibleweb.mit.edu/fsl_v5.0.10/fsl/doc/wiki/attachments/GLM/JMglm.pdf · – 2-way ANOVA – EVs are easy, but contrasts are trickier • Factor effects – 1-way – 2-way](https://reader035.fdocuments.in/reader035/viewer/2022071417/6115074f6ce18a060e57c952/html5/thumbnails/38.jpg)
2 Way ANOVA (3x2)
A1
A2
A3
B1 B2
No effect means the lines would be parallel
A1B1-A1B2=A2B1-A2B2=A3B1-A3B2
![Page 39: GLM is flexibleweb.mit.edu/fsl_v5.0.10/fsl/doc/wiki/attachments/GLM/JMglm.pdf · – 2-way ANOVA – EVs are easy, but contrasts are trickier • Factor effects – 1-way – 2-way](https://reader035.fdocuments.in/reader035/viewer/2022071417/6115074f6ce18a060e57c952/html5/thumbnails/39.jpg)
2 Way ANOVA (3x2)
![Page 40: GLM is flexibleweb.mit.edu/fsl_v5.0.10/fsl/doc/wiki/attachments/GLM/JMglm.pdf · – 2-way ANOVA – EVs are easy, but contrasts are trickier • Factor effects – 1-way – 2-way](https://reader035.fdocuments.in/reader035/viewer/2022071417/6115074f6ce18a060e57c952/html5/thumbnails/40.jpg)
• Recall for factor effects, a factor with n levels has regressors set up like
• A has 3 levels, so 2 regressors • B has 2 levels, so 1 regressor
2 Way ANOVA - Factor Effects
![Page 41: GLM is flexibleweb.mit.edu/fsl_v5.0.10/fsl/doc/wiki/attachments/GLM/JMglm.pdf · – 2-way ANOVA – EVs are easy, but contrasts are trickier • Factor effects – 1-way – 2-way](https://reader035.fdocuments.in/reader035/viewer/2022071417/6115074f6ce18a060e57c952/html5/thumbnails/41.jpg)
A B AB
2 Way ANOVA - Factor Effects
![Page 42: GLM is flexibleweb.mit.edu/fsl_v5.0.10/fsl/doc/wiki/attachments/GLM/JMglm.pdf · – 2-way ANOVA – EVs are easy, but contrasts are trickier • Factor effects – 1-way – 2-way](https://reader035.fdocuments.in/reader035/viewer/2022071417/6115074f6ce18a060e57c952/html5/thumbnails/42.jpg)
2 Way ANOVA - Factor Effects
![Page 43: GLM is flexibleweb.mit.edu/fsl_v5.0.10/fsl/doc/wiki/attachments/GLM/JMglm.pdf · – 2-way ANOVA – EVs are easy, but contrasts are trickier • Factor effects – 1-way – 2-way](https://reader035.fdocuments.in/reader035/viewer/2022071417/6115074f6ce18a060e57c952/html5/thumbnails/43.jpg)
2 Way ANOVA - Factor Effects
![Page 44: GLM is flexibleweb.mit.edu/fsl_v5.0.10/fsl/doc/wiki/attachments/GLM/JMglm.pdf · – 2-way ANOVA – EVs are easy, but contrasts are trickier • Factor effects – 1-way – 2-way](https://reader035.fdocuments.in/reader035/viewer/2022071417/6115074f6ce18a060e57c952/html5/thumbnails/44.jpg)
2 Way ANOVA - Factor Effects
![Page 45: GLM is flexibleweb.mit.edu/fsl_v5.0.10/fsl/doc/wiki/attachments/GLM/JMglm.pdf · – 2-way ANOVA – EVs are easy, but contrasts are trickier • Factor effects – 1-way – 2-way](https://reader035.fdocuments.in/reader035/viewer/2022071417/6115074f6ce18a060e57c952/html5/thumbnails/45.jpg)
2 Way ANOVA - Factor Effects
![Page 46: GLM is flexibleweb.mit.edu/fsl_v5.0.10/fsl/doc/wiki/attachments/GLM/JMglm.pdf · – 2-way ANOVA – EVs are easy, but contrasts are trickier • Factor effects – 1-way – 2-way](https://reader035.fdocuments.in/reader035/viewer/2022071417/6115074f6ce18a060e57c952/html5/thumbnails/46.jpg)
2 Way ANOVA - Factor Effects
![Page 47: GLM is flexibleweb.mit.edu/fsl_v5.0.10/fsl/doc/wiki/attachments/GLM/JMglm.pdf · – 2-way ANOVA – EVs are easy, but contrasts are trickier • Factor effects – 1-way – 2-way](https://reader035.fdocuments.in/reader035/viewer/2022071417/6115074f6ce18a060e57c952/html5/thumbnails/47.jpg)
2 Way ANOVA - Factor Effects
![Page 48: GLM is flexibleweb.mit.edu/fsl_v5.0.10/fsl/doc/wiki/attachments/GLM/JMglm.pdf · – 2-way ANOVA – EVs are easy, but contrasts are trickier • Factor effects – 1-way – 2-way](https://reader035.fdocuments.in/reader035/viewer/2022071417/6115074f6ce18a060e57c952/html5/thumbnails/48.jpg)
For more examples
• The FSL folks have a bunch of great examples – http://www.fmrib.ox.ac.uk/fsl/feat5/detail.html
• Check the FSL help list regularly – Subscribe at jiscmail – Often others have already asked your
questions!