Todd,
> To find the estimated image values using the design matrix (Yest):
> I take the design matrix in SPM.xX.X and multiply it by the beta
> values (put in a matrix) that are retrieved from the beta_**.img files.
Almost. You need to multiply the beta_**.img files by the high-pass
filtered design matrix that can be found in SPM.xX.xKXs.X
> To find the actual image values (those that are measured during the
> fMRI scan) that are compared with the estimated values (Yest) to find
> the residuals: I retrieve the image values from the images that are
> already preprocessed and put into SPM5 for a 1st level analysis and
> multiply them by the global scaling factor SPM.xGX.gSF(1).
Almost again. you will need to multiply the measured image values by
SPM.xGX.gSF(1) as you have already pointed out but then you also need
to high-pass filter each time-series. This can be accomplished with
the following code:
yh = spm_filter( SPM.xX.K.X0 , SPM.xGX.gSF(1)*yactual);
> I then subtract Yactual - Yest to get the residuals.
The residuals in ResI_*.img are thus:
res = spm_filter( SPM.xX.K.X0 , SPM.xGX.gSF(1)*yactual ) -
SPM.xX.xKXs.X*beta_**;
Remark: the above is only true for OLS, i.e., no serial correlations.
If you have chosen to correct for serial correlations then the
residuals are given by:
res = spm_filter( SPM.xX.K.X0 , W*SPM.xGX.gSF(1)*yactual ) -
spm_filter( SPM.xX.K.X0 , W*SPM.xX.X)*beta_**;
-Brian
On 9/21/07, Todd Penney <[log in to unmask]> wrote:
> Hello All,
>
> I am trying to manually calculate the residuals and compare them
> with the values in the ResI.img image files to ensure that I am using
> the correct image values for some calculations I am doing.
>
> My approach is this:
>
> To find the estimated image values using the design matrix (Yest):
> I take the design matrix in SPM.xX.X and multiply it by the beta
> values (put in a matrix) that are retrieved from the beta_**.img files.
>
> To find the actual image values (those that are measured during the
> fMRI scan) that are compared with the estimated values (Yest) to find
> the residuals: I retrieve the image values from the images that are
> already preprocessed and put into SPM5 for a 1st level analysis and
> multiply them by the global scaling factor SPM.xGX.gSF(1).
>
> I then subtract Yactual - Yest to get the residuals.
>
> Unfortunately, the residuals I calculate do not match the residuals
> in the ResI.img files. Does anyone know what I am missing? I am not
> using a custom W matrix and I am aware that the values in both Yactual
> and Yest need DCT filtering but this will not solve the problem.
> Suggestions?
>
> Thank you.
>
> Todd Penney
>
|