Alle Meije Wink wrote:
> Dear SPM experts,
>
> Is there any documentation about how the event-related responses and
> peri-stimulus time histograms are computed? I would like to build
> something similar for data which are not processed in SPM (to compare
> some methods) but the code surrounding it is tricky to read...
>
Hi Alle,
To compute a PSTH you can fit a GLM
that embodies an FIR model for the event
responses.
I have attached a matlab script that shows
you how to do this outside of SPM. Hopefully
you can use relevant parts of the script in your
own code.
Hope this helps.
Best, Will.
> I found in spm_graph.m:
>
> variable meaning
> t time point 0,1,... after each stimulus
> X Sess.bf(t) (...)
> K some filter structure (...)
> KX filter K applied to X
> B parameter estimate beta(j) from the GLM
> Y KX*B (the event-related response)
>
> My guess would be something like: use the first t time points after each
> stimulus, take the mean beta values (that passed the threshold) at those
> time points and filter them with the impulse response.
>
> Not sure what X and K are precisely, though.
>
> I cannot see immediately though, what happens if a. responses overlap
> (you cannot take t time points after a stimulus if some other response
> is already active) or b. multiple basis functions (hrf+derivatives,
> fourier set) are used.
>
> Pointers to documentation on this subject would be very much
> appreciated.
>
> Regards
> Alle Meije Wink
>
> --
>
> Alle Meije Wink
>
> Institute for Mathematics and Computing Science
> University of Groningen
>
> P.O. Box 800 9700 AV Groningen
> Telephone: +31 50 363 71 27 Fax: +31 50 363 38 00
> E-mail: [log in to unmask] WWW: http://www.cs.rug.nl/~wink
>
> Please avoid sending me Word or PowerPoint attachments
> (see http://www.fsf.org/philosophy/no-word-attachments.html)
>
>
>
--
William D. Penny
Wellcome Department of Imaging Neuroscience
University College London
12 Queen Square
London WC1N 3BG
Tel: 020 7833 7478
FAX: 020 7813 1420
Email: [log in to unmask]
URL: http://www.fil.ion.ucl.ac.uk/~wpenny/
% This code creates some 'BOLD' data
% and then estimates the PSTH using an FIR model
% W. Penny, Oct 2003
N=200;
num_events=20;
% Define FIR
bin_width=2; % scans
num_bins=10; % scans
% You'll have 'onsets' already
% - use those, not these.
onsets=randperm(N);
onsets=onsets(1:num_events);
delta_events=zeros(N,1);
delta_events(onsets)=1;
events=conv(delta_events,ones(bin_width,1));
events=events(1:N);
% These are the relevant lines for you
clear X;
X(:,1)=events;
for b=2:num_bins,
X(:,b)=[zeros(bin_width,1); X(1:N-bin_width,b-1)];
end
X=[X ones(N,1)];
figure
imagesc(X);
title('Design matrix for FIR model');
% Create some 'BOLD' data
RT=1;
hrf=spm_hrf(RT);
X_create=conv(delta_events,hrf);
X_create=X_create(1:N);
y=X_create*1.5+0.1*randn(N,1);
figure
plot(y);
title('Data');
% Fit FIR model - these lines also relevant
beta=pinv(X)*y;
figure
bar(RT*bin_width*[1:num_bins],beta(1:num_bins));
title('PSTH');
xlabel('Seconds');
|