Print

Print


Pengxu –

Thank you very much! I am looking for something like this. I tried your trick. New t map can be explored. The problem is, t values are not correct. I checked the mail list. Several year ago Stephan ever pointed out that the threshold should presumably be p<.999, as the thresholding has already been effected when the map was transformed. I tried 0.99 or the original one and others, but none lead to a corrected result. In your opinion, what kind of threshold is correct? (the process to make the new t map: for condition 1, a nii file  made from Save button under threshold none 0.001 and 10 voxel, together with spmT_0001.img for condition 2 in another model under the same threshold, expression: i2.*(i1>0) ).

Again, I am a bit unsure what the problem is. Say you have 3 one-sample T-tests A, B, C, and you want to inclusively mask all of them, by applying thresholded masks for B and C to the contrast in A.

First, write out images for the thresholded B and C maps using “save” option (you decide the p-threshold).

Second, press Results for the analysis A, and create a new dummy contrast [1] – which might produce, say, spmT_0002.img/hdr. It doesn’t matter what threshold you review this at.

Third, press Imcalc, select the above spmT_0002.img and the two thresholded images from B and C (in this order), and evaluate i1.*(i2>0).*(i3>0), and name the output file spmT_0002.img to overwrite the one created in stage 2 above (making sure you are in correct directory).

Now, when you press Results again for analysis A, you can review the new contrast (2) at any threshold you want for the final A contrast – you have simply removed voxels which don’t survive the thresholds you chose for B an C.

HAVING SAID ALL THIS, Guilluame reminded me of an easier way, which he helpfully added in SPM8: repeat the first step above, but no need for steps 2-3: when you press Results for analysis A, select “image” to the “apply masking question”, then select both of the images from B and C in the first step, and then select “inclusive”. Thanks Guillaume!

Sorry to back to spm_FcUtil function again. I use your code to make one-condition contrast successfully in one way anova model with subject effect, while the results are quite differently from those of one-sample t test and one way anova without subject effect. eg, for the 4 conditions checked, threshold p 0.001 and 10 voxel is suitable for the former two approaches, while in the one way anova model with subject effect, the same threshold bring much extensive signal changes. Besides, one of 4 condition (the third) show no any voxel with any threshold in the new model. I think this great change may comes from some settings wrong but not from new variance introduced by the model. I attached the spm.mat files, hope you point out where the problem is if you don't mind it will take your addition time.

It is no surprise that you get different results – they are different models! I suggest we take this discussion off-list, until Donald, I and others have received a consensus on the best general advice (but suggest you stick with Donald’s advice for one-sample T-tests for the moment; as I said in my previous email, I don’t think this is always necessarily the most sensitive approach, but it is the “safest” approach (I don’t think it is a question of valid/invalid, but a question of convention and model selection)).

BW,R

-------------------------------------------------------
                 Dr Richard Henson
          Assistant Director, Neuroimaging
         MRC Cognition & Brain Sciences Unit
                 15 Chaucer Road
              Cambridge, CB2 7EF, UK

          Office: +44 (0)1223 355 294 x522
             Mob: +44 (0)794 1377 345
             Fax: +44 (0)1223 359 062

http://www.mrc-cbu.cam.ac.uk/people/rik.henson/personal
-------------------------------------------------------

From: SPM (Statistical Parametric Mapping) [mailto:[log in to unmask]] On Behalf Of pengxu wei
Sent: 12 April 2011 05:08
To: [log in to unmask]
Subject: Re: [SPM] a simple question about one-way within-subjects ANOVA

Dear Rik ,

Thank you very much! I am looking for something like this. I tried your trick. New t map can be explored. The problem is, t values are not correct. I checked the mail list. Several year ago Stephan ever pointed out that the threshold should presumably be p<.999, as the thresholding has already been effected when the map was transformed. I tried 0.99 or the original one and others, but none lead to a corrected result. In your opinion, what kind of threshold is correct? (the process to make the new t map: for condition 1, a nii file  made from Save button under threshold none 0.001 and 10 voxel, together with spmT_0001.img for condition 2 in another model under the same threshold, expression: i2.*(i1>0) ).

Sorry to back to spm_FcUtil function again. I use your code to make one-condition contrast successfully in one way anova model with subject effect, while the results are quite differently from those of one-sample t test and one way anova without subject effect. eg, for the 4 conditions checked, threshold p 0.001 and 10 voxel is suitable for the former two approaches, while in the one way anova model with subject effect, the same threshold bring much extensive signal changes. Besides, one of 4 condition (the third) show no any voxel with any threshold in the new model. I think this great change may comes from some settings wrong but not from new variance introduced by the model. I attached the spm.mat files, hope you point out where the problem is if you don't mind it will take your addition time.

