Differences between revisions 6 and 22 (spanning 16 versions)
Revision 6 as of 2012-11-09 17:24:22
Size: 4099
Editor: jbernal
Comment:
Revision 22 as of 2012-12-04 22:30:43
Size: 3780
Editor: MartinReuter
Comment:
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
#acl LcnGroup:read,write,delete,revert All: #acl LcnGroup:read,write,delete,revert All:read
Line 4: Line 4:
LME Matlab tools. Author: Jorge Luis Bernal Rusiel, 2012. jbernal@nmr.mgh.harvard.edu or jbernal0019@yahoo.es
Line 6: Line 5:
If you use these tools in your analysis please cite: This page describes ways of analyzing longitudinal data after processing it using the [[ LongitudinalProcessing | longitudinal stream ]] in Freesurfer.
Line 8: Line 7:
Bernal-Rusiel J.L., Greve D.N., Reuter M., Fischl B., Sabuncu M.R., 2012. Statistical Analysis of Longitudinal Neuroimage Data with Linear Mixed Effects Models, NeuroImage, doi:10.1016/j.neuroimage.2012.10.065.

These Matlab tools are freely distributed and intended to help neuroimaging researchers when analysing longitudinal neuroimaging (LNI) data. The statistical analysis of such type of data is arguable more challenging than the cross-sectional or time series data traditionally encountered in the neuroimaging field. This is because the timing associated with the measurement occasions and the underlying biological process under study are not usually under full experimental control.

There are two aspects of longitudinal data that require correct modeling: The mean response over time and the covariance among repeated measures on the same individual. I hope these tools can serve for such modeling purpose as they provide functionality for exploratory data visualization, model specification, model selection, parameter estimation, inference and power analysis including sample size estimation. They are specially targeted to be used with Freesurfer's data but can be used with any other data as long as they are loaded into Matlab and put into the appropriate format. Here are some recommendations about how to use these tools.
Longitudinal data is different from cross sectional data, as repeated measures are correlated within each subject. A statistical analysis should consider this correlation.
Line 15: Line 10:
<<TableOfContents>> Freesurfer currently comes with (at least) three different frameworks for the analysis of longitudinal data:
Line 17: Line 12:
 1. Simplified repeated measures ANOVA (ignores correlation)
 2. Direct analysis of atrophy rates or percent changes (avoids treatment of correlation)
 3. Linear mixed effects models (considers correlation) <-- recommended, but more complex
Line 18: Line 16:
== Simplified Repeated Measures ANOVA ==
Line 19: Line 18:
== Preparing your data ==
There are two types of analyses that can be done: univariate and mass-univariate. The first step is to load your data into Matlab. If you are working with Freesurfer then univariate data (eg. Hippocampus volume) can be loaded using Qdec tables. There are, under the Qdec directory, some simple example scripts for reading and writing Freesurfer's Qdec tables.
This method can be used to check for differences between individual time points or compare time point differences across groups. This simple version, however, does NOT consider the correlation of the repeated measures! It is not a true repeated measure ANOVA. For two time points it simplifies to a [[ PairedAnalysis ]].
Line 22: Line 20:
In order to read mass-univariate data you should use the following scripts: For details see: [[ RepeatedMeasuresAnova ]]
Line 24: Line 22:
fs_read_label.m
fs_read_surf.m
fs_read_Y.m
== Analysis of Rates or Percent Changes ==
Line 28: Line 24:
The last two depend on Freesurfer's scripts so you need to have installed Freesurfer software package and included the Freesurfer's matlab subdirectory in the Matlab's search path. To analyze, e.g. anualzied percent change or atropy rates for 2 or more time points, one can run a two stage model. This avoids dealing with the longitudinal correlation. The two stages are:
 * first, simplify the statistic to a single number for each subject (the difference of two time points, or the slope of the fitting line, or the annualized percent change, etc.)
 * then analyze the obtained measure across subjects or groups with a standard GLM.
This can be done both for individual ROI stats (aseg or aparc.stats) or for thickness maps on the cortex. This model is quite simple and can be a good choice if all subjects have the same number of time points. The time points can be differently spaced, this is compensated by the time variable. Linear fits into each subject data are often meaningful, as longitudinal change is almost linear within a short time frame of a few years. The second stage can make use of different multiple comparison methods available in mri_glmfit. For the simple case of two time points and when looking at simple differences this model simplifies to the PairedAnalysis, but can additionally compute (symmetrized) percent changes and adjust for different time intervals.
A disadvantage of this model is, that it does not consider that slopes of subjects with only a few time points are not as reliable as the ones obtained from subjects with many time points. The linear mixed effects model overcomes this limitation and should be used if subjects have differently many time points (or for more complex modeling).
Line 30: Line 30:
Previously, the mass-univariate data is generated in Freesurfer by running variants of the following commands: For details see: [[ LongitudinalTwoStageModel ]]
Line 32: Line 32:
mris_preproc --qdec qdec.table.dat --target study_average --hemi lh --meas thickness --out lh.thickness.mgh (assembles your thickness data into a single lh.thickness.mgh file) == Linear Mixed Effects Model ==
Line 34: Line 34:
mri_surf2surf --hemi lh --s study_average --sval lh.thickness.mgh --tval lh.thickness_sm10.mgh --fwhm-trg 10 --cortex --noreshape (smooths the cortical thickness maps with FWHM=10 mm. Note the --cortex and --noreshape options) A Linear Mixed Effects (LME) model is the most powerful approach and can deal well with differently many time points. Even subjects with only a single time point can be included into these models (make sure they also run through the longitudinal stream, available with version FS 5.2, to avoid a bias due to different processing). LMEs consider the temporal correlation and works for stats (univariate) or surface analysis (mass-univariate). Our mass-univariate method can deal very well with the spacial correlation of measures on the cortex and is very fast by working with spacial regions. Furthermore, LMEs can be used to model more complex longitudinal behavior (e.g. quadratic, or piecewise linear trajectories) and time-varying covariates. Currently our implementation is in Matlab and only offers FDR for multiple comparision correction.
Line 36: Line 36:
Then you can load the cortical thickness data lh.thickness_sm10.mgh into Matlab using

