« randpermute | Software | 3dFDR »
3dpc3dpc is a standard AFNI tool for performing Principal Components Analysis (PCA) on 3d+time datasets. It can be used to generate a new dataset consisting of only the components (eigenvectors) contributing the most variance to the data. This can be useful for dimension reduction or noise reduction in SAM sliding window data.
3dpc [options] SlidingWindowData+tlrc
For dimension reduction, folks typically plot the eigenvalues and look for the number of components that contribute most of the variance to the data. Usually the graph will look like a hockey stick, with the corner of the stick indicating the cut-off used for dimension reduction. Use the following command to generate a sorted list of eigenvalues for your data:
3dpc -eigonly SlidingWindowData+tlrc
The following command will generate a new dataset with only the desired number of components included; in this case 3:
3dpc -reduce 3 NewSlidingWindowData SlidingWindowData+tlrc
The individual components can be saved by using the following command:
3dpc -pcsave 3 -prefix TopThreeComponents SlidingWindowData+tlrc
This screenshot shows time series from a sliding window dataset before and after PCA noise reduction. The original time series are on the right for the same voxels.