Detecting and Adjusting for Artifacts
in fMRI Time Series Data
The idea is simple: When we apply a linear model to imaging data, we are left with the residuals for each image (see images in red area). These residuals are only temporally saved in SPM. To summarize the residuals, they are squared and summed up over the whole timeseries. This results in the ResMS image (lower row) that reflects the variance estimate for each voxel. To detect artifacts, we propose to simply reverse the direction of summation: When adding up the squared residuals over the whole volume for each individual time point (right column), a residual-mean-square estimate for each image in the time-series will result.
This simple diagnostic can reveal images that are impacted by noise, for example noise caused by head motion. One function of the toolbox is to calculate this residual-mean-square time series during model estimation and to provide a diagnostic tool for plotting this together with the movement parameters. Thus, the toolbox can be used to do the classical estimation procedure (AR or iid model) and just adds a useful diagnostic tool.
When noise-artifacts are found in the data, the question arises of how to exclude those images. For example, images could be excluded based on an arbitrary threshold. We propose here use the statistically optimal approach: we can make use of the variance estimate for each image to weight each observation with the inverse of its variance. This leads to a "soft"-exclusion of images, the higher the variance of the image is, the less it will impact the results.
This approach has one problem: the residual-mean-square is not a unbiased estimate of the noise variance of each image. Rather, this measure is heavily influenced by the design matrix X. We therefore developed a Restricted Maximum Likelihood approach to obtain unbiased estimates of image variance, which then can be used weight the observations. Details on this approach can be found in Diedrichsen & Shadmehr (2005).
Here a real example. It stems from a study with arm movements, using a bite bar for head stabilization. The particular participant started loosening his bite around TR 680, and consequently rotated his head slightly with every single arm movement. We used the rWLS approach to analyze the data.
In the first pass the algorithm estimated the noise variance of each image. Images that were taken while the head rotated showed an increase in noise variance by up to factor 9 (note that the SD of the images is plotted). The first image of each scan (black lines) also showed strongly increase noise variance.
Instead of excluding "bad" images, rWLS uses the factor 1/variance to weight the images in the second pass through the data. The last graph shows the mean squared residual for each image, after the weighting has been applied. Now the residual time series is homogenous, and we have obtained optimal model estimates from our (unfortunately) noisy data.
- System requirements: Matlab 6.5 and above, SPM8 or SPM12
- To download the toolbox register here.
- Unzip the archive and place rwls folder in the <SPM_HOME>/toolbox/ directory.
- Start Matlab and SPM. WLS should now appear as a option under the toolbox menu.
How do I use this method?
- Instructions for the SPM2-version (2.1).
- Instructions for the SPM5-version (2.1).
- Instructions for the SPM8-version (3.1).
- Instructions for the SPM12-version (4.0).
How do I cite this method?
When you use this method in your image analysis, please cite the article:
Diedrichsen, J., & Shadmehr, R. (2005). Detecting and adjusting for artifacts in fMRI time series data. Neuroimage, 27(3), 624-634.
RobustWLS gives me negative variance estimates.
The new version (3.0) estimates the parameters in log-space, thereby ensuring positive-definite variance estimates (we should have done this all along!). This solves previous problems with instabilities in the estimation of parameters. Version 2.1 may still give unstable parameter estimates.
Can I call the function from the command-line?The functions spm_rwls_fmri_spm_ui, spm_rwls_spm, and spm_rwls_resstats can also be called from the command-line in matlab. Use help <function name> to determine the possible parameters.
Can I use WLS in the second-level analysis?
Theoretically, yes. However, we have only tested the assumptions of the model (multiplicative noise model, global distribution of artifacts), for fMRI-timeseries data, i.e., for unsmoothed data on the first level. Noisy images on the second level (i.e. noisy participants) may be characterized by different features. For example, could individual participants be outliers in respect to their activations in motor cortex, but could show normal results in the cerebellum? An alternative robust method that may be useful for second level analysis, has been developed by Tor Wager (Wager, Kelley, Lacey, & Jonides, 2005, Neuroimage).
History of Versions.
- 19/08/06: v.2.0
- SPM5 version published
- added the option for using different images in the first pass such that the WLS (hyper)parameters can be estimated on unsmoothed data, whereas the parameter are estimated on smoothed data.
- 17/06/07: v.2.1:
- Addressed complex data problem
- Included a number of safety checks on convergence of ReML. It gives and error message on non-convergence, negative variance estimates
- prints the condition number of the Fisher matrix in the last iteration as a check & warns.
- 19/05/10: v.3.0:
- Compatible with job manager for SPM8
- Uses now lognormal priors to estimate parameters to ensure positive-definite results.
- wlsAR option removed as stable results cannot be guaranteed.
- 29/03/12: v.3.1
- Fixed bug that prevented "other regressors" to be handled correctly
- 12/12/15: v.4.0
- Compatibility with new SPM 12 (Rev 6470 and later).