Thanks Vadim,

It's good to know that it works fine with multiple regressors (like motion parameters).

I guess xVi.V needs to be estimated using at least one regressor (besides the intercept) during model estimation procedure when AR(1) is turned on. And I'm wondering WHETHER it's statistically wrong to have no regressor (in order to estimate xVi.V) OR it's simply one of many ways that the SPM developers adopted. (Need advise from SPM and stats guru's)

I'm not surprised that the correlation between original Y and the (highpass filtered) residuals was 0.67. Using a quick simulation below, it's obvious that the correlation decreases as the drift increases.

>> Y = normrnd(0,1,[158,1]);
>> Y1 = Y + sin(-pi/2 : 0.02 : pi/2)';
>> plot(Y), hold on; plot(Y1,'r');
>> corr(Y1,Y)

ans =

    0.7364





Joon


On Thu, Jul 23, 2009 at 1:33 PM, Vadim Axel <[log in to unmask]> wrote:
First, the funny thing is that I just encountered the same error as you :)
Second, I can say you that it is related to AR(1) definition. Once you change AR(1) to none in the model definition the model is estimated.
Third, if you plug 6 movement params matrix you are fine with estimating the design with 7 columns (6 movements  + SPM default "1"). This is estimated with AR and high pass filter.
Fourth, the units which I get in my residuals vary something like -1:2, so it far from any hundreds of the original Y intercity. Surprisingly, if was sufficient to make only high pass filter (even without the movements and AR) to get the correlation between original Y and residuals only 0.67. Do you think it makes sense? When I dropped  the high-pass filter ant estimated the model the correlation was "1", so looks like generally the idea works.


On Thu, Jul 23, 2009 at 7:04 PM, Joonkoo Park <[log in to unmask]> wrote:
Just realized that SPM model specification works fine with NO regressors of interest (just intercepts for each session/run), but model estimation throws an error (inner matrix dimensions not matching) near line 466 at spm_spm.m where Hsqr and F-threshold under i.i.d. are computed if xVi.V is not defined. (To be specific, it throws an error near line 754 at spm_FcUtil)

Shouldn't SPM be able to estimate the beta coefficients regardless of the design of the design matrix (whether there are regressors of interest or not). Is there a way to get around this problem?

Thanks!

Joon




On Thu, Jul 23, 2009 at 10:01 AM, cyril pernet <[log in to unmask]> wrote:
Joonkoo Park wrote:
Thanks for the comments Cyril and Vadim,
(I'm posting this thread back on the listserv for those who might be interested.)

First, I would NOT put two columns of ones. If no regressor is specified, SPM automatically includes the intercept, which makes things easy.
that's what I mean -- in the residuals you'll have the mean removed automatically


Second, I understand that a scaling factor is estimated in SPM.xY.VY during model estimation, but I don't understand how exactly this is computed and what it represents besides that it works as a global scaling factor to make the average intensity 100 (default).

In any case, I'm mainly interested in the relative intensity across different TRs over multiple voxels (like temporal correlations), and this is why filtering and AR correction is important. So, for this purpose, I'm thinking that it should not matter how the residuals are scaled? Please correct me if I'm wrong.
agree

c


Joon



On Thu, Jul 23, 2009 at 7:27 AM, Vadim Axel <[log in to unmask] <mailto:[log in to unmask]>> wrote:

   Cyril,
   Consider the simple case that I load my Y as raw data directly
   from my *.nii files. However, in the estimation SPM uses
   SPM.xY.VY, which is not the intensity of the original *.nii data.
   Concequernly, you r would be uncomparable to original Y intensity.
   Isn't it?
   Vadim (not Axel:)


   On Thu, Jul 23, 2009 at 1:28 PM, cyril pernet
   <[log in to unmask] <mailto:[log in to unmask]>> wrote:

       Axel

       not sure to follow here .. as mentioned earlier the residuals
       will be without the mean (or intercept as you want) but they
       are r = Y-Yhat and Yhat = Beta*X with X the matrix with the
       drift and high pass filter  + AR included in the estimation of
       the Beta via the whitening matrix W Betas = inv(X'*W*X)*X'*Y
       (in W there is also a regularization bit --> * c = a very
       small number) -- but what is K? where do you scale?

       c

           Hi guys,

           Indeed very interesting idea. However, I am missing
           something: there is always last "white" column with "1",
           which SPM adds in order that the model will contain
           intercept. So, now we will two one columns like this (the
           first is our regressor). Is it OK?
           In addition, the residiuls which we will get, I believe,
           would be with some scaling factor (K),which SPM apllies.
           So, it would be difficult quantatively to measure to what
           extent the signal have changed at each time point, but
           only to run the correlation between two signals. Correct?

           Thanks,
           Vadim

           On Thu, Jul 23, 2009 at 12:43 PM, cyril pernet
           <[log in to unmask] <mailto:[log in to unmask]>
           <mailto:[log in to unmask]
           <mailto:[log in to unmask]>>> wrote:

              Joonkoo

                  I want to take the "raw signal" and then apply
           detrending
                  (e.g. highpass
                  filtering at 128Hz) and temporal autocorrelation
           correction
                  (e.g. using
                  AR(1) model) just as how ordinary SPM procedure does. I
                  searched for a
                  script or a thread concerning this issue, but
           unfortunately I
                  wasn't able to
                  find a good advice on this.
                  So I came up with one idea which is to use the
           conventional
                  SPM model
                  estimation procedure *without* any regressor
           specified. This
                  way, the model
                  matrix will only include the grand mean (column of
           ones) for
                  each run. The
                  residuals from this estimation should, in theory,
           give me the
                  "highpass
                  filtered" and "temporal autocorrelation corrected"
           which is
                  further mean
                  centered for each run.                 sounds good to me - change in spm_defaults the residual
           number to
              'inf' and in spm_spm comment the bit which actually
           delete the
              residuals from the disk - also in the design matrix you
           can enter
              the txt file from the realignment ; residuals here =
           data with
              variance related to motion removed + filtered as you
           wanted :-)
               (note the filtering is high pass / AR ~ = low pass /
           drift) --
              also the mean will have been removed (that the contant
           term in the
              design matrix)

              Cyril


              --    The University of Edinburgh is a charitable body,
           registered in
              Scotland, with registration number SC005336.




       --        Dr Cyril Pernet,
       fMRI Lead Researcher SINAPSE
       SFC Brain Imaging Research Center
       Division of Clinical Neurosciences
       University of Edinburgh
       Western General Hospital
       Crewe Road
       Edinburgh
       EH4 2XU
       Scotland, UK


       [log in to unmask] <mailto:[log in to unmask]>
       tel: +44(0)1315373661
       http://www.sbirc.ed.ac.uk/cyril
       http://www.sinapse.ac.uk/



       The University of Edinburgh is a charitable body, registered in
       Scotland, with registration number SC005336.





--
Dr Cyril Pernet,
fMRI Lead Researcher SINAPSE
SFC Brain Imaging Research Center
Division of Clinical Neurosciences
University of Edinburgh
Western General Hospital
Crewe Road
Edinburgh
EH4 2XU
Scotland, UK

[log in to unmask]
tel: +44(0)1315373661
http://www.sbirc.ed.ac.uk/cyril
http://www.sinapse.ac.uk/


The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.