The only thing I can see that you're leaving out is the filtering of the data. If you did high-pass filtering, then the time series will contain slow drifts, but the fitted response won't, so the fit will look poorer than it actually is.
[Minor programming note: you can avoid loops like "for each row of X" by using appropriate matrix algebra and matlab syntax.]
If you google
spm "fitted response"
you get e.g.
http://www.fil.ion.ucl.ac.uk/spm/doc/manual/results.htm
which describes briefly how to display fitted responses.
|