Print

Print


Dear Guilherme,

Thank you for your enquiry. SPM offers a series of basis sets to
model the hemodynamic response function.
These are assembled by spm_get_bf (excerpt below). One of the reasons
we use Matlab to disseminate
our software is so that people like you can see immediately how
various quantities and computations are
implemented.

In this case, the dispersion derivative is evaluated numerically (see
below) as the derivative of the canonical
form (spm_hrf) w.r.t. its third parameter, where

function [hrf,p] = spm_hrf(RT,P)
% Returns a hemodynamic response function
% FORMAT [hrf,p] = spm_hrf(RT,[p])
% RT   - scan repeat time
% p    - parameters of the response function (two gamma functions)
%
%                                                     defaults
%                                                    (seconds)
%   p(1) - delay of response (relative to onset)         6
%   p(2) - delay of undershoot (relative to onset)      16
%   p(3) - dispersion of response                        1
%   p(4) - dispersion of undershoot                      1
%   p(5) - ratio of response to undershoot               6
%   p(6) - onset (seconds)                               0
%   p(7) - length of kernel (seconds)                   32

I hope this helps,

With very best wishes,

Karl


expect from spm_get_bf.m


% create basis functions
%-----------------------------------------------------------------------
switch xBF.name

     case {'Fourier set','Fourier set (Hanning)'}
     %---------------------------------------------------------------
     pst   = [0:dt:l]';
     pst   = pst/max(pst);

     % hanning window
     %---------------------------------------------------------------
     if strcmp(xBF.name,'Fourier set (Hanning)')
         g  = (1 - cos(2*pi*pst))/2;
     else
         g  = ones(size(pst));
     end

     % zeroth and higher Fourier terms
     %---------------------------------------------------------------
     bf    = g;
     for i = 1:h
         bf = [bf g.*sin(i*2*pi*pst)];
         bf = [bf g.*cos(i*2*pi*pst)];
     end

     case {'Gamma functions'}
     %---------------------------------------------------------------
     pst   = [0:dt:l]';
     bf    = spm_gamma_bf(pst,h);

     case {'Finite Impulse Response'}
     %---------------------------------------------------------------
     bin   = l/h;
     bf    = kron(eye(h),ones(round(bin/dt),1));

     case {'NONE'}
     %---------------------------------------------------------------
     bf = 1;

otherwise

     % canonical hemodynamic response function
     %---------------------------------------------------------------
     [bf p]         = spm_hrf(dt);

     % add time derivative
     %---------------------------------------------------------------
     if findstr(xBF.name,'time')

         dp     = 1;
         p(6)   = p(6) + dp;
         D      = (bf(:,1) - spm_hrf(dt,p))/dp;
         bf     = [bf D(:)];
         p(6)   = p(6) - dp;

         % add dispersion derivative
         %--------------------------------------------------------
         if findstr(xBF.name,'dispersion')

             dp    = 0.01;
             p(3)  = p(3) + dp;
             D     = (bf(:,1) - spm_hrf(dt,p))/dp;
             bf    = [bf D(:)];
         end
     end

     % length and order
     %---------------------------------------------------------------
     xBF.length = size(bf,1)*dt;
     xBF.order  = size(bf,2);

end






At 13:50 04/02/2010, you wrote:
>Dear Mr. Friston,
>I have a concern about how the SPM canonical HRF is implemented in
>SPM and why the dispersion derivative is not clearly explained (the
>time derivative for example is described in "Statistical Parametric
>Mapping: The Analysis of Functional Brain Images", chapter 14, pages
>181-182). I am sorry if this email is verbose, but I want to make my
>point clear.
>The PDF of the gamma distribution impemented in spm_Gpdf.m is:
>               l^h t^(h-1) exp(-lt)
>    f(t;h,l) = --------------------- = gampdf(t,h,1/l), where
>                    gamma(h)
>                       t^(h-1) exp(-t/tau)
>    gampdf(t,h,tau) = ---------------------  (original from Matlab)
>                         gamma(h) tau^h
>Theoretical calculation leads to:
>   Time to peak: (h-1) tau
>   Mean: h tau
>   Variance: h tau^2
>To start the naming confusion, "peak delay" is also used for "mean",
>and "dispersion", for "variance" (for example in page 181, from the
>book above). From Fig. 14.1 of the same book (page 178),
>"dispersion" could also be interpreted as FWHM of the response.
> From spm_Gpdf.m and spm_hrf.m, it can be seen that the SPM canonical HRF is:
>               t^(h/l-1) exp(-t/l)
>hrf(t;h,l) = --------------------- = gampdf(t,h/l,l), where
>               l^(h/l) gamma(h/l)
>h: delay of response (or undershoot)
>l: dispersion of response (or undershoot)
>(from spm_hrf.m)
>SPM estimates the time derivative (d(hrf)/dt) with a step of 1 sec,
>that is d(hrf)/dt ~ ( hrf(t+1;h,l)-hrf(t;h,l) )/1, and the
>dispersion derivative (-d(hrf)/dl) with a step of 0.01, that is (
>hrf(t;h,l) - hrf(t;h,l+0.01) )/0.01.
>My complaint is that it is nowhere clear with respect to which
>variable the dispersion derivative is taken. I believe it is related
>to the fact that "dispersion" is used for both "variance" of the
>gamma distribution and for the variable "l" above in SPM. Moreover
>"peak delay" is used to talk about the "mean", and "delay" is used
>in SPM for the variable "h" above. This issue is not clear in SPM
>neither in textbooks nor in articles.
>To check if I could correctly understand the SPM canonical HRF and
>its partial derivatives, I wrote a simple script, which is attached.
>I hope to receive some comments on this issue.
>Thank you for your attention,
>Guilherme C. Beltramini
>PhD Student
>Physics Department
>State University of Campinas (UNICAMP), Brazil
>
>