Skip to content

AFNI and NIfTI Server for NIMH/NIH/PHS/DHHS/USA/Earth

Sections
Personal tools
You are here: Home » SSCC » gangc's Home » How to contruct matrices for main effects and interactions in 3dDeconvolve

How to contruct matrices for main effects and interactions in 3dDeconvolve

Document Actions

Mathematically speaking there are infinite matrices for one specific effect testing. Here we provide one systematic approach to constructing matrices for main effects and interactions which can be used to set up general linear testing with -glt or -gltsym in 3dDeconvolve.

Using a 3x3 design as an example, we first contruct common effect vectors for all the factors, A and B in this case. The number of elements in the vectors corresponds to the number of levels for this factor:

A1 = [1 1 1]
B1 = [1 1 1]

Then define differential effects for all the factors. The number of columns in the matrices corresponds to the number of levels for this factor, and the number of rows equals to the number of levels for this factor minus 1. It's intuitive to interpret those 1's, -1's, and 0s in the matrices.

A2 =
[1 -1 0
 0 1 -1]

B2 =
[1 -1 0
 0 1 -1]

The main effects and interaction for A and B are the Kronecker products. ⊗ is the Kronecker product in mathematical notation.

A main effect
A2 ⊗ B1 =
[1 1 1 -1 -1 -1 0 0 0
 0 0 0 1 1 1 -1 -1 -1]

B main effect
A1 ⊗ B2=
[1 -1 0 1 -1 0 1 -1 0
 0 1 -1 0 1 -1 0 1 -1]

Interaction
A2 ⊗ B2 =
[1 -1 0 -1 1 0 0 0 0
 0 1 -1 0 -1 1 0 0 0
 0 0 0 1 -1 0 -1 1 0
 0 0 0 0 1 -1 0 -1 1]

The function kron() in Matlab can be used to calculate the above matrices if you are familar with the Kronecker operation.

Created by Gang Chen
Last modified 2007-12-26 21:00
 

Powered by Plone

This site conforms to the following standards: