In general, you are not interested in the T-statistic for each subject, so you could just average the contrasts from each session, then you wouldn't need to build the contrast.
When I provided the contrasts, I had thought you had one big design with 5 sessions in it as that is the standard approach. Concatenation means that you combine all the sessions and treat them as a single session. In SPM, you can build a model with multiple sessions - which is different from concatenation and differerent from having each session in its own model.
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 Thu, Oct 31, 2013 at 3:24 PM, YAN Chao-Gan <[log in to unmask]> wrote:
Thanks, Donald!That means I need to have a 10-column design matrix upon which I can apply the contrast "1/5 0 1/5 0 1/5 0 1/5 0 1/5 0 0 0 0 0 0", right?
In my case, each session has one directory, under each has the SPM.mat. For each SPM.mat, there are 2 columns for design matrix. How can I combine them to have a 10-column design matrix, thus I can apply the contrast?Thanks,Chao-GanOn Thu, Oct 31, 2013 at 3:19 PM, MCLAREN, Donald <[log in to unmask]> wrote:
Concatenate is potentially bad if you don't account for the fact that you have multiple runs. If you properly account for the runs, then its okay; however, its not worth scripting the analysis to get the proper run effects in the HP filter, AR(1) estimation, or HRF.You can use a fixed effects analysis to combine them. All you need to do is create a contrast that spans all 5 sessions/runs.1/5 0 1/5 0 1/5 0 1/5 0 1/5 0 0 0 0 0 0 for 5 sessions with 2 conditions. Just make sure the contrast weights sun to 1 for the positive coefficients and -1 for the negative coefficients.
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 Thu, Oct 31, 2013 at 1:36 PM, YAN Chao-Gan <[log in to unmask]> wrote:
By the way, how to perform 1st level analysis across sessions?I.e., I have one subject performed the same task for 5 sessions (or some may call them runs). How can I combine them to have one single t map? Use some fix effect analysis?I think it's not a good idea to simply concatenate all the 5 sessions, right?Thanks in advance!Best,Chao-GanOn Thu, Oct 31, 2013 at 1:32 PM, YAN Chao-Gan <[log in to unmask]> wrote:
Thanks Don!It's a two sample t test, the variance is default to be unequal. Then there should be some special process on SPM.xX.Bcov, right?Best,Chao-GanOn Thu, Oct 31, 2013 at 12:22 PM, MCLAREN, Donald <[log in to unmask]> wrote:
Did you set the variance to be equal?
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 Thu, Oct 31, 2013 at 11:45 AM, YAN Chao-Gan <[log in to unmask]> wrote:
Thanks!Now I am using SPM.xX.Bcov directly, thus got the same results as spm_results_ui.TData = (beta_0001*Contrast(1)+beta_0002*Contrast(2))./(sqrt(ResMS*(Contrast*SPM.xX.Bcov*Contrast')));
In the case of 2nd level statistical analysis, there should be no filtering issue, right? Why SPM.xX.Bcov is slightly different from (X'*X)^(-1)?>>SPM.xX.Bcov0.0656 00 0.0438>>(X'*X)^(-1)0.0625 00 0.0455Is this caused by an whitening issue?Thanks,Chao-Gan
On Thu, Oct 31, 2013 at 10:44 AM, MCLAREN, Donald <[log in to unmask]> wrote:
xX.xKXs = spm_sp('Set',spm_filter(xX.K,W*xX.X)); % K*W*XAlso,
xX.xKXs.X = full(xX.xKXs.X);
xX.pKX = spm_sp('x-',xX.xKXs); % projector/pseudo-inverse
xX.Bcov = xX.pKX*xX.V*xX.pKX';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 Thu, Oct 31, 2013 at 10:41 AM, YAN Chao-Gan <[log in to unmask]> wrote:
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.Kans =HParam: 128row: [1x215 double]RT: 1.4000X0: [215x4 double]Best,Chao-GanOn Thu, Oct 31, 2013 at 10:31 AM, MCLAREN, Donald <[log in to unmask]> wrote:
Try using:Then you should get the correct solution.
pinv(K*W*X)*xX.V*pinv(K*W*X)' instead of (X'*X^(-1))
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-GanOn 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.pptX=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 ScientistThe Nathan Kline Institute for Psychiatric Research, 140 Old Orangeburg Road, Orangeburg, NY 10962Center for the Developing Brain, Child Mind Institute, 445 Park Avenue, New York, NY 10022The Phyllis Green and Randolph Cowen Institute for Pediatric Neuroscience, New York University Child Study Center, New York, NY 10016-Initiating + Service NodeThe R-fMRI Network (RFMRI.ORG)--Chao-Gan YAN, Ph.D.Research ScientistThe Nathan Kline Institute for Psychiatric Research, 140 Old Orangeburg Road, Orangeburg, NY 10962Center for the Developing Brain, Child Mind Institute, 445 Park Avenue, New York, NY 10022The Phyllis Green and Randolph Cowen Institute for Pediatric Neuroscience, New York University Child Study Center, New York, NY 10016-Initiating + Service NodeThe R-fMRI Network (RFMRI.ORG)--Chao-Gan YAN, Ph.D.Research ScientistThe Nathan Kline Institute for Psychiatric Research, 140 Old Orangeburg Road, Orangeburg, NY 10962Center for the Developing Brain, Child Mind Institute, 445 Park Avenue, New York, NY 10022The Phyllis Green and Randolph Cowen Institute for Pediatric Neuroscience, New York University Child Study Center, New York, NY 10016-Initiating + Service NodeThe R-fMRI Network (RFMRI.ORG)--Chao-Gan YAN, Ph.D.Research ScientistThe Nathan Kline Institute for Psychiatric Research, 140 Old Orangeburg Road, Orangeburg, NY 10962Center for the Developing Brain, Child Mind Institute, 445 Park Avenue, New York, NY 10022The Phyllis Green and Randolph Cowen Institute for Pediatric Neuroscience, New York University Child Study Center, New York, NY 10016-Initiating + Service NodeThe R-fMRI Network (RFMRI.ORG)--Chao-Gan YAN, Ph.D.Research ScientistThe Nathan Kline Institute for Psychiatric Research, 140 Old Orangeburg Road, Orangeburg, NY 10962Center for the Developing Brain, Child Mind Institute, 445 Park Avenue, New York, NY 10022The Phyllis Green and Randolph Cowen Institute for Pediatric Neuroscience, New York University Child Study Center, New York, NY 10016-Initiating + Service NodeThe R-fMRI Network (RFMRI.ORG)--Chao-Gan YAN, Ph.D.Research ScientistThe Nathan Kline Institute for Psychiatric Research, 140 Old Orangeburg Road, Orangeburg, NY 10962Center for the Developing Brain, Child Mind Institute, 445 Park Avenue, New York, NY 10022The Phyllis Green and Randolph Cowen Institute for Pediatric Neuroscience, New York University Child Study Center, New York, NY 10016-Initiating + Service NodeThe R-fMRI Network (RFMRI.ORG)--Chao-Gan YAN, Ph.D.Research ScientistThe Nathan Kline Institute for Psychiatric Research, 140 Old Orangeburg Road, Orangeburg, NY 10962Center for the Developing Brain, Child Mind Institute, 445 Park Avenue, New York, NY 10022The Phyllis Green and Randolph Cowen Institute for Pediatric Neuroscience, New York University Child Study Center, New York, NY 10016-Initiating + Service NodeThe R-fMRI Network (RFMRI.ORG)