|
| 1 | +stemFolder = pwd; |
| 2 | +load([stemFolder filesep 'dummy'],'data'); |
| 3 | + |
| 4 | +cfg_neighb = []; |
| 5 | +cfg_neighb.method = 'template'; |
| 6 | +cfg_neighb.template = 'CTF275_neighb.mat'; |
| 7 | +neighbours = ft_prepare_neighbours(cfg_neighb, data); |
| 8 | + |
| 9 | +%% Gender-Dosage test data set |
| 10 | +% Test data set from: http://personality-project.org/r/r.guide/r.anova.html |
| 11 | + |
| 12 | +% Indep 2x2 ANOVA: factors Gender & dosage on alertness level |
| 13 | + |
| 14 | +% Design matrix for the test data |
| 15 | +design(1,:) = [ones(1,2*4) ones(1,2*4)*2]; % First factor: Gender |
| 16 | +design(2,:) = repmat([ones(1,4) ones(1,4)*2],1,2); % Second Factor: Dosage |
| 17 | + |
| 18 | +data.powspctrm = [8 12 13 12 6 7 23 14 15 12 22 14 15 12 18 22]'; |
| 19 | + |
| 20 | +% Results given at the personality-project.org page |
| 21 | + |
| 22 | +% Df Sum Sq Mean Sq F value Pr(>F) |
| 23 | +% Gender 1 76.562 76.562 2.9518 0.1115 |
| 24 | +% Dosage 1 5.062 5.062 0.1952 0.6665 |
| 25 | +% Gender:Dosage 1 0.063 0.063 0.0024 0.9617 |
| 26 | +% Residuals 12 311.250 25.938 |
| 27 | + |
| 28 | + |
| 29 | + |
| 30 | +%% Specify configuration structure: the dummy data structure consists of a single channel, time bin and frequency of interest |
| 31 | +cfg = []; |
| 32 | + |
| 33 | +cfg.channel = {'MLC11'}; |
| 34 | +cfg.latency = [1 1]; |
| 35 | +cfg.frequency = [4 4]; |
| 36 | +cfg.avgovertime = 'no'; |
| 37 | +cfg.avgoverfreq = 'no'; |
| 38 | +cfg.avgoverchan = 'no'; |
| 39 | + |
| 40 | +cfg.method = 'montecarlo'; |
| 41 | +cfg.correctm = 'cluster'; |
| 42 | +cfg.clusteralpha = 1; % consider all clusters irrespectively of significance |
| 43 | +cfg.clusterstatistic = 'maxsum'; |
| 44 | +cfg.minnbchan = 0; % we are looking at one channel only |
| 45 | + |
| 46 | +cfg.statistic = 'indepAnova2way'; |
| 47 | +cfg.fac = 'iaxb'; % main effect Gender: 'a', main effect Dosage: 'b' and interaction: 'iaxb' |
| 48 | +cfg.tail = 1; % F-values can only take positive values |
| 49 | +cfg.clustertail = 1; |
| 50 | +cfg.design = design; |
| 51 | +cfg.neighbours = neighbours; |
| 52 | +cfg.numrandomization = 999; % number of permutations |
| 53 | + |
| 54 | + |
| 55 | + |
| 56 | + %% define permutation strategies |
| 57 | + main_exact_flag = 'yes'; |
| 58 | + switch cfg.fac |
| 59 | + case 'a' |
| 60 | + switch main_exact_flag |
| 61 | + case 'no' % unrestricted permutations across levels of both factors |
| 62 | + cfg.ivar = [1 2]; |
| 63 | + cfg.wvar = []; |
| 64 | + cfg.uvar = []; |
| 65 | + cfg.cvar = []; |
| 66 | + case 'yes' % restricted permutations within levels of the other factor (exact test) |
| 67 | + cfg.ivar = [1 2]; |
| 68 | + cfg.wvar = []; |
| 69 | + cfg.uvar = []; |
| 70 | + cfg.cvar = 2; |
| 71 | + end |
| 72 | + |
| 73 | + case 'b' |
| 74 | + switch main_exact_flag |
| 75 | + case 'no' |
| 76 | + cfg.ivar = [1 2]; |
| 77 | + cfg.wvar = []; |
| 78 | + cfg.uvar = []; |
| 79 | + cfg.cvar = []; |
| 80 | + case 'yes' |
| 81 | + cfg.ivar = [1 2]; |
| 82 | + cfg.wvar = []; |
| 83 | + cfg.uvar = []; |
| 84 | + cfg.cvar = 1; |
| 85 | + end |
| 86 | + |
| 87 | + case 'iaxb' % unrestricted permutations across levels of both factors |
| 88 | + cfg.ivar = [1 2]; |
| 89 | + cfg.wvar = []; |
| 90 | + cfg.uvar = []; |
| 91 | + cfg.cvar = []; |
| 92 | + end |
| 93 | + |
| 94 | +stat = ft_freqstatistics(cfg, data); |
0 commit comments