[FieldTrip] ft_mvaranalysis

"Jörn M. Horschig" jm.horschig at donders.ru.nl
Wed Jun 4 10:15:13 CEST 2014


Hi Tyler,

ah I see, so the 'source'-structure you get from the beamforming serves 
to create the 'data'-structure to run mvaranalysis.
cfg.reducerank in ft_prepare_leadfield does not reduce the rank of your 
data, it reduces the rank of leadfield dimensionality (a dipole has 
moments in 3 directions, x,y,z).
The interpolation does not work for you, because you do not have a full 
3D grid anymore but rather individual grid points. Of course one could 
interpolate, but it would be far from optimal, so FieldTrip refuses to 
do so (imagine you want to interpolate to a 2D grid, e.g. a square, but 
you only have a data point of the center of that 2D grid).
Instead of using 116 gridpoints why not lump them together to regions of 
interest. That way you'd probably get only a handful of 'voxels', and 
you probably get rid of the rank deficiency. However,  I am not quite 
sure what you want to achieve with this analysis, so I am not sure 
whether I give adequate help advise ;)

Best,
Jörn

On 6/4/2014 9:53 AM, Tyler Grummett wrote:
> Hey Jorn,
>
> I was just checking to see if I was calculating the beamformer correctly.
>
> Long story short, I worked out X Y Z coordinates for brain regions using the AAL atlas, gave that to the leadfield and beamformer to only give me 116.
> What this does it doesnt allow me to interpolate the data anymore (whereas previously I had approx 4000 because I was using the same Xgrid, Ygrid
> and Zgrid as the atlas).
>
> I was trying to increase my rank (or decrease rank deficiency by changing my code).
>
> However, no matter what I have tried thus far, nothing has helped.
>
> Tyler.
>
> *************************
>
> Tyler Grummett ( BBSc, BSc(Hons I))
> PhD Candidate
> Brain Signals Laboratory
> Flinders University
> Rm 5A301
> Ext 66124
>
> ________________________________________
> From: fieldtrip-bounces at science.ru.nl <fieldtrip-bounces at science.ru.nl> on behalf of "Jörn M. Horschig" <jm.horschig at donders.ru.nl>
> Sent: Wednesday, 4 June 2014 5:12 PM
> To: FieldTrip discussion list
> Subject: Re: [FieldTrip] ft_mvaranalysis
>
> Hi Tyler,
>
> I thought you are talking about mvaranalysis - why is the code you've
> pasted about leadfields and lcmv beamforming?
>
> Best,
> Jörn
>
> On 6/4/2014 3:15 AM, Tyler Grummett wrote:
>> Jorn,
>>
>> There is an additional issue of interpolating the data and then plotting it with ft_sourceplot.
>>
>> I have hit a wall of issues haha
>>
>> Tyler
>>
>> *************************
>>
>> Tyler Grummett ( BBSc, BSc(Hons I))
>> PhD Candidate
>> Brain Signals Laboratory
>> Flinders University
>> Rm 5A301
>> Ext 66124
>>
>> ________________________________________
>> From: fieldtrip-bounces at science.ru.nl <fieldtrip-bounces at science.ru.nl> on behalf of Tyler Grummett <tyler.grummett at flinders.edu.au>
>> Sent: Wednesday, 4 June 2014 10:11 AM
>> To: FieldTrip discussion list
>> Subject: Re: [FieldTrip] ft_mvaranalysis
>>
>> Hey Jorn,
>>
>> You were right, it was rank reduced. I tried changing that option that is used if ft_prepare_leadfield ( 'reducerank' = 'no'), but it didnt seem to work.
>>
>> My code is as follows: (I used an atlas to get the grid coordinates)
>>
>>               % compute lead field ( apparently source analysis computes
>>               % lead field anyway
>>               cfg                 = [];
>>               cfg.elec            = timelock.elec;
>>               cfg.vol             = vol;
>>               cfg.grid.unit       = 'mm';
>>               cfg.dim = atlas_grid.dim;
>>               cfg.pos = pos;
>>               cfg.reducerank = 'no'; % 3 for EEG, 2 for MEG
>>               cfg.backproject = 'yes';
>>               cfg.normalize = 'yes'; % if you are not contrasting the activity of interest again another condition or baseline time-window
>>               grid = ft_prepare_leadfield( cfg);
>>
>>               % Source Analysis: without contrasting condition
>>               cfg = [];
>>               cfg.channel = 'EEG';
>>               cfg.method = 'lcmv';
>>               cfg.grid = grid;
>>               cfg.vol = vol;
>>               cfg.keepfilter = 'yes';
>>               source = ft_sourceanalysis( cfg, timelock);
>>
>> Previously I had used the x, y and z grid from the atlas, but I till had a reduced rank.
>>
>> Any suggestions?
>>
>> Tyler
>>
>> *************************
>>
>> Tyler Grummett ( BBSc, BSc(Hons I))
>> PhD Candidate
>> Brain Signals Laboratory
>> Flinders University
>> Rm 5A301
>> Ext 66124
>>
>> ________________________________________
>> From: fieldtrip-bounces at science.ru.nl <fieldtrip-bounces at science.ru.nl> on behalf of "Jörn M. Horschig" <jm.horschig at donders.ru.nl>
>> Sent: Tuesday, 3 June 2014 6:16 PM
>> To: FieldTrip discussion list
>> Subject: Re: [FieldTrip] ft_mvaranalysis
>>
>> Hi Tyler,
>>
>> most likely your data is rank deficient. You can check this by
>>    >> rank(data.trial{1})
>>
>> You probably won't get 116 (#channels) as a result. If I remember
>> correctly your data needs to have full-rank for mvaranalysis.
>>
>> Best,
>> Jörn
>>
>>
>> On 6/3/2014 9:50 AM, Tyler Grummett wrote:
>>> JM,
>>>
>>>
>>> My data has the following format:
>>>
>>>
>>> data =
>>>
>>>
>>> fsample: 500
>>> sampleinfo: [14x2 double]
>>> trial: {1x14 cell}
>>> time: {1x14 cell}
>>> label: {1x116 cell}
>>> cfg: [1x1 struct]
>>>
>>> I had a look and there are no NaNs or anything. I have tried running
>>> using the coherence method for connectivity analysis (hence I didnt
>>> need to use mvaranalysis) and it seemed to work fine.
>>>
>>> Can you give me any suggestions as to what the problems with my data
>>> could be?
>>>
>>> Tyler
>>>
>>>
>>>
>>> *************************
>>>
>>> /Tyler Grummett ( BBSc, BSc(Hons I))/
>>> /PhD Candidate/
>>> /Brain Signals Laboratory/
>>> /Flinders University/
>>> /Rm 5A301/
>>> /Ext 66124/
>>> ------------------------------------------------------------------------
>>> *From:* fieldtrip-bounces at science.ru.nl
>>> <fieldtrip-bounces at science.ru.nl> on behalf of jan-mathijs schoffelen
>>> <jan.schoffelen at donders.ru.nl>
>>> *Sent:* Tuesday, 3 June 2014 5:06 PM
>>> *To:* FieldTrip discussion list
>>> *Subject:* Re: [FieldTrip] ft_mvaranalysis
>>> This is a low level matlab error and suggests a problem with your data.
>>>
>>>
>>> On Jun 3, 2014, at 9:32 AM, Tyler Grummett
>>> <tyler.grummett at flinders.edu.au
>>> <mailto:tyler.grummett at flinders.edu.au>> wrote:
>>>
>>>> Using the same code it generates the error:
>>>>
>>>> Error using chol
>>>> Matrix must be positive definite.
>>>>
>>>> Error in armorf (line 40)
>>>> ap(:,:,1) = inv((chol(ap(:,:,1)/Nr*(Nl-1)))');
>>>>
>>>> Error in ft_mvaranalysis (line 395)
>>>> [ar, tmpnoisecov] = armorf(dat, numel(rpt{rlop}),
>>>> size(tmpdata.trial{1},2),
>>>> cfg.order);
>>>>
>>>>
>>>>
>>>> *************************
>>>>
>>>> /Tyler Grummett ( BBSc, BSc(Hons I))/
>>>> /PhD Candidate/
>>>> /Brain Signals Laboratory/
>>>> /Flinders University/
>>>> /Rm 5A301/
>>>> /Ext 66124/
>>>> ------------------------------------------------------------------------
>>>> *From:*fieldtrip-bounces at science.ru.nl
>>>> <mailto:fieldtrip-bounces at science.ru.nl><fieldtrip-bounces at science.ru.nl
>>>> <mailto:fieldtrip-bounces at science.ru.nl>> on behalf of jan-mathijs
>>>> schoffelen <jan.schoffelen at donders.ru.nl
>>>> <mailto:jan.schoffelen at donders.ru.nl>>
>>>> *Sent:*Tuesday, 3 June 2014 4:49 PM
>>>> *To:*FieldTrip discussion list
>>>> *Subject:*Re: [FieldTrip] ft_mvaranalysis
>>>> Hi Tyler,
>>>>
>>>> Try using ft_hastoolbox(‘bsmart’,1) and then in the cfg for
>>>> ft_mvaranalysis cfg.toolbox = ‘bsmart’
>>>>
>>>> Best,
>>>> Jan-Mathijs
>>>>
>>>> On Jun 3, 2014, at 3:39 AM, Tyler Grummett
>>>> <tyler.grummett at flinders.edu.au
>>>> <mailto:tyler.grummett at flinders.edu.au>> wrote:
>>>>
>>>>> Hello fieldtrippers,
>>>>>
>>>>> Im having problems with ft_mvaranalysis at line 390: [ar, rc, pe] =
>>>>> mvar(dat', cfg.order, cfg.mvarmethod);
>>>>>
>>>>> The error message is:
>>>>>
>>>>> Undefined function 'mvar' for input arguments of type 'double'.
>>>>>
>>>>> ​ Ive tried looking for the function, but I cant find it. Is it
>>>>> likely that it is hidden or absent?
>>>>>
>>>>> I swear this has worked before on old data, and I didnt update the
>>>>> toolbox between trying it
>>>>> with the old data and with the new data. I have now updated the
>>>>> fieldtrip toolbox and I have
>>>>> tried running the code again, but no luck.
>>>>>
>>>>> Tyler
>>>>>
>>>>> *************************
>>>>>
>>>>> /Tyler Grummett ( BBSc, BSc(Hons I))/
>>>>> /PhD Candidate/
>>>>> /Brain Signals Laboratory/
>>>>> /Flinders University/
>>>>> /Rm 5A301/
>>>>> /Ext 66124/
>>>>> _______________________________________________
>>>>> fieldtrip mailing list
>>>>> fieldtrip at donders.ru.nl <mailto:fieldtrip at donders.ru.nl>
>>>>> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
>>>> Jan-Mathijs Schoffelen, MD PhD
>>>>
>>>> Donders Institute for Brain, Cognition and Behaviour,
>>>> Centre for Cognitive Neuroimaging,
>>>> Radboud University Nijmegen, The Netherlands
>>>>
>>>> Max Planck Institute for Psycholinguistics,
>>>> Nijmegen, The Netherlands
>>>>
>>>> J.Schoffelen at donders.ru.nl <mailto:J.Schoffelen at donders.ru.nl>
>>>> Telephone: +31-24-3614793
>>>>
>>>> http://www.hettaligebrein.nl <http://www.hettaligebrein.nl/>
>>>>
>>>> _______________________________________________
>>>> fieldtrip mailing list
>>>> fieldtrip at donders.ru.nl <mailto:fieldtrip at donders.ru.nl>
>>>> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
>>> Jan-Mathijs Schoffelen, MD PhD
>>>
>>> Donders Institute for Brain, Cognition and Behaviour,
>>> Centre for Cognitive Neuroimaging,
>>> Radboud University Nijmegen, The Netherlands
>>>
>>> Max Planck Institute for Psycholinguistics,
>>> Nijmegen, The Netherlands
>>>
>>> J.Schoffelen at donders.ru.nl <mailto:J.Schoffelen at donders.ru.nl>
>>> Telephone: +31-24-3614793
>>>
>>> http://www.hettaligebrein.nl
>>>
>>>
>>>
>>> _______________________________________________
>>> fieldtrip mailing list
>>> fieldtrip at donders.ru.nl
>>> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
>> --
>> Jörn M. Horschig
>> PhD Student
>> Donders Institute for Brain, Cognition and Behaviour
>> Centre for Cognitive Neuroimaging
>> Radboud University Nijmegen
>> Neuronal Oscillations Group
>> FieldTrip Development Team
>>
>> P.O. Box 9101
>> NL-6500 HB Nijmegen
>> The Netherlands
>>
>> Contact:
>> E-Mail: jm.horschig at donders.ru.nl
>> Tel:    +31-(0)24-36-68493
>> Web: http://www.ru.nl/donders
>>
>> Visiting address:
>> Trigon, room 2.30
>> Kapittelweg 29
>> NL-6525 EN Nijmegen
>> The Netherlands
>>
>> _______________________________________________
>> fieldtrip mailing list
>> fieldtrip at donders.ru.nl
>> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
>>
>> _______________________________________________
>> fieldtrip mailing list
>> fieldtrip at donders.ru.nl
>> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
>>
>> _______________________________________________
>> fieldtrip mailing list
>> fieldtrip at donders.ru.nl
>> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
>
> --
> Jörn M. Horschig
> PhD Student
> Donders Institute for Brain, Cognition and Behaviour
> Centre for Cognitive Neuroimaging
> Radboud University Nijmegen
> Neuronal Oscillations Group
> FieldTrip Development Team
>
> P.O. Box 9101
> NL-6500 HB Nijmegen
> The Netherlands
>
> Contact:
> E-Mail: jm.horschig at donders.ru.nl
> Tel:    +31-(0)24-36-68493
> Web: http://www.ru.nl/donders
>
> Visiting address:
> Trigon, room 2.30
> Kapittelweg 29
> NL-6525 EN Nijmegen
> The Netherlands
>
> _______________________________________________
> fieldtrip mailing list
> fieldtrip at donders.ru.nl
> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
>
> _______________________________________________
> fieldtrip mailing list
> fieldtrip at donders.ru.nl
> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip


-- 
Jörn M. Horschig
PhD Student
Donders Institute for Brain, Cognition and Behaviour
Centre for Cognitive Neuroimaging
Radboud University Nijmegen
Neuronal Oscillations Group
FieldTrip Development Team

P.O. Box 9101
NL-6500 HB Nijmegen
The Netherlands

Contact:
E-Mail: jm.horschig at donders.ru.nl
Tel:    +31-(0)24-36-68493
Web: http://www.ru.nl/donders

Visiting address:
Trigon, room 2.30
Kapittelweg 29
NL-6525 EN Nijmegen
The Netherlands




More information about the fieldtrip mailing list