Differences between revisions 1 and 2
 Deletions are marked like this. Additions are marked like this. Line 16: Line 16: 1. Analyze each time point of subject in the longitudinal stream (if doing a structural analysis) 1. Analyze each time point of subject in the [[ LongitudinalProcessing | longitudinal stream ]] (if doing a structural analysis)

Author: Doug Greve

This document describes how to perform a repeated measures ANOVA using the FSGD file and mri_glmfit in FreeSurfer. This includes a two time-point longitudinal analysis in which the same subject was scanned twice or more with each scan being run through FreeSurfer separately (using the longitudinal stream). It also includes a cross-over analysis in which each subject of a cohort has a matching subject in another cohort. This is a generalization of the paired analysis (see PairedAnalysis).

# Overall Strategy

1. Analyze each time point of subject in the longitudinal stream (if doing a structural analysis)

2. Sample each time point onto the average surface.
3. Concatenate all time points into one file.
4. Smooth on the surface (optional)
5. Perform analysis with mri_glmfit on this file using DOSS (not DODS)

Steps 2-3 will be performed by one command (mris_preproc), Step 4 by mri_surf2surf, and step 5 by mri_glmfit. A single FSGD file can be used for all steps.

# Create the FSGD File

The FSGD file lists all time points for all subjects. Set up a class for each subject. Declare Ntp-1 variables (where Ntp is the number of time points per subject). For example, if you had 3 time points, you would declare two variables (see below):

```GroupDescriptorFile 1
Class Subject1
Class Subject2
Class Subject3
Variables                    TP1-vs-TP2 TP1-vs-TP3
Input subject1-tp1  Subject1     1          1
Input subject1-tp2  Subject1    -1          0
Input subject1-tp3  Subject1     0         -1
Input subject2-tp1  Subject2     1          1
Input subject2-tp2  Subject2    -1          0
Input subject2-tp3  Subject2     0         -1
Input subject3-tp1  Subject3     1          1
Input subject3-tp2  Subject3    -1          0
Input subject3-tp3  Subject3     0         -1```

Note that you do not need a TP2-vs-TP3 column. If you add such a column, the analysis will fail!

The design matrix that will be created with the DOSS model will be

```     1     0     0     1     1
1     0     0    -1     0
1     0     0     0    -1
0     1     0     1     1
0     1     0    -1     0
0     1     0     0    -1
0     0     1     1     1
0     0     1    -1     0
0     0     1     0    -1```

The matrix has 5 columns. Each of the Ns=3 subjects gets its own column, and each variable (Nv=2) gets its own column for a total of 5. Because of the way it was set up, the 4th column (variable 1) codes for the difference between TP1 and TP2, and the 5th column (variable 2) codes for the difference between TP1 and TP3.

# Create Contrasts

## Contrast 1 (tp1-vs-tp2.mtx)

Null Hypothesis: does the difference between time point 1 and time point 2 differ from 0:

`0 0 0 1 0`

This will be a t-test. Positive values mean that TP1 > TP2.

## Contrast 2 (tp1-vs-tp3.mtx)

Null Hypothesis: does the difference between TP1 and TP3 differ from 0:

`0 0 0 0 1`

This will be a t-test. Positive values mean that TP1 > TP3.

## Contrast 3 (tp2-vs-tp3.mtx)

Null Hypothesis: does the difference between TP2 and TP3 differ from 0:

`0 0 0 -1 1`

This will be a t-test. Positive values mean that TP2 > TP3.

## Contrast 4 (tp-effect.mtx)

Null Hypothesis: Is there an effect of time point?

```0 0 0 1 0
0 0 0 0 1```

This will be a F-test.

## Contrast 4 (mean.mtx)

Null Hypothesis: does the mean across all subjects equal 0 after removing the effect of time point.

`1 1 1 0 0`

This will be a t-test. Positive values indicate the group mean is > 0.

# Run mris_preproc

The mris_preproc command will be:

```  mris_preproc --target fsaverage --hemi lh \
--meas thickness --out lh.thickness.mgh \
--fsgd rmanova.fsgd ```

This peforms Steps 2-3 above, saving the data to lh.thickness.mgh.

# Spatially Smooth (optional)

This just spatially smooths by 5mm FWHM. You would do the same thing on a non-RMANOVA analysis. The output is lh.thickness.sm05.mgh, which is fed to the next stage.

```mri_surf2surf --s fsaverage --hemi lh --fwhm 5\
--sval lh.thickness.mgh \
--tval lh.thickness.sm05.mgh```

# Run mri_glmfit with DOSS

Note the "doss" flag after the fsgd file.

```mri_glmfit
--glmdir lh.rmanova
--y lh.thickness.sm05.mgh
--fsgd rmanova.fsgd doss
--C tp1-vs-tp2.mtx
--C tp1-vs-tp3.mtx
--C tp2-vs-tp3.mtx
--C tp-effect.mtx
--C mean.mtx```

Note: you may have more options than are listed below, depending on your application.

RepeatedMeasuresAnova (last edited 2017-03-28 12:39:43 by 172)