Best regards,
Pengxu


________________________________
From: Rik Henson <[log in to unmask]>
To: pengxu wei <[log in to unmask]>; "[log in to unmask]" <[log in to unmask]>
Sent: Sun, April 10, 2011 5:16:09 PM
Subject: RE: [SPM] a simple question about one-way within-subjects ANOVA
>It's really interesting about '"inclusive masking" across these t-tests (ie across SPM analyses)' you mentioned.
>It seems that inclusive masking can not be made across models through GUI. With image calculator common
>areas between 2 t-maps can be made, but this isn't a direct method and need transform images several times.
>Is there a convenient method to do inclusive masking across models?

I don't think there is a convenient way via the GUI - but it might be relatively easy for the SPM authors (;-) to allow the user to select a new "SPM.mat" file when pressing "contrast" in response to the "masking" question that arises when you review results, ie to bring up a Contrast Manager window from an analysis different from the one currently being reviewed?

In the meantime (;-), you can use ImCalc to create a masked image, but as you note, you won't be able to surf the stats in the same way that you can when reviewing contrasts within the same analysis. One "hack" is described below - ie to create a new dummy spmT contrast in one analysis, but overwrite it with the result of your ImCalc masking across multiple analyses:


https://www.jiscmail.ac.uk/cgi-bin/wa.exe?A2=ind00&L=SPM&P=R95431&I=-3

Note however that this is a dangerous procedure (if you make a mistake), and you must ensure that the spmT images are in the same space.

BW,R

-------------------------------------------------------
DR RICHARD HENSON
Assistant Director, Imaging
MRC Cognition & Brain Sciences Unit
15 Chaucer Road
Cambridge, CB2 7EF
England
EMAIL:  [log in to unmask]<mailto:[log in to unmask]>
URL:    http://www.mrc-cbu.cam.ac.uk/people/rik.henson/personal
TEL     +44 (0)1223 355 294 x522
FAX     +44 (0)1223 359 062
MOB     +44 (0)794 1377 345
-------------------------------------------------------
________________________________
From: pengxu wei [[log in to unmask]]
Sent: 10 April 2011 02:51
To: Rik Henson; [log in to unmask]
Subject: Re: [SPM] a simple question about one-way within-subjects ANOVA
Dear Rik,

Thank you very much for your patience! Now both your two codes work.

It's really interesting about '"inclusive masking" across these t-tests (ie across SPM analyses)' you mentioned. It seems that inclusive masking can not be made across models through GUI. With image calculator common areas between 2 t-maps can be made, but this isn't a direct method and need transform images several times. Is there a convenient method to do inclusive masking across models?

Best regards,
Pengxu


________________________________
From: Rik Henson <[log in to unmask]>
To: [log in to unmask]
Sent: Sat, April 9, 2011 10:01:48 PM
Subject: Re: [SPM] a simple question about one-way within-subjects ANOVA



> If you don’t mind deleting your previous contrasts, try loading the SPM.mat file, then:
>
>                 SPM = rmfield(SPM,'xCon');
>        SPM.xCon(1) = spm_FcUtil('Set',’Any_name’,'T','c',c',SPM.xX.xKXs);
>        spm_contrasts(SPM);
>
> Does that still fail?

>Thank you. But, yes, after running the new code I got:
>
>??? Error using ==> rmfield at 41
>A field named 'xCon' doesn't exist.

Ok - I had assumed your previous error was because you had already performed some contrasts in your SPM analysis, so the error arose from trying to index the last contrast in an existing structure. The fact that the 'xCon' field does not exist means that you hadn't performed any contrasts, so that is not the problem. So I suggest you skip the first line above, and try the next two? If that fails, then, without looking at your SPM.mat file in detail, I do not know what is causing your errors (because the code works for me!).

Anyway, your original purpose was to find activations common to each condition in a repeated-measures ANOVA, using contrasts like [1 0 0...], [0 1 0...] in a model with condition and subject effects. If you are prepared to assume a single error term (though see below), then you could: 1) estimate contrasts of the type Donald suggested, and use inclusive masking to find common activation, though you won't get a final corrected p-value based on Random Field Theory for T^n (n>1) fields (as you would with a conjunction), but you could report each component threshold (though note that the tests are not independent, given that they share the same error term, so estimating the combined probability is difficult), or 2) specify contrasts using the spm_FcUtil function above, which will actually create orthogonal contrasts (as I think you would get if you tried to specify a conjunction across contrasts like Donald's), and then use a conjunction (by selecting all contrasts in using shift-mouse in the Contrast Manager window).

