[FieldTrip] ft_timelockstatistics design matrix

Elif Tülay e.eliftulay at gmail.com
Fri Jun 24 20:58:55 CEST 2022


 Dear Jaewon,

I just want to ask in order to be sure. For example HH_timelock variable
contains all the participants like the attached format. Each struct
contains FieldTrip output fields for each participants.Then you can
use  HH_timelock{:}.
If your dataset is not in this format, maybe you can try this way once more.

On Fri, Jun 24, 2022 at 1:27 PM "오재원" via fieldtrip <fieldtrip at science.ru.nl>
wrote:

> Dear Julian,
>
>
> Thank you for the response. Yes, I have tried adding {:} after each
> structure but Matlab said {:} cannot be attached to 'structure'.
>
> So I tried altering the structures to cell arrays and then adding {:} to
> the cell arrays as the following codes:
>
>
> %% permutation test statistical analysis
>
> HH_timelock = struct2cell(HH_timelock);
>
> HN_timelock = struct2cell(HN_timelock);
>
> LH_timelock = struct2cell(LH_timelock);
>
> LN_timelock = struct2cell(LN_timelock);
>
>
> [stat] = ft_timelockstatistics(cfg, HH_timelock{:}, HN_timelock{:},
> LH_timelock{:}, LN_timelock{:});
>
>
> But it did not work.
>
>
> Error: matlab.internal.doc.updateConnectorDocroot (Line 3)
>
>     options = weboptions('RequestMethod','post', ...
>
>
>
> Warning: Your path is set up incorrectly. You probably used
> addpath(genpath('path_to_fieldtrip')), this can lead to
>
> unexpected behavior. See
>
>
> http://www.fieldtriptoolbox.org/faq/should_i_add_fieldtrip_with_all_subdirectories_to_my_matlab_path
>
>
> Error: ft_checkdata (538번 라인)
>
> This function requires timelock data as input, see ft_datatype_timelock.
>
>
> Error: ft_timelockstatistics (87번 라인)
>
>   varargin{i} = ft_checkdata(varargin{i}, 'datatype', 'timelock',
> 'feedback', 'no');
>
>
> I am wondering what I can do more at this point.
>
>
> Best,
>
>
> Jaewon
> --------- 원본 메일 ---------
>
> *보낸사람* : Julian Keil via fieldtrip <fieldtrip at science.ru.nl>
> *받는사람* : FieldTrip discussion list <fieldtrip at science.ru.nl>
> *참조* : Julian Keil <julian.keil at gmail.com>
> *받은날짜* : 2022-06-24 (금) 17:27:30
> *제목* : Re: [FieldTrip] ft_timelockstatistics design matrix
> Dear Jaewon,
>
> are "HH_timelock, HN_timelock, LH_timelock, LN_timelock“ your data
> structures containing the single participants?
> Have you tried adding {:} after the structures (e.g., HH_timelock{:},
> HN_timelock{:}, LH_timelock{:}, LN_timelock{:})?
> Are the same numbers of participants in all structures?
>
> Good luck,
>
> Julian
>
>
> Am 24.06.2022 um 09:33 schrieb 오재원 via fieldtrip <fieldtrip at science.ru.nl
> >:
>
>
> Hello,
>
> I was trying cluster-based permutation using ft_timlockstatistics, but I
> got an error regarding design matrix.
> The code I used is as following:
>
> %% Permutation test
>
> [ftver, ftpath] = ft_version;
>
> cd(fullfile(ftpath, 'template', 'electrode'));
>
> elec = ft_read_sens('standard_1020.elc');
>
> % there are some of which the orientation cannot be determined (T3, T4,
> T5, T6)
>
> ft_plot_sens(elec, 'label', 'yes', 'elecshape', 'disc', 'elecsize', 10,
> 'facecolor', [0.8 0.8 1.0])
>
> % give it a stronger 3D appearance
>
> camlight headlight
>
> cfg = [];
>
> cfg.elec = elec;
>
> cfg.channel = {'Fp1', 'Fpz', 'Fp2', 'F7', 'F3', 'Fz', 'F4', 'F8', 'T7',
> 'C3', 'Cz', 'C4', 'T8', 'P7', 'P3', 'Pz', 'P4', 'P8', 'O1', 'Oz', 'O2'};
>
> cfg.method = 'distance';
>
> cfg.feedback = 'yes';
>
> cfg.neighbourdist = 100;
>
> neighbours = ft_prepare_neighbours(cfg);
>
> design = [1:nSubjs 1:nSubjs 1:nSubjs 1:nSubjs; ones(1,nSubjs)
> ones(1,nSubjs)*2 ones(1,nSubjs)*3 ones(1,nSubjs)*4];
>
> cfg         = [];
>
> cfg.channel = {'EEG'};
>
> cfg.latency = [0 0.6];
>
> cfg.method           = 'ft_statistics_montecarlo';
>
> cfg.clusterthreshold = 'nonparametric_common';
>
> cfg.neighbours = neighbours;
>
> cfg.statistic        = 'ft_statfun_depsamplesFmultivariate';
>
> cfg.correctm         = 'cluster';
>
> cfg.clusteralpha     = 0.05;
>
> cfg.clusterstatistic = 'maxsum';
>
> cfg.minnbchan        = 2;
>
> cfg.tail             = 0;
>
> cfg.clustertail      = 0;
>
> cfg.alpha            = 0.025;
>
> cfg.numrandomization = 500;
>
> cfg.design = design;
>
> cfg.uvar   = 1;
>
> cfg.ivar   = 2;
>
>
> %% permutation test statistical analysis
>
> [stat] = ft_timelockstatistics(cfg, HH_timelock, HN_timelock, LH_timelock,
> LN_timelock);
>
> And the error message :
>
>  ft_timelockstatistics (172번 라인)
>
> the length of the design matrix (2) does not match the number of
> observations in the data (4)
>
> I could not find any problem in my code and I followed the way the
> fieldtrip tutorial instructed. I have four conditions and I put four
> repetitions of 1:nSubjs in the unit variable (cfg.uvar) and nSubjs number
> of ones, twos, threes, and fours each in the independent variable
> (cfg.ivar). It would be so grateful if you can tell me how to solve this
> problem. Best, Jaewon
>
> _______________________________________________
> fieldtrip mailing list
> https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
> https://doi.org/10.1371/journal.pcbi.1002202
>
>
>
> _______________________________________________
> fieldtrip mailing list
> https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
> https://doi.org/10.1371/journal.pcbi.1002202
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20220624/5fb4e498/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ss.jpg
Type: image/jpeg
Size: 21341 bytes
Desc: not available
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20220624/5fb4e498/attachment.jpg>


More information about the fieldtrip mailing list