0001 function r = residuals(D)
0002
0003
0004
0005
0006 if ~is_mars_estimated(D)
0007 error('Need estimated model');
0008 end
0009 Y = get_data(D);
0010 if ~is_summarized(Y)
0011 Y = resummarize(Y);
0012 end
0013 if ~is_summarized(Y)
0014 error('Cannot get summarized data from model data');
0015 end
0016 y = summary_data(Y);
0017
0018 if is_fmri(D)
0019 if ~has_filter(D)
0020 error('FMRI design lacks filter');
0021 end
0022 y = apply_filter(D, y);
0023 end
0024
0025 SPM = des_struct(D);
0026 r = marsy(spm_sp('r',SPM.xX.xKXs,y), ...
0027 region_name(Y), ...
0028 struct('info', summary_info(Y),...
0029 'descrip', ['Residuals for ' summary_descrip(Y)],...
0030 'block_rows', {block_rows(D)}));
0031
0032
0033