Back to the main page.

Bug 3425 - Plotting issue with cluster based permutation test

Status CLOSED FIXED
Reported 2018-05-03 12:40:00 +0200
Modified 2019-08-10 12:37:12 +0200
Product: FieldTrip
Component: plotting
Version: unspecified
Hardware: Other
Operating System: Linux
Importance: P5 major
Assigned to:
URL:
Tags:
Depends on:
Blocks:
See also:

Sanjeev Nara - 2018-05-03 12:40:48 +0200

Hi Fieldtrip Experts, I have data of 21 participants recoded during 2 different conditions via Elekta Neuromag. I have computed time frequency response (TFR) for both the conditions and i grandaveraged (ft_freqgrandaverage) them by keeping trials (cfg.keepindividual = 'yes') . Now my input data for cluster test is a 4D matrix representing (21 subjects * 102 channels * 70 frequency bins * 191 time points.) I am using a specific latency (-350 msec ) and different frequency ranges (Delta, Theta . . .) in the code. cfg=[]; cfg_neighb=[]; cfg_neighb.method = 'template'; cfg_neighb.template = 'neuromag306cmb_neighb.mat'; neighbours = ft_prepare_neighbours (cfg_neighb) design=zeros(2,42); design(2,1:21)=1; design(2,22:42)=2; design(1,1:21)=[1:1:21]; %design(1,21:42)=[22:1:42]; design(1,22:42)=[1:1:21]; cfg = []; cfg.method = 'montecarlo'; cfg.statistic = 'depsamplesT'; cfg.neighbours = neighbours; cfg.design = design; cfg.ivar = 2; cfg.uvar = 1; cfg.correctm = 'cluster'; cfg.clusteralpha = 0.05; cfg.clustertail = 0; cfg.clusterstatistic = 'maxsum'; cfg.minnbchan = 2; cfg.alpha = 0.05; cfg.tail = 0; cfg.numrandomization = 100; cfg.avgoverfreq = 'no'; cfg.avgovertime = 'no'; cfg.latency = [-0.35 0]; cfg.fre a = ft_freqstatistics(cfg, cond_2, cond_1) Then i save each statistical analysis as per naming format which describes about the comparison like cond_2_vs_1_Higher_Beta.mat which means i compare cond 2 and 1 in range Higher beta frequency (20 - 30 Hz). I want to plot cluster in time like in what range the cluster is significant in a particular frequency band. Since my bands have a higher range sometimes like 30 - 50 so i have not used average over frequency. for plotting the cluster i am using following codes: stat= cond_2_vs_1_Higher_Beta; [chan freq time] =ind2sub(size(stat.posclusterslabelmat),find(stat.posclusterslabelmat==1)); % calculate the min and max f_min=min(freq); f1=stat.freq(1,f_min); f_max=max(freq); f2=stat.freq(1,f_max); t_min=min(time); t1=stat.time(1,t_min); t_max=max(time); t2=stat.time(1,t_max); freqspec_diff=cond_2; freqspec_diff.powspctrm=(cond_2.powspctrm-cond_1.powspctrm); cfg=[]; cfg.foilim = [f1 f2]; cfg.toilim = [t1 t2]; Diff = ft_freqdescriptives (cfg, freqspec_diff); cl = stat.posclusterslabelmat == 1; % or == 2, or 3 cfg = []; cfg.style = 'straight'; cfg.xlim = [t1 t2]; %cfg.zlim = [-0.05 0.05]; clu_int = any(cl(:,:,:), 3); clu_int2 = any(cl(:,:), 2); cfg.layout = 'neuromag306cmb.lay'; cfg.highlight = 'on'; cfg.gridscale = 300; cfg.neighbours = neighbours; cfg.highlightchannel = find(clu_int2); figure; ft_topoplotTFR(cfg, Diff) I repeat the same stuff for computing a negative cluster. The problem here is i am getting clusters which has a mismatch between * marks and the activations colours. Sometimes it matches and sometimes its random. I have tried everything but it does not resolve. I shall be thankful if you could please help me resolving the bug. Link for the data and cluster plots: https://drive.google.com/drive/folders/1Da7QtVRBJ_x8qZ7jr1pHqpCKx49tX8wO?usp=sharing


Sanjeev Nara - 2018-05-11 17:07:10 +0200

Hi experts, i am able to resolve the issue, Thanks :)


Robert Oostenveld - 2019-08-10 12:37:12 +0200

This closes a whole series of bugs that have been resolved (either FIXED/WONTFIX/INVALID) for quite some time. If you disagree, please file a new issue on https://github.com/fieldtrip/fieldtrip/issues.