Todd, My question is are the values contained in the output ResMS.img files scaled and by what value? Yes, they are scaled by (1/ effective degrees of freedom) = (1/trRV) = (1/SPM.xX.X) I want to retrieve just the raw residual sum of squares values and I imagine they are in the ResMS files either multiplied by a scale factor or not. Note: By raw residual sum of squares I mean ResSS = (Y(actual image values) - Y(estimated image values)) or i.e. the sum(residuals^2)) The following generates the actual ResSS. From your stats directory run this code: ---------------------------------------------------------------------------------------------------------- load SPM.mat trRV = SPM.xX.trRV; V = spm_vol('ResMS.img'); ResMS = spm_read_vols(V); ResSS = ResMS .* trRV; P.fname = 'ResSS.img'; P.mat = V.mat; P.dt = V.dt; P.dim = V.dim; P.pinfo = [1 0 0]'; P = spm_create_vol(P); for i=1:P.dim(3) spm_write_plane( P , ResSS( : , : , i ) , i ); end ----------------------------------------------------------------------------------- Good luck, Brian On 9/20/07, Todd Penney <[log in to unmask]> wrote: > > Hello all, > > I ran a t-test statistical analysis on some fMRI data and I need > the ResMS image files as part of my study. > > When reading spm_spm.m file to find out how the mean squared error > (ResMS) is calculated, there is mention of a scale factor in 2 places. > One of the comments says the ResMS values written to the ResMS.hdr > files are scaled by the effective degrees of freedom. At another > comment further down, it mentions that the scale factor , > 1/effective-degrees-of-freedom, is written into the [struct].pinfo(1) > variable. > > My question is are the values contained in the output ResMS.img > files scaled and by what value? I want to retrieve just the raw > residual sum of squares values and I imagine they are in the ResMS > files either multiplied by a scale factor or not. Note: By raw > residual sum of squares I mean ResSS = (Y(actual image values) - > Y(estimated image values)) or i.e. the sum(residuals^2)) > > Thank you. > > Sincerely, > > Todd Penney >