[FieldTrip] Mvaranalysis error

Schoffelen, J.M. (Jan Mathijs) janmathijs.schoffelen at donders.ru.nl
Mon Dec 12 08:23:53 CET 2022


Hi Masoud,

I suggest to do the following (if you haven’t done so already):

1) check the documentation of ft_mvaranalysis, and look for the parameters that you can specify: the cfg you pasted in your e-mail looks a bit random, and does not contain options that I would have expected (and contains options that I would not have expected). e.g. you don’t specify the parameter ‘order’, and you specify the cfg.method to be ‘granger’.
2) check in the matlab documentation what the error means -> it suggests a low-level problem with the numerics of your input data.
3) put a breakpoint in your code, so that you can inspect in detail what is happening with the input data step-by-step.

Best wishes,
Jan-Mathijs


On 10 Dec 2022, at 15:56, masoud via fieldtrip <fieldtrip at science.ru.nl<mailto:fieldtrip at science.ru.nl>> wrote:

Hello dear fieldtrip community
I have been using fieldtrip for quite awhile now and now I am dealing with mvar analysis, I preprocessed the data and now I am doing it's multivariate autoregressive Analysis, and also i have read the document of the function.
here is my code:

cfg = [];
load('1-1alpha.mat')
load('toi.mat')
cfg.method = 'granger';
cfg.trials = 'all';
cfg.method = 'bsmart';
cfg.t_ftimwin = 5;
cfg.toi = toi;
cfg.output = 'parameters';
mvardata = ft_mvaranalysis(cfg, data);

And the error is:

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 488)
              [ar, tmpnoisecov] = armorf(dat, numel(rpt{rlop}), size(tmpdata.trial{1},2), cfg.order);

Error in Untitled6 (line 13)
mvardata = ft_mvaranalysis(cfg, data);



I would very much appreciate it if anyone can help me solve this problem
Best regards
_______________________________________________
fieldtrip mailing list
https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
https://urldefense.com/v3/__https://doi.org/10.1371/journal.pcbi.1002202__;!!HJOPV4FYYWzcc1jazlU!6fe22t-4FgfgJs6PyVktXAnfRdM5yhSCWGzbKHzQxHrI_bgdquCUPOduskMucN7mFUSQ6vl8JvRdKHaoyDpliFDDjBDD_Sq_67nNHw$

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20221212/2f514017/attachment.htm>


More information about the fieldtrip mailing list