mris_glm - performs inter-subject/group averaging and inference on the CorticalSurface by fitting a GeneralLinearModel at each vertex


mris_glm [options]


Flagged Arguments

Raw Data Input Options

--fsgd fname

FreeSurfer Group Descriptor File

--design fname

name of design matrix (ascii)

--surfmeas name

input file or name of surface measure

--i input1 input2 ...>

input file list

--frame M

use 0-based Mth frame (default is 0)

--hemi hemi

hemisphere (lh or rh)

--trgsubj subject

target subject

--icoorder order

order of icosahedral tesselation (default 7)

--nsmooth N

number of smoothing iterations

Processed Data Input Options

--beta_in name <fmt>

parameter estimates from previous

--var_in name <fmt>

reserr var from previous

Estimation Outputs

--y name <fmt>

input data after resampling and smoothing

--beta name <fmt>

parameter estimates

--var name <fmt>

variance of residual error

--yhat name <fmt>

signal estimate

--eres name <fmt>

residual error

--xmat matfile

save design matrix in matlab4 format

Group Contrast Outputs

--contrast fname

file containing group contrast matrix (ascii)

--gcv c1 ... cN

group contrast vector specified on cmdline (see MrisGlmGroupContrastVectorHelp

--ces name <fmt>

contrast effect size

--t name <fmt>

t-ratio of contrast

--sigt name <fmt>

signficance of t-ratio (ie, t-Test)





mris_glm performs inter-subject/group averaging and inference on the surface by fitting a GLM model at each vertex. The model consists of subject parameters (eg, age, gender, etc). The model is the same across all vertices, though the fit may be (will be) different. The user must supply a matrix that represents the GLM. While estimation and inference can be performed in a single call to mris_glm, the tasks can also be separated, which can be much more convenient. Inferences are not corrected for multiple comparisons.

Mathematical Background

The forward model is given by:

where X is the Ns-by-Nb design matrix, y is the Ns-by-Nv raw data set, This is performed at each vertex, the result of which can be saved with the --beta flag.

The signal estimate (which can be saved with --yhat) is computed as

The residual error (which can be saved with --eres) is computed as

The noise variance estimate (computed for each vertex) is computed as the sum of the squares of the residual error divided by the DOF. The DOF equals the number of rows of X minus the number of columns. The noise variance can be saved with --var.

A contrast vector C has as many elements as columns of X. The contrast effect size (--ces) is then computed as:

The t-ratio (--t) for the contrast is then given by:

The signifiance of the t-ratio (based on a double-sided t-test and uncorrected for multiple comparisons) can be saved with the --sigt flag.


Example 1 (Estimation Step)

mris_glm --surfmeas $meas --hemi $hemi --trgsubj $trgt --fsgd $fsdf $slp --beta ./beta${sufx} bfloat --var ./var${sufx}.w paint --y ./y${sufx}_000.bfloat --nsmooth $sm

In this example, $meas might be thickness, $hemi rh or lh, $trgt would be the average subject to paint on, $fsdf the group descriptor file, $slp would be DODS or DOSS, $sufx some combination of the other variables to tag your output file, and $sm your predetermined smoothing kernal.

Example 2 (Inference Step)

Additional Examples

1. Analyze thickness maps based on gender and age for 5 hypothetical subjects: subj1 (m, 22) , subj2 (m, 57), subj3 (f, 33), subj4 (f, 65), subj5 (m, 27). The design matrix would look something like:

The first column is the name of the subject as it appears in the FreeSurfer SubjectsDir. The second and third columns categorically code gender (first column male, second column female). The last column codes age. Assume this matrix is stored in a file called genage.mtx

This will read the thickness maps for each of the subjects, smooth it with 50 iterations of nearest-neighbor smoothing, resample to the fsaverage subject and save the regression coeffients and noise variance, both in bfloat format No inference was performed.

2. Test the data in Example 1 for an effect of age:

3. Test the data in Example 1 for a difference between males and females with age regressed out:

4. Perform the same analysis as done in Example 1, but use values that have been painted onto the surface of each subject (this could have come from an fMRI analysis):

5. Perform a paired t-test for two time point data.

Let say you have four subjects, each with two visits, so 8 data sets total. Create the following FSGD file:



Title PairedT

Class S1

Class S2

Class S3

Class S4

Variables Visit

Input s1_v1 S1 +1

Input s1_v2 S1 -1

Input s2_v1 S2 +1

Input s2_v2 S2 -1

Input s3_v1 S3 +1

Input s3_v2 S3 -1

Input s4_v1 S4 +1

Input s4_v2 S4 -1

This creates a class for each subject, and the variable "Visit" is either +1 (for visit 1) or -1 (for visit 2).

Run mris_glm:

mris_glm --fsgd fsgd.txt doss --surfmeas thickness --hemi lh

This will create a design matrix that looks like

1 0 0 0 1

1 0 0 0 -1

0 1 0 0 1

0 1 0 0 -1

0 0 1 0 1

0 0 1 0 -1

0 0 0 1 1

0 0 0 1 -1

The first four columns code the subject. The last column codes the visit difference. To test the difference, use --gcv 0 0 0 0 1. Note that the number of 0s in the contrast vector before the 1 equals the number of subjects.


No correction for MultipleComparisons.

See Also

othercommand1, othercommand2



Methods Description




Reporting Bugs

Report bugs to <>



mris_glm (last edited 2008-04-29 11:45:15 by localhost)