Removing Non-linear Trends: Difference between revisions

From CCN Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
 
(14 intermediate revisions by 2 users not shown)
Line 1: Line 1:
Though a script exists to use FreeSurfer's tools to remove linear trends as it extracts the time course data, non-linear trends may lurk in the data.
Though a script exists to use FreeSurfer's tools to remove linear trends as it extracts the time course data, non-linear trends may lurk in the data. Note that these nonlinear trends may be an artefact of field inhomogeneity in the initial volumes of the scan. I have looked at the same data with the initial volumes retained and discarded prior to preprocessing. When Freesurfer detrends data that includes these initial volumes, a nonlinear trend may be apparent in the data. When these volumes are eliminated from the data prior to preprocessing, the data did not contain these nonlinear trends.


[[File:NL_Detrending.png]]
[[File:Nl_detrending.png ]]


This might be problematic for some analyses. Fortunately, nonlinear trends can be removed from the data once it's been loaded into MATLAB, before any further processing (e.g., normalizing, etc.) is done to it.
This might be problematic for some analyses. Fortunately, nonlinear trends can be removed from the data once it's been loaded into MATLAB, before any further processing (e.g., normalizing, etc.) is done to it.


Assume you have a cell array of matrices, '''''M''''', which was generated by the <code>loadFSTS</code> function.
Assume you have a cell array of matrices, '''''M''''', which was generated by the <code>loadFSTS</code> function. A MATLAB function, <code>NLDetrendFSTS</code> has been written that takes '''''M''''' as an input, and calculates the mean intensity vector for each of the constituent matrices. A polynomial function (using 6 parameters, if that matters to you) is used to calculate the polynomial trendline of best fit for this mean time series vector. This trendline is subtracted from each of the columns of each matrix '''''M''''', to produce a new detrended matrix, '''''dtM'''''. A figure is produced, showing each of the matrices in '''''M''''', both before and after detrending. An additional parameter, ''droprows'', is used to first remove any data points from '''''M''''' before calculating the trendline. This will typically be done if the time series includes samples that you wish to remove from the analyses (e.g., an fMRI data set where the first several volumes include field inhomogeneities). The vector, ''droprows'', contains only integers, and is indexed from the start (for positive numbers) and from the end (for values less than one). This is the same scheme used in <code>normalizeMatrix</code>.
 
'''Note that if rows are dropped here, you should not drop them again when applying <code>normalizeMatrix</code>!'''
 
The example below drops the first four rows (1 2 3 4) and the row -1 and 0 from the end (-1 0); i.e., the last two rows:
droprows=[-1 0 1 2 3 4];
dtM=NLDetrendFSTS(M, droprows);
 
== Global Mean Regression ==
Removing the global mean signal was considered as a data cleaning step, however a  [https://www.ncbi.nlm.nih.gov/pmc/articles/PMC2750906/ 2008 NeuroImage paper by Murphy et al.] argues that this step introduces spurious anticorrelations, and so is not done on our data.

Latest revision as of 14:28, 10 July 2017

Though a script exists to use FreeSurfer's tools to remove linear trends as it extracts the time course data, non-linear trends may lurk in the data. Note that these nonlinear trends may be an artefact of field inhomogeneity in the initial volumes of the scan. I have looked at the same data with the initial volumes retained and discarded prior to preprocessing. When Freesurfer detrends data that includes these initial volumes, a nonlinear trend may be apparent in the data. When these volumes are eliminated from the data prior to preprocessing, the data did not contain these nonlinear trends.

Nl detrending.png

This might be problematic for some analyses. Fortunately, nonlinear trends can be removed from the data once it's been loaded into MATLAB, before any further processing (e.g., normalizing, etc.) is done to it.

Assume you have a cell array of matrices, M, which was generated by the loadFSTS function. A MATLAB function, NLDetrendFSTS has been written that takes M as an input, and calculates the mean intensity vector for each of the constituent matrices. A polynomial function (using 6 parameters, if that matters to you) is used to calculate the polynomial trendline of best fit for this mean time series vector. This trendline is subtracted from each of the columns of each matrix M, to produce a new detrended matrix, dtM. A figure is produced, showing each of the matrices in M, both before and after detrending. An additional parameter, droprows, is used to first remove any data points from M before calculating the trendline. This will typically be done if the time series includes samples that you wish to remove from the analyses (e.g., an fMRI data set where the first several volumes include field inhomogeneities). The vector, droprows, contains only integers, and is indexed from the start (for positive numbers) and from the end (for values less than one). This is the same scheme used in normalizeMatrix.

Note that if rows are dropped here, you should not drop them again when applying normalizeMatrix!

The example below drops the first four rows (1 2 3 4) and the row -1 and 0 from the end (-1 0); i.e., the last two rows:

droprows=[-1 0 1 2 3 4]; 
dtM=NLDetrendFSTS(M, droprows);

Global Mean Regression

Removing the global mean signal was considered as a data cleaning step, however a 2008 NeuroImage paper by Murphy et al. argues that this step introduces spurious anticorrelations, and so is not done on our data.