[FieldTrip] Inter-trial Coherence Stats

Casper Kerren CXK699 at student.bham.ac.uk
Fri May 19 09:36:43 CEST 2017


Dear Robert,

Not sure whether I will give an appropriate answer to your question, but it seems like Fieldtrip doesn't like .fourierspctrm, and you could change it to powerspctrm yourself. Like this:

For each participant run the ft_freqanalysis with your specified parameters.
Get the output 'freq' and then


    a       = freq.fourierspctrm;
    tmpli   = abs(mean(a./abs(a),1));   % "manually" compute PLI
    freq.powspctrm = squeeze(tmpli);

    freq.dimord  = 'chan_freq_time';
    freq         = rmfield(freq, 'fourierspctrm');    % remove field "fourierspctrm" because it confuses Fieldtrip
    freq         = rmfield(freq, 'trialinfo');        % trialinfo no longer valid


Of course, when you later run statistics use cfg.parameter = 'powspctrm'

If this wasn't what you were looking for, let me know.

Kind regards,

Casper

From: fieldtrip-bounces at science.ru.nl [mailto:fieldtrip-bounces at science.ru.nl] On Behalf Of Seymour, Robert (Research Student)
Sent: 19 May 2017 07:46
To: fieldtrip at science.ru.nl
Subject: [FieldTrip] Inter-trial Coherence Stats


Dear Fieldtrippers,



I am trying to statistically evaluate inter-trial coherence on a virtual electrode, comparing an active to baseline period.



However I get the following error when using 'diff_ITC' and ft_freqstatistics:


Subscripted assignment dimension mismatch.

Error in ft_freqstatistics (line 141)
    dat(:,i) = tmp(:);




I can't seem to figure out what's going wrong... (code below). Has anyone else come across this error?



Many thanks,



Robert


















%% Script to calculate inter-trial coherence for the alien clicktrain data
subject = sort({'RS','DB','MP','GR','DS','EC','VS','LA','AE','SY','GW',...
    'SW','DK','LH','KM','FL','AN'});

grandavgA = zeros(1,length(subject));
grandavgB = zeros(1,length(subject));

for i = 1:length(subject)

    load(['D:\Pilot\' subject{i} '\auditory\sourceloc\VE_A1_RH.mat']);

    cfg = [];
    cfg.foi = [30:1:80];
    cfg.method = 'mtmconvol';
    cfg.t_ftimwin = ones(length(cfg.foi),1).*0.5;
    cfg.tapsmofrq  = ones(length(cfg.foi),1).*8;
    cfg.toi    = 0:0.01:1.5;
    cfg.output = 'fourier';
    freq_post = (ft_freqanalysis(cfg, VE_A1_RH));
    freq_post.fourierspctrm = (freq_post.fourierspctrm);
    grandavgA{i} = freq_post;

    cfg.toi    = -1.5:0.01:0;
    freq_pre = (ft_freqanalysis(cfg, VE_A1_RH));
    freq_pre.fourierspctrm = (freq_pre.fourierspctrm);
    grandavgB{i} = freq_pre;
end

cfg = [];
cfg.latency          = [0 1.5];
cfg.parameter = 'fourierspctrm';
cfg.frequency        = [30 80];
cfg.method           = 'montecarlo';
cfg.statistic        = 'diff_ITC'
cfg.clusterstatistic = 'maxsum';
cfg.tail             = 0;
cfg.alpha            = 0.05;
cfg.numrandomization = 1000;

% Create design matrix based on specific number of trials from each
% participant
nsubj=numel(grandavgA);
cfg.design(1,:) = [1:nsubj 1:nsubj];
cfg.design(2,:) = [ones(1,nsubj) ones(1,nsubj)*2];
cfg.uvar        = 1; % row of design matrix that contains unit variable (in this case: subjects)
cfg.ivar        = 2; % row of design matrix that contains independent variable (the conditions)

[stat] = ft_freqstatistics(cfg, grandavgA{:}, grandavgB{:});

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20170519/2e19da11/attachment.html>


More information about the fieldtrip mailing list