Having said all this, if you want your error term to be restricted to between-subject variance only (as Donald recommends), then it might be simpler to perform separate one-sample t-tests for each contrast, and then use "inclusive masking" across these t-tests (ie across SPM analyses). Again, you won't get a final corrected p-value based on Random Field Theory for T^n (n>1) fields, but you can report the component thresholds (and estimate a combined p-value, if data are independent).

BW,R


From: SPM (Statistical Parametric Mapping) [mailto:[log in to unmask]] On Behalf Of pengxu wei
Sent: 07 April 2011 13:05
To: [log in to unmask]
Subject: Re: [SPM] a simple question about one-way within-subjects ANOVA

Dear Rik, Donald and Alexa,

Thank you very much for informative suggestions and such an in-depth discussion.

First, the code about spm_FcUtil can't work. It works for other conditions(eg, if building a model without subject effects). After testing, what I find is, the code works if we can make a contrast through GUI, but fails if we can't through GUI.

Infomation that Matlab shows:

Warning:
c is not a proper contrast in +c->Tsp in spm_SpUtil
!!! projecting...
> In spm_SpUtil at 327
  In spm_FcUtil at 219
from
c =
     1
     0
     0
     0
     0
     0
     0
     0
     0
     0
     0
     0
     0
     0
     0
     0
     0
     0
     0
     0
     0
     0
     0
     0
to
c =
    0.9583
   -0.0417
   -0.0417
   -0.0417
    0.0417
    0.0417
    0.0417
    0.0417
    0.0417
    0.0417
    0.0417
    0.0417
    0.0417
    0.0417
    0.0417
    0.0417
    0.0417
    0.0417
    0.0417
    0.0417
    0.0417
    0.0417
    0.0417
    0.0417
??? Subscripted assignment between dissimilar structures.

and finally no new contrast is written in.

Though it can not work, it looks like this projecting process transfroms the original contrast to a new one in which the value of the 1st comlumn near 1, the other 23 column have the same small net value but the 2nd-4th are negative while the left 20 positive. It will work, I think, If the sum of these reprojected values equals zero ( the sum of above values is 1.5004 so that may be why it fails). Nevertheless, such method is an approximation instead of a real [1 0 0 0], if succeed.

Second, the contrast [1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]/20 can't work, too.

I am thinking what Donald said and materials Rik and Alexa provide, it takes time.

Any other suggestions?

Best regards,

Pengxu

--- 11年4月7日,周四, MCLAREN, Donald <[log in to unmask]> 写道:

发件人: MCLAREN, Donald <[log in to unmask]>
主题: Re: [SPM] a simple question about one-way within-subjects ANOVA
收件人: [log in to unmask]
日期: 2011年4月7日,周四,上午2:03
Alexa,

My statement about the error term being wrong only applies to within-subject designs or mixed-designs. If you look at any other statistica program (SAS, SPSS, STATA, etc.) anytime that they compute the effect of an individual condition, they use a different error term. The reason for this is that comparing a condition against 0 is a test of a between-subject effect, while comparing condition 1 versus condition 2 is a test of a within-subject effect. The test of each effect has its own error term. However, in SPM (FSL, FAST, etc.) only 1 error term is generated. For within-subject or mixed-designs, the error term in SPM, etc. is the within-subject error term. One cannot partition this error term to derive the between-subject error term because the between-subject error term is based on the between subject variance not the within-subject variance.

Here is a good example, of heights of people:

condition 1: height [ 61 62 59 63]
condition 2: height + 2 inch board [63 64 61 65]

condition 1 versus 60 is not significant (p=.25)
condition 2 versus 60 is significant (p=.024)

Now, if we build a big model and ask if condition 1 is different than 0, we get p=0, t-stastic=Inf. In other words, by measuring people's height with a board, their height without the board becomes significantly taller than 60 inches. To me, this demonstrates that SPM's error term is wrong in make conclusions about individual conditions within a repeated measures design.

