Print

Print


Thanks, Guillaume and Donald! I will read that.

Hi Donald, what's K in your expression? Seems SPM.xX.K is a struct which cannot be multiplied:

>> SPM.xX.K

ans = 

    HParam: 128
       row: [1x215 double]
        RT: 1.4000
        X0: [215x4 double]

Best,

Chao-Gan
 


On Thu, Oct 31, 2013 at 10:31 AM, MCLAREN, Donald <[log in to unmask]> wrote:
Try using:
pinv(K*W*X)*xX.V*pinv(K*W*X)' instead of (X'*X^(-1))

Then you should get the correct solution.

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 Wed, Oct 30, 2013 at 11:03 PM, YAN Chao-Gan <[log in to unmask]> wrote:
And here is an example based on 1st level results. The differences in T values are pretty big, although the pattern is similar.

I think I missed something in the code?
TData = (beta_0001*Contrast(1)+beta_0002*Contrast(2))./(sqrt(ResMS*(Contrast*(X'*X)^(-1)*Contrast')));

Thanks,

Chao-Gan


On Wed, Oct 30, 2013 at 10:50 PM, YAN Chao-Gan <[log in to unmask]> wrote:
Dear SPM experts,

Recently I would like to calculate the values based on the estimated files (skip spm_results_ui), I followed the formulas in Page 20 of www.fil.ion.ucl.ac.uk/~mgray/Presentations/2nd level analysis- Design contrast & inference.ppt

X=SPM.xX.X;
Contrast=[1 -1];
TData = (beta_0001*Contrast(1)+beta_0002*Contrast(2))./(sqrt(ResMS*(Contrast*(X'*X)^(-1)*Contrast')));

However, the results (Left in the attached figure) is slightly different from the results generated by spm_results_ui (Right in the attached figure). Furthermore, seems this difference is even bigger when applied to 1st level results (maybe due to the hidden high-pass filtering regressors?)

I am wondering if the differences are caused simply by data precision, or I made something wrong in the above code?

Thanks a lot for your time and help in advance!

Best,

Chao-Gan


--
Chao-Gan YAN, Ph.D.
Research Scientist
The Nathan Kline Institute for Psychiatric Research, 140 Old Orangeburg Road, Orangeburg, NY 10962
Center for the Developing Brain, Child Mind Institute, 445 Park Avenue, New York, NY 10022
The Phyllis Green and Randolph Cowen Institute for Pediatric Neuroscience, New York University Child Study Center, New York, NY 10016
-
Initiating + Service Node
The R-fMRI Network (RFMRI.ORG)



--
Chao-Gan YAN, Ph.D.
Research Scientist
The Nathan Kline Institute for Psychiatric Research, 140 Old Orangeburg Road, Orangeburg, NY 10962
Center for the Developing Brain, Child Mind Institute, 445 Park Avenue, New York, NY 10022
The Phyllis Green and Randolph Cowen Institute for Pediatric Neuroscience, New York University Child Study Center, New York, NY 10016
-
Initiating + Service Node
The R-fMRI Network (RFMRI.ORG)




--
Chao-Gan YAN, Ph.D.
Research Scientist
The Nathan Kline Institute for Psychiatric Research, 140 Old Orangeburg Road, Orangeburg, NY 10962
Center for the Developing Brain, Child Mind Institute, 445 Park Avenue, New York, NY 10022
The Phyllis Green and Randolph Cowen Institute for Pediatric Neuroscience, New York University Child Study Center, New York, NY 10016
-
Initiating + Service Node
The R-fMRI Network (RFMRI.ORG)
http://rfmri.org/yan
http://scholar.google.com/citations?user=lJQ9B58AAAAJ&hl=en