Using vbmakeresid
From VoxBoWiki
vbmakeresid creates a 4D residual volume either for all the data in your GLM or for a specified number of time points. It does so by multiplying the stored R matrix (so-called residual forming matrix) by KG (your filtered data). It's a little slow, so residual volumes are usually calculated on-the-fly while the GLM is being solved. But this program will do it too. Here's the help text:
VoxBo vbmakeresid (v1.8.2/Jun 9 2006) summary: produces a residual volume for a GLM directory usage: vbmakeresid <glm stem> <outfile> flags: -n <num> number of residuals to collect, evenly spaced if needed -h help -v version