If one were to change condition 2: height +2 inch board to  [63 64 61 64] (I guess the board shrunk before being used on the last person.
condition 1 versus 60 is not significant (p=.25)
condition 2 versus 60 is significant (p=.022)

Condition 1, using a paired test (e.g. a one-way ANOVA with 2 condition), is now still significant with a p-value of 0.005986. Thus, we would [incorrectly] conclude that these people are significant taller than 60 inches. This is a result of making a second measurement that doesn't change the first measurement. Also, we want to make a inference about the between-subject effect, which should not be influenced by other measurements of the same subjects as it is asking about the population behavior.

In conclusion, asking about the effect of 1 condition within SPM is invalid because it doesn't represent the between-subject effect because it is not using the between subject error term as that error term is not currently provided by SPM.

Hopefully this clears up my original statement on the validity of asking the significance of a single condition or group of condition in a within-subject or mixed-design model.

Please feel free to ask any question or suggest comments on the approach or statistics.


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 Wed, Apr 6, 2011 at 9:46 AM, Alexa Morcom <[log in to unmask]<http:[log in to unmask]>> wrote:
Donald, Rik, Pengxu

I agree about the contrast, and you can work out how to do others using the general system described in the excellent Gitelman/ Glascher tutorial for Flexible Factorial contrasts (I don't have a direct link, but google it).

I don't think the error term is wrong, though. All weighting the subject effect columns does here is to weight the 'contribution' of the effect you are interested in proportionately, and appropriately, for all columns to which it contributes. It would be incorrect for these subject effects to go into the error term, even if it were possible to code it that way. I believe that doing this will have just the same effect as what Rik suggests, which might be useful if you don't want to use the GUI.

cheers

Alexa

On 6 April 2011 14:12, MCLAREN, Donald <[log in to unmask]<http:[log in to unmask]>> wrote:
Rik and Pengxu,

They don't have to equal 0, for example if you had 4 condition and 20
subjects, (conditions then subject factors in the design matrix), then
the contrast for condition 1 would be:
1 0 0 0 ones(1,20)/20
While this contrast works, it is not valid for statistical inference
because you end up using the wrong error term because the error term
is for the within-subject errors. However, it is useful for getting
the mean response to condition1 across subjects if you just want to
plot the results.

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 Wed, Apr 6, 2011 at 8:43 AM, Rik Henson <[log in to unmask]<http:[log in to unmask]>> wrote:
>
>
> You can’t do this via SPM’s GUI, because it forces contrast weights to sum
> to zero for rank deficient design matrices (inestimable contrasts with
> respect to columns of interest).
>
>
>
> You can however estimate the equivalent contrast via calling SPM’s
> spm_FcUtil function directly, which will re-parametrise your contrast to
> make it estimable with respect to all columns in the design matrix, eg:
>
>
>
> SPM.xCon(end+1) = spm_FcUtil('Set',’Any_name’,'T','c',c',SPM.xX.xKXs);
>
> spm_contrasts(SPM);
>
>
>
> where c is your original contrast vector (eg [1 0 0 0]), which will be
> reprojected to include contributions from the subject effects. For further
> information, try Christophe Pallier’s document here:
>
>
>
> http://www.pallier.org//ressources/glm_anova/glm_anova2.pdf<http://www.pallier.org/ressources/glm_anova/glm_anova2.pdf>
>
>
>
> BW,R
>
>
>
> -------------------------------------------------------
>
>                  Dr Richard Henson
>
>           Assistant Director, Neuroimaging
>
>          MRC Cognition & Brain Sciences Unit
>
>                  15 Chaucer Road
>
>               Cambridge, CB2 7EF, UK
>
>
>
>           Office: +44 (0)1223 355 294 x522
>
>              Mob: +44 (0)794 1377 345
>
>              Fax: +44 (0)1223 359 062
>
>
>
> http://www.mrc-cbu.cam.ac.uk/people/rik.henson/personal
>
> -------------------------------------------------------
>
>
>
> From: Pengxu Wei [mailto:[log in to unmask]<http:[log in to unmask]>]
> Sent: 06 April 2011 11:52
> To: Rik Henson
> Subject: a simple question about one-way within-subjects ANOVA
>
>
>
> Dear Dr. Rik Henson,
>
>
>
> I am reading your paper "ANOVAs and SPM". One of my data is just the same of
> Figure 5: Design matrix for one-way (1x4) within-subjects ANOVA. The first 4
> columns are treatment effects and the last 12 are subject effects, except 20
> instead of 12 subjects in my study.
>
>
>
> In SPM5 I get this design matrix through 'Flexible factorial'
> specification.  I want to check activation of each of the 4 conditions
> through this model, and then use inclusive masking or conjunction to explore
> the activation areas in common between each pair of the 4 treatment effects.
> But I failed when using the contrast like [1 0 0 0]. Only contrast with a
> zero sum(eg.1 -1 0 0) can be used. Would you like to show me a clue?
>
>
>
>
>
> Best regards,
>
>
>
> Pengxu Wei
> Director, Chinese Medicine and Rehabilitation Dept.
> National Rehabilitation Hospital,
> National Research Center for Rehabilitation Technical Aids, China


--
Dr. Alexa Morcom
RCUK Academic Fellow
Centre for Cognitive & Neural Systems/ Centre for Cognitive Ageing & Cognitive Epidemiology
Psychology, University of Edinburgh
http://www.ccns.sbms.mvm.ed.ac.uk/people/academic/morcom.html

The University of Edinburgh is a charitable body, registered in Scotland, with registration number SC005336


The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.