Print

Print


Dear Vadim,

On 08/02/17 18:28, Vadim Axel wrote:
> You mean to change the data type to float32 - as the con images are
> created? Actually, the default INT16 I think gave the same result. A
> propos data type, I once had an issue when I tried to replace '0' with
> NaNs (to show activations without any background in checkreg). I think
> it worked with images of some data types, but not with others. 

Yes, that's what I meant. It is possible that most of the time it
doesn't make a huge difference but contrast images are stored with the
float32 data type and there is no good reason to make this extra ImCalc
step lose precision.
NaN is only available for floating point data types (single and double),
see spm_type.m.

> I see what you mean. So, the contrast defined this way [2 0 -1 -1)] /
> 2*nSession is already ready for 2nd level analysis. BTW, why 2*nSession
> and not just nSession? In fact, my case might be even more unbalanced.
> Suppose I have two sessions in total and 4 conditions. In standard case
> the contrast would be [1 1 -1 -1 1 1 -1 -1] / 2*2.  But what if  I do
> not have trails for conds 1 and 2 in session 1, and trials for conds 3
> and 4 in session 2. Can I define the contrast as: [0 0 -1 -1 1 1 0 0] / 2*2

The scaling factor is to make sure that all contrast images are
comparable (commensurate) at the second level. If all of your subjects
have the same number of conditions and sessions then it does not matter.
Thinking in terms of average effect (over conditions, sessions) just
makes you not worry about these. Your last example is not ideal but,
yes, it would be [0 0 -1 -1 1 1 0 0] / 2.

Best regards,
Guillaume.


> Many thanks!
> 
> 
> 
> On Wed, Feb 8, 2017 at 7:54 PM, Guillaume Flandin <[log in to unmask]
> <mailto:[log in to unmask]>> wrote:
> 
>     On 08/02/17 17:05, Vadim Axel wrote:
>     > Thanks a lot, Guillaume.
>     >
>     > With regard to scaling: as far as I checked, it seems that I can just
>     > multiply (e.g., in ImCalc) resultant con image by a factor according to
>     > the amount of the data each subject has. Will  it work for any type of
>     > contrasts?
> 
>     You can indeed apply a global scaling (as in the example on the slide)
>     on the contrast weights at the first level or rescale the contrast image
>     with ImCalc using that same scaling (and change the data type option
>     from its default value).
>     What I wanted to say in my previous email was regarding the situation
>     where you have eg 4 conditions and you compute a contrast [1 1 -1 -1]
>     and let's say that for a given subject there are no trials in the second
>     condition. Creating a dummy condition and setting the corresponding
>     contrast weight to 0 as explained below would create a contrast [1 0 -1
>     -1] whereas you should use [2 0 -1 -1] (and, even better, divide all of
>     these contrasts by 2*nSession).
> 
>     Best regards,
>     Guillaume.
> 
> 
>     > On Wed, Feb 8, 2017 at 6:22 PM, Guillaume Flandin <[log in to unmask] <mailto:[log in to unmask]>
>     > <mailto:[log in to unmask] <mailto:[log in to unmask]>>> wrote:
>     >
>     >     Dear Vadim,
>     >
>     >     What you can do is add a dummy trial for that otherwise empty
>     condition
>     >     at the very end of the session (ie onset = number of scans).
>     It will
>     >     stop SPM complaining about it and will let you have all of the
>     design
>     >     matrices with the same size. You will still have to adjust the
>     contrasts
>     >     so that they always have a zero weight for that condition, and
>     you might
>     >     also have to rescale some of the contrasts, see eg slide 12 of:
>     >
>     >   
>      http://www.fil.ion.ucl.ac.uk/spm/course/slides16-oct/03_Inference.pptx
>     <http://www.fil.ion.ucl.ac.uk/spm/course/slides16-oct/03_Inference.pptx>
>     >   
>      <http://www.fil.ion.ucl.ac.uk/spm/course/slides16-oct/03_Inference.pptx
>     <http://www.fil.ion.ucl.ac.uk/spm/course/slides16-oct/03_Inference.pptx>>
>     >
>     >     Best regards,
>     >     Guillaume.
>     >
>     >
>     >     On 08/02/17 10:47, Vadim Axel wrote:
>     >     > Dear experts,
>     >     >
>     >     > In my experiment the conditions are defined according to
>     behavioral
>     >     > ratings of a subject during scanning. So, in some sessions some
>     >     > conditions are missing. I tried to define onsets vector for
>     absent
>     >     > conditions as empty, but this did not work (during
>     estimation SPM
>     >     > pop-ups a window asking to fill the onsets for this condition).
>     >     > Obviously, I can omit the missing condition for this
>     specific session,
>     >     > so that number of conditions in this session would be less than
>     >     maximal.
>     >     > But this will require keeping track of which design column
>     corresponds
>     >     > to which condition during contrast creation. Is this the only
>     >     available
>     >     > solution?
>     >     >
>     >     > Thanks for the help,
>     >     > Vadim
>     >
>     >     --
>     >     Guillaume Flandin, PhD
>     >     Wellcome Trust Centre for Neuroimaging
>     >     University College London
>     >     12 Queen Square
>     >     London WC1N 3BG
>     >
>     >
> 
>     --
>     Guillaume Flandin, PhD
>     Wellcome Trust Centre for Neuroimaging
>     University College London
>     12 Queen Square
>     London WC1N 3BG
> 
> 

-- 
Guillaume Flandin, PhD
Wellcome Trust Centre for Neuroimaging
University College London
12 Queen Square
London WC1N 3BG