fs_read_Y.m
eg. [Y,mri] = fs_read_Y('lh.thickness_sm10.mgh');

You should also read the spherical surface (lh.sphere) and cortex label (lh.cortex.label) of study_average.

eg. lhsphere = fs_read_surf('$FsDir/freesurfer/subjects/fsaverage/surf/lh.sphere');
    lhcortex = fs_read_label('$FsDir/freesurfer/subjects/fsaverage/label/lh.cortex.label');

Once you have your data in Matlab you need to build your design matrix. For computational efficiency reasons, these tools require the data ordered according to time for each individual (that is, your design matrix needs to have all the repeated assessments for the first subject, then all for the second and so on). You can use the script:

sortData

For example, if you have your covariates in a Qdec table then you can use the following code

eg. Qdec = fReadQdec('qdec.table.dat');
    Qdec = rmQdecCol(Qdec,1);
    sids = Qdec(:,1);
    Qdec = rmQdecCol(Qdec,1);
    M = Qdec2num(Qdec);
    [M,Y,ni] = sortData(M,2,Y,sids);

== Model specification ==
== Parameter estimation ==
== Model selection ==
== Inference ==
== Power analysis ==
== Example data analyses ==
For details see: [[ LinearMixedEffectsModels ]]

Longitudinal Statistics

This page describes ways of analyzing longitudinal data after processing it using the longitudinal stream in Freesurfer.

Longitudinal data is different from cross sectional data, as repeated measures are correlated within each subject. A statistical analysis should consider this correlation.

Freesurfer currently comes with (at least) three different frameworks for the analysis of longitudinal data:

  1. Simplified repeated measures ANOVA (ignores correlation)
  2. Direct analysis of atrophy rates or percent changes (avoids treatment of correlation)
  3. Linear mixed effects models (considers correlation) <-- recommended, but more complex

Simplified Repeated Measures ANOVA

This method can be used to check for differences between individual time points or compare time point differences across groups. This simple version, however, does NOT consider the correlation of the repeated measures! It is not a true repeated measure ANOVA. For two time points it simplifies to a PairedAnalysis.

For details see: RepeatedMeasuresAnova

Analysis of Rates or Percent Changes

To analyze, e.g. anualzied percent change or atropy rates for 2 or more time points, one can run a two stage model. This avoids dealing with the longitudinal correlation. The two stages are:

  • first, simplify the statistic to a single number for each subject (the difference of two time points, or the slope of the fitting line, or the annualized percent change, etc.)
  • then analyze the obtained measure across subjects or groups with a standard GLM.

This can be done both for individual ROI stats (aseg or aparc.stats) or for thickness maps on the cortex. This model is quite simple and can be a good choice if all subjects have the same number of time points. The time points can be differently spaced, this is compensated by the time variable. Linear fits into each subject data are often meaningful, as longitudinal change is almost linear within a short time frame of a few years. The second stage can make use of different multiple comparison methods available in mri_glmfit. For the simple case of two time points and when looking at simple differences this model simplifies to the PairedAnalysis, but can additionally compute (symmetrized) percent changes and adjust for different time intervals. A disadvantage of this model is, that it does not consider that slopes of subjects with only a few time points are not as reliable as the ones obtained from subjects with many time points. The linear mixed effects model overcomes this limitation and should be used if subjects have differently many time points (or for more complex modeling).

For details see: LongitudinalTwoStageModel

Linear Mixed Effects Model

A Linear Mixed Effects (LME) model is the most powerful approach and can deal well with differently many time points. Even subjects with only a single time point can be included into these models (make sure they also run through the longitudinal stream, available with version FS 5.2, to avoid a bias due to different processing). LMEs consider the temporal correlation and works for stats (univariate) or surface analysis (mass-univariate). Our mass-univariate method can deal very well with the spacial correlation of measures on the cortex and is very fast by working with spacial regions. Furthermore, LMEs can be used to model more complex longitudinal behavior (e.g. quadratic, or piecewise linear trajectories) and time-varying covariates. Currently our implementation is in Matlab and only offers FDR for multiple comparision correction.

For details see: LinearMixedEffectsModels

LongitudinalStatistics (last edited 2018-07-25 12:06:32 by MorganFogarty)