Ben,
This is actually hard-coded into SPM.
The grand mean is set by "SPM.xGX.GM = GM;" If we trace back up the
code (see below), GM is hard-coded as 100. You could change this, but
other users might be annoyed if its a shared copy. Now that we know
how this field is set, you can look at why it has no effect.
(1) gSF = GM./g;
(2) SPM.xY.VY(i).pinfo(1:2,:) = SPM.xY.VY(i).pinfo(1:2,:)*gSF(i);
(1) sets the scaling factor based on GM (100) and g (the mean of the data)
(2) Applies the scaling factor to the header of the data and stores
the transform in the SPM.mat file
When you run spm_spm, the program does not read the header and then
read the data; but rather reads in the data based on the header of
data specified in the SPM.mat file. This is why there is no effect of
changing SPM.xG.GM after spm_fmri_spm_ui.
Lines 379-??? in spm_fmri_spm_ui.m:
%-Compute Global variate
%==========================================================================
GM = 100;
q = length(VY);
g = zeros(q,1);
fprintf('%-40s: %30s','Calculating globals',' ') %-#
for i = 1:q
fprintf('%s%30s',repmat(sprintf('\b'),1,30),sprintf('%4d/%-4d',i,q))%-#
g(i) = spm_global(VY(i));
end
fprintf('%s%30s\n',repmat(sprintf('\b'),1,30),'...done') %-#
% scale if specified (otherwise session specific grand mean scaling)
%--------------------------------------------------------------------------
gSF = GM./g;
if strcmpi(SPM.xGX.iGXcalc,'none')
for i = 1:nsess
gSF(SPM.Sess(i).row) = GM./mean(g(SPM.Sess(i).row));
end
end
%-Apply gSF to memory-mapped scalefactors to implement scaling
%--------------------------------------------------------------------------
for i = 1:q
SPM.xY.VY(i).pinfo(1:2,:) = SPM.xY.VY(i).pinfo(1:2,:)*gSF(i);
end
%-place global variates in global structure
%--------------------------------------------------------------------------
SPM.xGX.rg = g;
SPM.xGX.GM = GM;
SPM.xGX.gSF = gSF;
Best Regards, Donald McLaren
=================
D.G. McLaren, Ph.D.
Postdoctoral Research Fellow, GRECC, Bedford VA
Research Fellow, Department of Neurology, Massachusetts General Hospital and
Harvard Medical School
Office: (773) 406-2464
=====================
This e-mail contains CONFIDENTIAL INFORMATION which may contain PROTECTED
HEALTHCARE INFORMATION and may also be LEGALLY PRIVILEGED and which is
intended only for the use of the individual or entity named above. If the
reader of the e-mail is not the intended recipient or the employee or agent
responsible for delivering it to the intended recipient, you are hereby
notified that you are in possession of confidential and privileged
information. Any unauthorized use, disclosure, copying or the taking of any
action in reliance on the contents of this information is strictly
prohibited and may be unlawful. If you have received this e-mail
unintentionally, please immediately notify the sender via telephone at (773)
406-2464 or email.
On Thu, Sep 1, 2011 at 10:13 PM, Benjamin Matthew Deen <[log in to unmask]> wrote:
> Hi,
>
> I'm trying to perform a first-level GLM analysis without applying grand mean scaling, because my data have been preprocessed in another software package and have already been scaled. However, so far I haven't been able to get this to work. I'm using a custom matlab script that first builds an SPM.mat file, then runs spm_fmri_spm_ui, runs spm_spm, defines contrasts, and runs spm_contrasts. I've tried to set SPM.xGX.GM equal to the actual mean of the original data, after running spm_fmri_spm_ui but before spm_spm. In the resulting SPM.mat file, the SPM.xGX.GM field is in fact set to the grand mean of the original data. However, the beta values from this analysis are unchanged, when I expect them to be several orders of magnitude larger, as the original data was scaled to a mean around 10,000. Am I missing something, and is there a correct, easy way to do this? Thanks,
>
> Ben
|