Print

Print


OK, here is my 2 cents. Since you mention that this is an interaction term I wonder if the difference has to do with the centering. It may be that one approach is subtracting out the mean and the other not. Also, are you calculating the interaction term the same way?

Jason


On Fri, Jul 5, 2013 at 8:10 PM, Brian Roach <[log in to unmask]> wrote:
Hi Donald,

I checked some of our model parameters in the SPM.mat file, and I'm still not sure I understand the source of differences between the models.  Everything that follows is based on SPM 5 code we're using to run this.  Our SPM.xX.W (whitening matrix) is a sparse identity matrix so that when the spm_spm.m function whitens the data (lines 717-721):

            %-Whiten/Weight data and remove filter confounds
            %--------------------------------------------------------------
            fprintf('%s%30s',repmat(sprintf('\b'),1,30),'filtering')

            KWY   = spm_filter(xX.K,W*Y);

I think I should get values in KWY that are equal to my original data matrix Y (note: SPM.xX.K=1).  Later, the betas and residual sum of squares are estimated (lines 732-739):

            %-General linear model: Weighted least squares estimation
            %--------------------------------------------------------------
            fprintf('%s%30s',repmat(sprintf('\b'),1,30),' estimation')

            beta  = xX.pKX*KWY;                  %-Parameter estimates
            res   = spm_sp('r',xX.xKXs,KWY);     %-Residuals
            ResSS = sum(res.^2);                 %-Residual SSQ
            clear KWY                            %-Clear to save memory

In the belly of spm_sp.m, the calculation of the 'res' variable is given as (line 1403):

        Y = Y - sX.u(:,[1:r])*(sX.u(:,[1:r])'*Y); % warning('route1');

If I repeat this calculation for my test voxel:

spmR = KWY - (SPM.xX.xKXs.u*SPM.xX.xKXs.u'*KWY)

I obtain residual values that are identical to my SPSS residuals or residuals returned by the regress.m function in matlab.  This is in addition to obtaining identical beta values with all three methods.  The only other thing I can see happening to this ResSS variable, is scaling (lines 821-824):

        %-Write ResSS into ResMS (variance) image scaled by tr(RV) above
        %------------------------------------------------------------------
        if length(Q), jj(Q) = CrResSS;    end
        VResMS  = spm_write_plane(VResMS,jj,z);

        ...and lines 950-953:
        %-Set VResMS scalefactor as 1/trRV (raw voxel data is ResSS)
        %--------------------------------------------------------------------------
        VResMS.pinfo(1) = 1/xX.trRV;
        VResMS          = spm_create_vol(VResMS);

and based on that scaling variable (SPM.xX.trRV), I get a residual mean square value equal to that returned by SPSS or regress.m, but not equal to the actual value I see in the ResMS.img generated by running the spm job.  What am I missing?

thanks,
Brian



On 7/5/13 10:35 AM, MCLAREN, Donald wrote:
It's a combination of both. The REML estimates are used to create a whitening matrix, which is multiplied by the design matrix to get the matrix that is ultimately estimated. The whitening doesn't change the relationship of the betas between conditions or columns, but it does change the residuals. Hence, the contrasts are the same, but the statistics are different.

Best Regards, Donald McLaren
=================
D.G. McLaren, Ph.D.
Research Fellow, Department of Neurology, Massachusetts General Hospital and
Harvard Medical School
Postdoctoral Research Fellow, GRECC, Bedford VA
Website: http://www.martinos.org/~mclaren
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 Fri, Jul 5, 2013 at 1:31 PM, Mathalon, Daniel <[log in to unmask]> wrote:
Thanks.  Do you mean correction for unequal variances between groups? Or is it the fact that SPM uses ReML to estimate variance whereas SPSS uses least-squares approach?  Or perhaps both contribute?

Dan

On Jul 5, 2013, at 8:15 AM, MCLAREN, Donald wrote:

The difference you are seeing is probably due to the variance correction applied in SPM and not applied in SPSS.

Best Regards, Donald McLaren
=================
D.G. McLaren, Ph.D.
Research Fellow, Department of Neurology, Massachusetts General Hospital and
Harvard Medical School
Postdoctoral Research Fellow, GRECC, Bedford VA
Website: http://www.martinos.org/~mclaren
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 Fri, Jul 5, 2013 at 3:37 AM, Susanne Dietrich <[log in to unmask]> wrote:
I think classical and Bayesian statistics are available in SPM / Matlab. If averages are calculated with the Bayesian statistic, they differs slightly from the classical analysis which is, I think, only available in SPSS. Perhaps this could be the reason.

Kind regards
Susanne


Am 04.07.2013 21:12, schrieb Mathalon, Daniel:

Dear SPMers,

We are running a full factorial model in SPM 8 using a condition variable (representing two groups) and 8 additional covariates, including 1 Condition x Covariate interaction term.

We've extracted the data from one voxel to compare results with SPSS linear regression or ANOVA programs, fully expecting them to agree (as a check that our script was working correctly).

We find that the beta values estimated by SPM for that voxel for each variable in the model and the regression coefficients estimated by SPSS are in perfect agreement.  The residual degrees of freedom in both SPM and SPSS also agree.

However, we are finding that the t-test values generated in SPM and SPSS do not agree. For example, for the interaction term of interest, in SPSS t =1.459, but in SPM's t-map t =1.3414.  We can't figure out why, but we suspect that the standard error of the beta must be estimated differently (since the betas and the degrees of freedom appear to be the same in SPSS and SPM).

Does anyone have any ideas about why we are observing these discrepancies?  Any insights or strategies for tracking this down would be greatly appreciated.

Thanks,

Dan


Daniel H. Mathalon, Ph.D., M.D.
Professor of Psychiatry
University of California, San Francisco

Mail Address:
Psychiatry Service 116d
San Francisco VA Medical Center
4150 Clement St.
San Francisco, CA 94121

Office phone:  (415) 221-4810, ext. 3860
Fax:  (415) 750 6622
e-mail:  [log in to unmask]



--
Dr. Susanne Dietrich
Dept. of Neurology / MEG-Center
University of Tübingen
Otfried-Müller-Str. 47
72076 Tübingen
phone: ++49 (0)7071-29 87708
fax:   ++49 (0)7071-29 5706
email: [log in to unmask]




--
San Francisco VA Medical Center 116D
4150 Clement St. Bld 8 Rm9B#29
San Francisco CA 94121
phone: (415) 221-4810x4335
fax: (415) 750-6622