From s.mohr at PSY.GLA.AC.UK Tue Nov 3 14:30:14 2009 From: s.mohr at PSY.GLA.AC.UK (Sibylle Mohr) Date: Tue, 3 Nov 2009 14:30:14 +0100 Subject: multiplotTFR goes wrong Message-ID: Dear Fieldtrippers, I have a problem concerning multiplotTFR, which I did not have a couple of months ago: I import 4 conditions (lexical match/lexical mismatch and stereotypical match / stereotypical mismatch). After doing a multitaper analysis for different frequencies I do a baseline correction using 'zscore' across the averaged trials for each condition. When I plot the resulting zscore corrected conditions using multiploTFR contrasting 'lexical mismatch' with 'lexical match' and afterwards 'stereotypical mismatch' with 'stereotypical match', it looks like the stereotypical conditions are almost the inverse plot of my lexical conditions. I always clear the cfg before I start a new plot. I also use cfg.interactive = 'yes'. Any ideas why this is happening..? I'll attach the scripts for the multitaper analysis, the baseline correction, and for the plotting. Thanks, Sibylle ----------------------- MULTITAPER ANALYSIS function hifreq_ana % anaphora files: high frequencies % BESA datafiles in one condition filename_ana{1} = { 'An1_sb1_lexmatch-export.dat' 'An1_sb9_lexmatch-export.dat' 'An1_sb13_lexmatch-export.dat' 'An1_sb17_lexmatch-export.dat' 'An1_sb21_lexmatch-export.dat' 'An2_sb2_lexmatch-export.dat' 'An2_sb6_lexmatch-export.dat' 'An2_sb10_lexmatch-export.dat' 'An2_sb18_lexmatch-export.dat' 'An2_sb22_lexmatch-export.dat' 'An3_sb3_lexmatch-export.dat' 'An3_sb7_lexmatch-export.dat' 'An3_sb11_lexmatch-export.dat' 'An3_sb15_lexmatch-export.dat' 'An3_sb23_lexmatch-export.dat' 'An4_sb4_lexmatch-export.dat' 'An4_sb8_lexmatch-export.dat' 'An4_sb12_lexmatch-export.dat' 'An4_sb16_lexmatch-export.dat' 'An4_sb24_lexmatch-export.dat' }; % BESA datafiles in the other condition filename_ana{2} = { 'An1_sb1_lexmis-export.dat' 'An1_sb9_lexmis-export.dat' 'An1_sb13_lexmis-export.dat' 'An1_sb17_lexmis-export.dat' 'An1_sb21_lexmis-export.dat' 'An2_sb2_lexmis-export.dat' 'An2_sb6_lexmis-export.dat' 'An2_sb10_lexmis-export.dat' 'An2_sb18_lexmis-export.dat' 'An2_sb22_lexmis-export.dat' 'An3_sb3_lexmis-export.dat' 'An3_sb7_lexmis-export.dat' 'An3_sb11_lexmis-export.dat' 'An3_sb15_lexmis-export.dat' 'An3_sb23_lexmis-export.dat' 'An4_sb4_lexmis-export.dat' 'An4_sb8_lexmis-export.dat' 'An4_sb12_lexmis-export.dat' 'An4_sb16_lexmis-export.dat' 'An4_sb24_lexmis-export.dat' }; filename_ana{3} = { 'An1_sb1_stermatch-export.dat' 'An1_sb9_stermatch-export.dat' 'An1_sb13_stermatch-export.dat' 'An1_sb17_stermatch-export.dat' 'An1_sb21_stermatch-export.dat' 'An2_sb2_stermatch-export.dat' 'An2_sb6_stermatch-export.dat' 'An2_sb10_stermatch-export.dat' 'An2_sb18_stermatch-export.dat' 'An2_sb22_stermatch-export.dat' 'An3_sb3_stermatch-export.dat' 'An3_sb7_stermatch-export.dat' 'An3_sb11_stermatch-export.dat' 'An3_sb15_stermatch-export.dat' 'An3_sb23_stermatch-export.dat' 'An4_sb4_stermatch-export.dat' 'An4_sb8_stermatch-export.dat' 'An4_sb12_stermatch-export.dat' 'An4_sb16_stermatch-export.dat' 'An4_sb24_stermatch-export.dat' }; % BESA datafiles in the other condition filename_ana{4} = { 'An1_sb1_stermis-export.dat' 'An1_sb9_stermis-export.dat' 'An1_sb13_stermis-export.dat' 'An1_sb17_stermis-export.dat' 'An1_sb21_stermis-export.dat' 'An2_sb2_stermis-export.dat' 'An2_sb6_stermis-export.dat' 'An2_sb10_stermis-export.dat' 'An2_sb18_stermis-export.dat' 'An2_sb22_stermis-export.dat' 'An3_sb3_stermis-export.dat' 'An3_sb7_stermis-export.dat' 'An3_sb11_stermis-export.dat' 'An3_sb15_stermis-export.dat' 'An3_sb23_stermis-export.dat' 'An4_sb4_stermis-export.dat' 'An4_sb8_stermis-export.dat' 'An4_sb12_stermis-export.dat' 'An4_sb16_stermis-export.dat' 'An4_sb24_stermis-export.dat' }; ncond = length(filename_ana); nsubj = length(filename_ana{1}); tmp = importdata('New_elect72.elp'); for j = 1:ncond clear data for i=1:nsubj data = besa2fieldtrip(filename_ana{j}{i}); % % import electrode file and create electrode arrays % % with coordinates in elp file % % match channel and electrode names data.label = tmp.textdata(:,2); clear cfg; cfg.foi = [30:4:130]; numfoi = length(cfg.foi); cfg.t_ftimwin = zeros(1,numfoi); cfg.t_ftimwin(:) = 0.25; cfg.method = 'mtmconvol'; cfg.output = 'pow'; cfg.toi = [-0.5:0.02:1.5]; cfg.taper = 'dpss'; cfg.tapsmofrq = zeros(1,numfoi); cfg.tapsmofrq(:) = 16; cfg.keeptrials = 'yes'; freqhi = freqanalysis(cfg,data); % change from double to single precision to save space on the harddisk single = struct2single(freqhi); save(sprintf('/analyse/12/Project0042/Gender_new/dat- files_multitaper/anaphora/hi_freq_%d_%d.mat',j,i),'single'); clear single end; % subject loop end; % condition loop exit; --------------------------------------- BASELINE CORRECTION SCRIPT function allfreq_zscores name = {'lex','lexmis','ster','stermis'}; ldir = '/analyse/12/Project0042/Gender_new/dat-files_multitaper/'; path = {'anaphora/','cataphora/'}; frq = {'lo','med'}; pathname = {'ana','cat'}; %pathname = {'cat'}; %................. LO AND MEDIUM FREQUENCY ANALYSIS for p = 1:length(path) for f = 1:length(frq) for i = 1:length(name) load(sprintf('%s%s%s_%s.mat',ldir,path{p},frq{f},name{i})); for j = 1:20 if f == 1 if i == 1 freq = freqlo_lexmatch{j}; elseif i == 2 freq = freqlo_lexmis{j}; elseif i == 3 freq = freqlo_stermatch{j}; elseif i == 4 freq = freqlo_stermis{j}; end; elseif f == 2 if i == 1 freq = freqmed_lexmatch{j}; elseif i == 2 freq = freqmed_lexmis{j}; elseif i == 3 freq = freqmed_stermatch{j}; elseif i == 4 freq = freqmed_stermis{j}; end; end; double = struct2double(freq); clear freq; %... check if there is the trial-dimension or not if length(size(double.powspctrm)) == 4 double = freqdescriptives([],double); end; cfg = []; cfg.baseline = [-0.5 0]; cfg.baselinetype = 'zscore'; freq = freqbaseline(cfg,double); clear double freqdes{j} = struct2single(freq); clear freq end; % subject loop save(sprintf('%s%s_%s_z_%s.mat',ldir,pathname{p},frq{f},name{i}),'freqdes'); clear freqdes end; % condition loop end; % frequency loop end; % path loop %.................. HI FREQUENCY ANALYSIS disp('SWITCHING TO HIGH FREQUENCIES') for p = 1:length(path); %two different paths for i = 1:length(name); %four different conditions for j = 1:20 %(length of subjects) tmp=load(sprintf('%s%shi_freq_%d_%d.mat',ldir,path{p},i,j)); % convert to double before starting calculations double = struct2double(tmp.single); clear freq % average across trials using freqdescriptives double = freqdescriptives([],double); % do baseline normalization across the AVERAGED trials (for normalization % over SINGLE trials, switch around freqdescriptives and freqbaseline) clear cfg; cfg.baseline = [-0.5 0]; cfg.baselinetype = 'zscore'; fqhi = freqbaseline(cfg,double); clear double freqdes{j} = struct2single(fqhi); clear fqhi end; % subject loop/ j-loop %save freqdescriptives of 20 subjets (single precision) into one cell-array, and save that %per condition. save(sprintf('%s%s_hi_z_%s.mat',ldir,pathname{p},name{i}),'freqdes'); clear freqdes end; % condition loop / i-loop end; % path loop exit; -------------------------------------- PLOTTING SCRIPT %.................HI FREQUENCY ANALYSIS PLOTS clear all; load(sprintf('cat_hi_z_lex.mat')); hi_lmatch=freqdes; clear freqdes load(sprintf('cat_hi_z_lexmis.mat')); hi_lmis=freqdes; clear freqdes load(sprintf('cat_hi_z_ster.mat')); hi_smatch=freqdes; clear freqdes load(sprintf('cat_hi_z_stermis.mat')); hi_smis=freqdes; clear freqdes clear grandhi1_lexmatch grandhi1_lmis grandhi1_smatch grandhi1_smis; cfg = []; grandhi1_lmatch = freqgrandaverage(cfg, hi_lmatch{:}); grandhi1_lmis = freqgrandaverage(cfg, hi_lmis{:}); grandhi1_smatch = freqgrandaverage(cfg, hi_smatch{:}); grandhi1_smis = freqgrandaverage(cfg, hi_smis{:}); clear avgdif_a; clear avgdif_b; avgdif_a = grandhi1_lmis; avgdif_a.powspctrm = ((grandhi1_lmis.powspctrm - grandhi1_lmatch.powspctrm)./grandhi1_lmatch.powspctrm).*100; avgdif_b = grandhi1_smis; avgdif_b.powspctrm = ((grandhi1_smis.powspctrm - grandhi1_smatch.powspctrm)./grandhi1_smatch.powspctrm).*100; clear cfg; load('elec.mat'); % scale the electrodes to a realistic head size (in cm) elec.pnt = 10*elec.pnt; clear cfg; cfg= []; cfg.elec = elec; cfg.colorbar = 'yes'; cfg.xparam = 'time'; cfg.yparam = 'freq'; cfg.zparam = 'powspctrm'; cfg.showlabels = 'yes'; cfg.layout = 'sibylle.lay'; cfg.interactive = 'yes'; cfg.title = 'lexical_conditions'; cfg.xlim = ([-0.5 1.5]); cfg.ylim = [30 130]; %cfg.zlim = [-50 50]; figure; multiplotTFR(cfg, avgdif_a); title('FreqHi Cata: lexical match vs. mismatch'); clear cfg; cfg= []; cfg.elec = elec; cfg.colorbar = 'yes'; cfg.xparam = 'time'; cfg.yparam = 'freq'; cfg.zparam = 'powspctrm'; cfg.showlabels = 'yes'; cfg.layout = 'sibylle.lay'; cfg.interactive = 'yes'; cfg.title = 'lexical_conditions'; cfg.xlim = ([-0.5 1.5]); cfg.ylim = [30 130]; %cfg.zlim = [-50 50]; figure; multiplotTFR(cfg, avgdif_b); title('FreqHi Cata: stereotypicalmatch vs. mismatch'); -------------------------------- ---------------------------------- The aim of this list is to facilitate the discussion between users of the FieldTrip toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/neuroimaging/fieldtrip. From akiko at NYU.EDU Sun Nov 8 20:30:35 2009 From: akiko at NYU.EDU (Akiko Ikkai) Date: Sun, 8 Nov 2009 14:30:35 -0500 Subject: artifact rejection with limited time period Message-ID: Hello, I'm looking for a way to run rejectvisual on specific time periods without cropping the epochs. We are working on intracranial EEG data, with eye movement parameters (x,y, pupil) added from the eye tracker. Subjects make eye movements to target in the periphery. Our epoch is between [-1.0 2.5] around the onset of the response phase, where subjects are instructed to make eye movements (usually eye movements are detected around .25 to .35 after the onset of the response phase). I'd like to reject trials where subjects made wrong/unnecessary eye movements during the response phase. Currently, I'm running cfg = []; cfg.alim = 6e3; cfg.method = 'channel'; good = rejectvisual(cfg.ft_data); to visualize eye channels, but I'd like to limit the display only to [0 1.5] around the response phase (eye movements during intertrial interval is not much of a problem for now). I don't think it's a good idea to trim data only to this period, considering I'd like to run ERP and TFR on this data. So, is there any commands I can add to limit the display time periods in rejectvisual, but at the end of the day, I can still keep the intact epochs? Thanks in advance! Akiko ---------------------------------- The aim of this list is to facilitate the discussion between users of the FieldTrip toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/neuroimaging/fieldtrip. From rmontefusco at MED.UCHILE.CL Sun Nov 8 22:16:27 2009 From: rmontefusco at MED.UCHILE.CL (Rodrigo A. Montefusco Siegmund) Date: Sun, 8 Nov 2009 18:16:27 -0300 Subject: artifact rejection with limited time period In-Reply-To: <5fe0dcd43968dc.4af6d60b@mail.nyu.edu> Message-ID: Hi try using this command line cfg.latency = [0 1.5]; I hope it helps best regards Rodrigo > Hello, > > I'm looking for a way to run rejectvisual on specific time periods without > cropping the epochs. We are > working on intracranial EEG data, with eye movement parameters (x,y, > pupil) added from the eye > tracker. Subjects make eye movements to target in the periphery. Our epoch > is between [-1.0 2.5] > around the onset of the response phase, where subjects are instructed to > make eye movements > (usually eye movements are detected around .25 to .35 after the onset of > the response phase). > > I'd like to reject trials where subjects made wrong/unnecessary eye > movements during the response > phase. > > Currently, I'm running > cfg = []; > cfg.alim = 6e3; > cfg.method = 'channel'; > good = rejectvisual(cfg.ft_data); > > to visualize eye channels, but I'd like to limit the display only to [0 > 1.5] around the response phase > (eye movements during intertrial interval is not much of a problem for > now). I don't think it's a good > idea to trim data only to this period, considering I'd like to run ERP and > TFR on this data. > > So, is there any commands I can add to limit the display time periods in > rejectvisual, but at the end of > the day, I can still keep the intact epochs? > > Thanks in advance! Akiko > > ---------------------------------- > The aim of this list is to facilitate the discussion between users of the > FieldTrip toolbox, to share experiences and to discuss new ideas for MEG > and EEG analysis. See also > http://listserv.surfnet.nl/archives/fieldtrip.html and > http://www.ru.nl/neuroimaging/fieldtrip. > =================================== Rodrigo A. Montefusco Siegmund Doctorado en Ciencias Biomédicas Programa de Fisiología y Biofí­sica I. C. B. M. Facultad de Medicina Universidad de Chile Fono: 56 09 82793847 email: rmontefusco at med.uchile.cl =================================== ---------------------------------- The aim of this list is to facilitate the discussion between users of the FieldTrip toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/neuroimaging/fieldtrip. From r.oostenveld at FCDONDERS.RU.NL Mon Nov 9 09:22:53 2009 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Mon, 9 Nov 2009 09:22:53 +0100 Subject: multiplotTFR goes wrong In-Reply-To: Message-ID: Dear Sibylle, Your script looks ok, and I don't recall any changes that might relate to the problem that you are describing. Could you try to run the script using an old version of fieldtrip, corresponding to the original date of your analysis? If the old version and new version then indeed produce inconsistent results, you can look at each of the individual steps to pinpoint the step in the analysis where it goes wrong. To help you perform the analysis with an older fieldtrip version, I have copied some old versions onto the ftp server. All versions of fieldtrip-lite-2009??01.zip are now present, i.e. the first day of each month. I hope this goes back enough. best regards, Robert On 3 Nov 2009, at 14:30, Sibylle Mohr wrote: > Dear Fieldtrippers, > > I have a problem concerning multiplotTFR, which I did not have a > couple of months ago: > I import 4 conditions (lexical match/lexical mismatch and > stereotypical match / > stereotypical mismatch). After doing a multitaper analysis for > different frequencies I do a > baseline correction using 'zscore' across the averaged trials for > each condition. When I > plot the resulting zscore corrected conditions using multiploTFR > contrasting 'lexical > mismatch' with 'lexical match' and afterwards 'stereotypical > mismatch' with 'stereotypical > match', it looks like the stereotypical conditions are almost the > inverse plot of my lexical > conditions. I always clear the cfg before I start a new plot. I also > use cfg.interactive = > 'yes'. Any ideas why this is happening..? > > I'll attach the scripts for the multitaper analysis, the baseline > correction, and for the > plotting. > > Thanks, > > Sibylle > > ----------------------- > MULTITAPER ANALYSIS > > function hifreq_ana > > % anaphora files: high frequencies > > % BESA datafiles in one condition > filename_ana{1} = { > 'An1_sb1_lexmatch-export.dat' > 'An1_sb9_lexmatch-export.dat' > 'An1_sb13_lexmatch-export.dat' > 'An1_sb17_lexmatch-export.dat' > 'An1_sb21_lexmatch-export.dat' > 'An2_sb2_lexmatch-export.dat' > 'An2_sb6_lexmatch-export.dat' > 'An2_sb10_lexmatch-export.dat' > 'An2_sb18_lexmatch-export.dat' > 'An2_sb22_lexmatch-export.dat' > 'An3_sb3_lexmatch-export.dat' > 'An3_sb7_lexmatch-export.dat' > 'An3_sb11_lexmatch-export.dat' > 'An3_sb15_lexmatch-export.dat' > 'An3_sb23_lexmatch-export.dat' > 'An4_sb4_lexmatch-export.dat' > 'An4_sb8_lexmatch-export.dat' > 'An4_sb12_lexmatch-export.dat' > 'An4_sb16_lexmatch-export.dat' > 'An4_sb24_lexmatch-export.dat' > }; > > > % BESA datafiles in the other condition > filename_ana{2} = { > 'An1_sb1_lexmis-export.dat' > 'An1_sb9_lexmis-export.dat' > 'An1_sb13_lexmis-export.dat' > 'An1_sb17_lexmis-export.dat' > 'An1_sb21_lexmis-export.dat' > 'An2_sb2_lexmis-export.dat' > 'An2_sb6_lexmis-export.dat' > 'An2_sb10_lexmis-export.dat' > 'An2_sb18_lexmis-export.dat' > 'An2_sb22_lexmis-export.dat' > 'An3_sb3_lexmis-export.dat' > 'An3_sb7_lexmis-export.dat' > 'An3_sb11_lexmis-export.dat' > 'An3_sb15_lexmis-export.dat' > 'An3_sb23_lexmis-export.dat' > 'An4_sb4_lexmis-export.dat' > 'An4_sb8_lexmis-export.dat' > 'An4_sb12_lexmis-export.dat' > 'An4_sb16_lexmis-export.dat' > 'An4_sb24_lexmis-export.dat' > }; > > filename_ana{3} = { > 'An1_sb1_stermatch-export.dat' > 'An1_sb9_stermatch-export.dat' > 'An1_sb13_stermatch-export.dat' > 'An1_sb17_stermatch-export.dat' > 'An1_sb21_stermatch-export.dat' > 'An2_sb2_stermatch-export.dat' > 'An2_sb6_stermatch-export.dat' > 'An2_sb10_stermatch-export.dat' > 'An2_sb18_stermatch-export.dat' > 'An2_sb22_stermatch-export.dat' > 'An3_sb3_stermatch-export.dat' > 'An3_sb7_stermatch-export.dat' > 'An3_sb11_stermatch-export.dat' > 'An3_sb15_stermatch-export.dat' > 'An3_sb23_stermatch-export.dat' > 'An4_sb4_stermatch-export.dat' > 'An4_sb8_stermatch-export.dat' > 'An4_sb12_stermatch-export.dat' > 'An4_sb16_stermatch-export.dat' > 'An4_sb24_stermatch-export.dat' > }; > > > % BESA datafiles in the other condition > filename_ana{4} = { > 'An1_sb1_stermis-export.dat' > 'An1_sb9_stermis-export.dat' > 'An1_sb13_stermis-export.dat' > 'An1_sb17_stermis-export.dat' > 'An1_sb21_stermis-export.dat' > 'An2_sb2_stermis-export.dat' > 'An2_sb6_stermis-export.dat' > 'An2_sb10_stermis-export.dat' > 'An2_sb18_stermis-export.dat' > 'An2_sb22_stermis-export.dat' > 'An3_sb3_stermis-export.dat' > 'An3_sb7_stermis-export.dat' > 'An3_sb11_stermis-export.dat' > 'An3_sb15_stermis-export.dat' > 'An3_sb23_stermis-export.dat' > 'An4_sb4_stermis-export.dat' > 'An4_sb8_stermis-export.dat' > 'An4_sb12_stermis-export.dat' > 'An4_sb16_stermis-export.dat' > 'An4_sb24_stermis-export.dat' > }; > > ncond = length(filename_ana); > nsubj = length(filename_ana{1}); > > > tmp = importdata('New_elect72.elp'); > > for j = 1:ncond > clear data > > for i=1:nsubj > data = besa2fieldtrip(filename_ana{j}{i}); > % % import electrode file and create electrode arrays > % % with coordinates in elp file > % % match channel and electrode names > data.label = tmp.textdata(:,2); > > clear cfg; > cfg.foi = [30:4:130]; > numfoi = length(cfg.foi); > cfg.t_ftimwin = zeros(1,numfoi); > cfg.t_ftimwin(:) = 0.25; > cfg.method = 'mtmconvol'; > cfg.output = 'pow'; > cfg.toi = [-0.5:0.02:1.5]; > cfg.taper = 'dpss'; > cfg.tapsmofrq = zeros(1,numfoi); > cfg.tapsmofrq(:) = 16; > cfg.keeptrials = 'yes'; > > freqhi = freqanalysis(cfg,data); > % change from double to single precision to save space on the harddisk > single = struct2single(freqhi); > save(sprintf('/analyse/12/Project0042/Gender_new/dat- > files_multitaper/anaphora/hi_freq_%d_%d.mat',j,i),'single'); > clear single > > end; % subject loop > end; % condition loop > exit; > --------------------------------------- > > BASELINE CORRECTION SCRIPT > > function allfreq_zscores > > name = {'lex','lexmis','ster','stermis'}; > ldir = '/analyse/12/Project0042/Gender_new/dat-files_multitaper/'; > path = {'anaphora/','cataphora/'}; > > frq = {'lo','med'}; > pathname = {'ana','cat'}; > %pathname = {'cat'}; > %................. LO AND MEDIUM FREQUENCY ANALYSIS > > for p = 1:length(path) > for f = 1:length(frq) > for i = 1:length(name) > load(sprintf('%s%s%s_%s.mat',ldir,path{p},frq{f},name{i})); > for j = 1:20 > if f == 1 > if i == 1 > freq = freqlo_lexmatch{j}; > elseif i == 2 > freq = freqlo_lexmis{j}; > elseif i == 3 > freq = freqlo_stermatch{j}; > elseif i == 4 > freq = freqlo_stermis{j}; > end; > elseif f == 2 > if i == 1 > freq = freqmed_lexmatch{j}; > elseif i == 2 > freq = freqmed_lexmis{j}; > elseif i == 3 > freq = freqmed_stermatch{j}; > elseif i == 4 > freq = freqmed_stermis{j}; > end; > end; > > double = struct2double(freq); > clear freq; > > %... check if there is the trial-dimension or not > if length(size(double.powspctrm)) == 4 > double = freqdescriptives([],double); > end; > > cfg = []; > cfg.baseline = [-0.5 0]; > cfg.baselinetype = 'zscore'; > freq = freqbaseline(cfg,double); > clear double > > freqdes{j} = struct2single(freq); > clear freq > end; % subject loop > save(sprintf('%s%s_%s_z_ > %s.mat',ldir,pathname{p},frq{f},name{i}),'freqdes'); > clear freqdes > end; % condition loop > end; % frequency loop > end; % path loop > > %.................. HI FREQUENCY ANALYSIS > > disp('SWITCHING TO HIGH FREQUENCIES') > > for p = 1:length(path); %two different paths > for i = 1:length(name); %four different conditions > for j = 1:20 %(length of subjects) > tmp=load(sprintf('%s%shi_freq_%d_%d.mat',ldir,path{p},i,j)); > > % convert to double before starting calculations > double = struct2double(tmp.single); > clear freq > > % average across trials using freqdescriptives > double = freqdescriptives([],double); > > % do baseline normalization across the AVERAGED trials (for > normalization > % over SINGLE trials, switch around freqdescriptives and freqbaseline) > clear cfg; > cfg.baseline = [-0.5 0]; > cfg.baselinetype = 'zscore'; > fqhi = freqbaseline(cfg,double); > clear double > > freqdes{j} = struct2single(fqhi); > clear fqhi > end; % subject loop/ j-loop > %save freqdescriptives of 20 subjets (single precision) into one > cell-array, and save that > %per condition. > save(sprintf('%s%s_hi_z_%s.mat',ldir,pathname{p},name{i}),'freqdes'); > clear freqdes > end; % condition loop / i-loop > end; % path loop > exit; > > -------------------------------------- > > PLOTTING SCRIPT > > %.................HI FREQUENCY ANALYSIS PLOTS > > clear all; > load(sprintf('cat_hi_z_lex.mat')); > hi_lmatch=freqdes; > clear freqdes > > load(sprintf('cat_hi_z_lexmis.mat')); > hi_lmis=freqdes; > clear freqdes > > load(sprintf('cat_hi_z_ster.mat')); > hi_smatch=freqdes; > clear freqdes > > load(sprintf('cat_hi_z_stermis.mat')); > hi_smis=freqdes; > clear freqdes > > > clear grandhi1_lexmatch grandhi1_lmis grandhi1_smatch grandhi1_smis; > cfg = []; > grandhi1_lmatch = freqgrandaverage(cfg, hi_lmatch{:}); > grandhi1_lmis = freqgrandaverage(cfg, hi_lmis{:}); > grandhi1_smatch = freqgrandaverage(cfg, hi_smatch{:}); > grandhi1_smis = freqgrandaverage(cfg, hi_smis{:}); > > clear avgdif_a; > clear avgdif_b; > avgdif_a = grandhi1_lmis; > avgdif_a.powspctrm = ((grandhi1_lmis.powspctrm - > grandhi1_lmatch.powspctrm)./grandhi1_lmatch.powspctrm).*100; > > avgdif_b = grandhi1_smis; > avgdif_b.powspctrm = ((grandhi1_smis.powspctrm - > grandhi1_smatch.powspctrm)./grandhi1_smatch.powspctrm).*100; > > clear cfg; > load('elec.mat'); > % scale the electrodes to a realistic head size (in cm) > elec.pnt = 10*elec.pnt; > clear cfg; > cfg= []; > cfg.elec = elec; > cfg.colorbar = 'yes'; > cfg.xparam = 'time'; > cfg.yparam = 'freq'; > cfg.zparam = 'powspctrm'; > cfg.showlabels = 'yes'; > cfg.layout = 'sibylle.lay'; > cfg.interactive = 'yes'; > cfg.title = 'lexical_conditions'; > cfg.xlim = ([-0.5 1.5]); > cfg.ylim = [30 130]; > %cfg.zlim = [-50 50]; > figure; multiplotTFR(cfg, avgdif_a); > title('FreqHi Cata: lexical match vs. mismatch'); > > clear cfg; > cfg= []; > cfg.elec = elec; > cfg.colorbar = 'yes'; > cfg.xparam = 'time'; > cfg.yparam = 'freq'; > cfg.zparam = 'powspctrm'; > cfg.showlabels = 'yes'; > cfg.layout = 'sibylle.lay'; > cfg.interactive = 'yes'; > cfg.title = 'lexical_conditions'; > cfg.xlim = ([-0.5 1.5]); > cfg.ylim = [30 130]; > %cfg.zlim = [-50 50]; > figure; multiplotTFR(cfg, avgdif_b); > title('FreqHi Cata: stereotypicalmatch vs. mismatch'); > -------------------------------- > > ---------------------------------- > The aim of this list is to facilitate the discussion between users > of the FieldTrip toolbox, to share experiences and to discuss new > ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html > and http://www.ru.nl/neuroimaging/fieldtrip. > ---------------------------------- The aim of this list is to facilitate the discussion between users of the FieldTrip toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/neuroimaging/fieldtrip. From s.mohr at PSY.GLA.AC.UK Mon Nov 9 13:37:45 2009 From: s.mohr at PSY.GLA.AC.UK (sibylle) Date: Mon, 9 Nov 2009 12:37:45 +0000 Subject: multiplotTFR goes wrong In-Reply-To: <599BA806-FDC8-4695-AF49-E9028B727CBF@fcdonders.ru.nl> Message-ID: Dear Robert, thanks a lot for your reply! As you suggested, I will give it a try with an old fieldtrip version. Cheers & best wishes, Sibylle On 9 Nov 2009, at 08:22, Robert Oostenveld wrote: > Dear Sibylle, > > Your script looks ok, and I don't recall any changes that might > relate to the problem that you are describing. Could you try to run > the script using an old version of fieldtrip, corresponding to the > original date of your analysis? If the old version and new version > then indeed produce inconsistent results, you can look at each of > the individual steps to pinpoint the step in the analysis where it > goes wrong. > > To help you perform the analysis with an older fieldtrip version, I > have copied some old versions onto the ftp server. All versions of > fieldtrip-lite-2009??01.zip are now present, i.e. the first day of > each month. I hope this goes back enough. > > best regards, > Robert > > > On 3 Nov 2009, at 14:30, Sibylle Mohr wrote: > >> Dear Fieldtrippers, >> >> I have a problem concerning multiplotTFR, which I did not have a >> couple of months ago: >> I import 4 conditions (lexical match/lexical mismatch and >> stereotypical match / >> stereotypical mismatch). After doing a multitaper analysis for >> different frequencies I do a >> baseline correction using 'zscore' across the averaged trials for >> each condition. When I >> plot the resulting zscore corrected conditions using multiploTFR >> contrasting 'lexical >> mismatch' with 'lexical match' and afterwards 'stereotypical >> mismatch' with 'stereotypical >> match', it looks like the stereotypical conditions are almost the >> inverse plot of my lexical >> conditions. I always clear the cfg before I start a new plot. I >> also use cfg.interactive = >> 'yes'. Any ideas why this is happening..? >> >> I'll attach the scripts for the multitaper analysis, the baseline >> correction, and for the >> plotting. >> >> Thanks, >> >> Sibylle >> >> ----------------------- >> MULTITAPER ANALYSIS >> >> function hifreq_ana >> >> % anaphora files: high frequencies >> >> % BESA datafiles in one condition >> filename_ana{1} = { >> 'An1_sb1_lexmatch-export.dat' >> 'An1_sb9_lexmatch-export.dat' >> 'An1_sb13_lexmatch-export.dat' >> 'An1_sb17_lexmatch-export.dat' >> 'An1_sb21_lexmatch-export.dat' >> 'An2_sb2_lexmatch-export.dat' >> 'An2_sb6_lexmatch-export.dat' >> 'An2_sb10_lexmatch-export.dat' >> 'An2_sb18_lexmatch-export.dat' >> 'An2_sb22_lexmatch-export.dat' >> 'An3_sb3_lexmatch-export.dat' >> 'An3_sb7_lexmatch-export.dat' >> 'An3_sb11_lexmatch-export.dat' >> 'An3_sb15_lexmatch-export.dat' >> 'An3_sb23_lexmatch-export.dat' >> 'An4_sb4_lexmatch-export.dat' >> 'An4_sb8_lexmatch-export.dat' >> 'An4_sb12_lexmatch-export.dat' >> 'An4_sb16_lexmatch-export.dat' >> 'An4_sb24_lexmatch-export.dat' >> }; >> >> >> % BESA datafiles in the other condition >> filename_ana{2} = { >> 'An1_sb1_lexmis-export.dat' >> 'An1_sb9_lexmis-export.dat' >> 'An1_sb13_lexmis-export.dat' >> 'An1_sb17_lexmis-export.dat' >> 'An1_sb21_lexmis-export.dat' >> 'An2_sb2_lexmis-export.dat' >> 'An2_sb6_lexmis-export.dat' >> 'An2_sb10_lexmis-export.dat' >> 'An2_sb18_lexmis-export.dat' >> 'An2_sb22_lexmis-export.dat' >> 'An3_sb3_lexmis-export.dat' >> 'An3_sb7_lexmis-export.dat' >> 'An3_sb11_lexmis-export.dat' >> 'An3_sb15_lexmis-export.dat' >> 'An3_sb23_lexmis-export.dat' >> 'An4_sb4_lexmis-export.dat' >> 'An4_sb8_lexmis-export.dat' >> 'An4_sb12_lexmis-export.dat' >> 'An4_sb16_lexmis-export.dat' >> 'An4_sb24_lexmis-export.dat' >> }; >> >> filename_ana{3} = { >> 'An1_sb1_stermatch-export.dat' >> 'An1_sb9_stermatch-export.dat' >> 'An1_sb13_stermatch-export.dat' >> 'An1_sb17_stermatch-export.dat' >> 'An1_sb21_stermatch-export.dat' >> 'An2_sb2_stermatch-export.dat' >> 'An2_sb6_stermatch-export.dat' >> 'An2_sb10_stermatch-export.dat' >> 'An2_sb18_stermatch-export.dat' >> 'An2_sb22_stermatch-export.dat' >> 'An3_sb3_stermatch-export.dat' >> 'An3_sb7_stermatch-export.dat' >> 'An3_sb11_stermatch-export.dat' >> 'An3_sb15_stermatch-export.dat' >> 'An3_sb23_stermatch-export.dat' >> 'An4_sb4_stermatch-export.dat' >> 'An4_sb8_stermatch-export.dat' >> 'An4_sb12_stermatch-export.dat' >> 'An4_sb16_stermatch-export.dat' >> 'An4_sb24_stermatch-export.dat' >> }; >> >> >> % BESA datafiles in the other condition >> filename_ana{4} = { >> 'An1_sb1_stermis-export.dat' >> 'An1_sb9_stermis-export.dat' >> 'An1_sb13_stermis-export.dat' >> 'An1_sb17_stermis-export.dat' >> 'An1_sb21_stermis-export.dat' >> 'An2_sb2_stermis-export.dat' >> 'An2_sb6_stermis-export.dat' >> 'An2_sb10_stermis-export.dat' >> 'An2_sb18_stermis-export.dat' >> 'An2_sb22_stermis-export.dat' >> 'An3_sb3_stermis-export.dat' >> 'An3_sb7_stermis-export.dat' >> 'An3_sb11_stermis-export.dat' >> 'An3_sb15_stermis-export.dat' >> 'An3_sb23_stermis-export.dat' >> 'An4_sb4_stermis-export.dat' >> 'An4_sb8_stermis-export.dat' >> 'An4_sb12_stermis-export.dat' >> 'An4_sb16_stermis-export.dat' >> 'An4_sb24_stermis-export.dat' >> }; >> >> ncond = length(filename_ana); >> nsubj = length(filename_ana{1}); >> >> >> tmp = importdata('New_elect72.elp'); >> >> for j = 1:ncond >> clear data >> >> for i=1:nsubj >> data = besa2fieldtrip(filename_ana{j}{i}); >> % % import electrode file and create electrode arrays >> % % with coordinates in elp file >> % % match channel and electrode names >> data.label = tmp.textdata(:,2); >> >> clear cfg; >> cfg.foi = [30:4:130]; >> numfoi = length(cfg.foi); >> cfg.t_ftimwin = zeros(1,numfoi); >> cfg.t_ftimwin(:) = 0.25; >> cfg.method = 'mtmconvol'; >> cfg.output = 'pow'; >> cfg.toi = [-0.5:0.02:1.5]; >> cfg.taper = 'dpss'; >> cfg.tapsmofrq = zeros(1,numfoi); >> cfg.tapsmofrq(:) = 16; >> cfg.keeptrials = 'yes'; >> >> freqhi = freqanalysis(cfg,data); >> % change from double to single precision to save space on the >> harddisk >> single = struct2single(freqhi); >> save(sprintf('/analyse/12/Project0042/Gender_new/dat- >> files_multitaper/anaphora/hi_freq_%d_%d.mat',j,i),'single'); >> clear single >> >> end; % subject loop >> end; % condition loop >> exit; >> --------------------------------------- >> >> BASELINE CORRECTION SCRIPT >> >> function allfreq_zscores >> >> name = {'lex','lexmis','ster','stermis'}; >> ldir = '/analyse/12/Project0042/Gender_new/dat-files_multitaper/'; >> path = {'anaphora/','cataphora/'}; >> >> frq = {'lo','med'}; >> pathname = {'ana','cat'}; >> %pathname = {'cat'}; >> %................. LO AND MEDIUM FREQUENCY ANALYSIS >> >> for p = 1:length(path) >> for f = 1:length(frq) >> for i = 1:length(name) >> load(sprintf('%s%s%s_%s.mat',ldir,path{p},frq{f},name{i})); >> for j = 1:20 >> if f == 1 >> if i == 1 >> freq = freqlo_lexmatch{j}; >> elseif i == 2 >> freq = freqlo_lexmis{j}; >> elseif i == 3 >> freq = freqlo_stermatch{j}; >> elseif i == 4 >> freq = freqlo_stermis{j}; >> end; >> elseif f == 2 >> if i == 1 >> freq = freqmed_lexmatch{j}; >> elseif i == 2 >> freq = freqmed_lexmis{j}; >> elseif i == 3 >> freq = freqmed_stermatch{j}; >> elseif i == 4 >> freq = freqmed_stermis{j}; >> end; >> end; >> >> double = struct2double(freq); >> clear freq; >> >> %... check if there is the trial-dimension or not >> if length(size(double.powspctrm)) == 4 >> double = freqdescriptives([],double); >> end; >> >> cfg = []; >> cfg.baseline = [-0.5 0]; >> cfg.baselinetype = 'zscore'; >> freq = freqbaseline(cfg,double); >> clear double >> >> freqdes{j} = struct2single(freq); >> clear freq >> end; % subject loop >> save(sprintf('%s%s_%s_z_ >> %s.mat',ldir,pathname{p},frq{f},name{i}),'freqdes'); >> clear freqdes >> end; % condition loop >> end; % frequency loop >> end; % path loop >> >> %.................. HI FREQUENCY ANALYSIS >> >> disp('SWITCHING TO HIGH FREQUENCIES') >> >> for p = 1:length(path); %two different paths >> for i = 1:length(name); %four different conditions >> for j = 1:20 %(length of subjects) >> tmp=load(sprintf('%s%shi_freq_%d_%d.mat',ldir,path{p},i,j)); >> >> % convert to double before starting calculations >> double = struct2double(tmp.single); >> clear freq >> >> % average across trials using freqdescriptives >> double = freqdescriptives([],double); >> >> % do baseline normalization across the AVERAGED trials (for >> normalization >> % over SINGLE trials, switch around freqdescriptives and >> freqbaseline) >> clear cfg; >> cfg.baseline = [-0.5 0]; >> cfg.baselinetype = 'zscore'; >> fqhi = freqbaseline(cfg,double); >> clear double >> >> freqdes{j} = struct2single(fqhi); >> clear fqhi >> end; % subject loop/ j-loop >> %save freqdescriptives of 20 subjets (single precision) into one >> cell-array, and save that >> %per condition. >> save(sprintf('%s%s_hi_z_%s.mat',ldir,pathname{p},name{i}),'freqdes'); >> clear freqdes >> end; % condition loop / i-loop >> end; % path loop >> exit; >> >> -------------------------------------- >> >> PLOTTING SCRIPT >> >> %.................HI FREQUENCY ANALYSIS PLOTS >> >> clear all; >> load(sprintf('cat_hi_z_lex.mat')); >> hi_lmatch=freqdes; >> clear freqdes >> >> load(sprintf('cat_hi_z_lexmis.mat')); >> hi_lmis=freqdes; >> clear freqdes >> >> load(sprintf('cat_hi_z_ster.mat')); >> hi_smatch=freqdes; >> clear freqdes >> >> load(sprintf('cat_hi_z_stermis.mat')); >> hi_smis=freqdes; >> clear freqdes >> >> >> clear grandhi1_lexmatch grandhi1_lmis grandhi1_smatch grandhi1_smis; >> cfg = []; >> grandhi1_lmatch = freqgrandaverage(cfg, hi_lmatch{:}); >> grandhi1_lmis = freqgrandaverage(cfg, hi_lmis{:}); >> grandhi1_smatch = freqgrandaverage(cfg, hi_smatch{:}); >> grandhi1_smis = freqgrandaverage(cfg, hi_smis{:}); >> >> clear avgdif_a; >> clear avgdif_b; >> avgdif_a = grandhi1_lmis; >> avgdif_a.powspctrm = ((grandhi1_lmis.powspctrm - >> grandhi1_lmatch.powspctrm)./grandhi1_lmatch.powspctrm).*100; >> >> avgdif_b = grandhi1_smis; >> avgdif_b.powspctrm = ((grandhi1_smis.powspctrm - >> grandhi1_smatch.powspctrm)./grandhi1_smatch.powspctrm).*100; >> >> clear cfg; >> load('elec.mat'); >> % scale the electrodes to a realistic head size (in cm) >> elec.pnt = 10*elec.pnt; >> clear cfg; >> cfg= []; >> cfg.elec = elec; >> cfg.colorbar = 'yes'; >> cfg.xparam = 'time'; >> cfg.yparam = 'freq'; >> cfg.zparam = 'powspctrm'; >> cfg.showlabels = 'yes'; >> cfg.layout = 'sibylle.lay'; >> cfg.interactive = 'yes'; >> cfg.title = 'lexical_conditions'; >> cfg.xlim = ([-0.5 1.5]); >> cfg.ylim = [30 130]; >> %cfg.zlim = [-50 50]; >> figure; multiplotTFR(cfg, avgdif_a); >> title('FreqHi Cata: lexical match vs. mismatch'); >> >> clear cfg; >> cfg= []; >> cfg.elec = elec; >> cfg.colorbar = 'yes'; >> cfg.xparam = 'time'; >> cfg.yparam = 'freq'; >> cfg.zparam = 'powspctrm'; >> cfg.showlabels = 'yes'; >> cfg.layout = 'sibylle.lay'; >> cfg.interactive = 'yes'; >> cfg.title = 'lexical_conditions'; >> cfg.xlim = ([-0.5 1.5]); >> cfg.ylim = [30 130]; >> %cfg.zlim = [-50 50]; >> figure; multiplotTFR(cfg, avgdif_b); >> title('FreqHi Cata: stereotypicalmatch vs. mismatch'); >> -------------------------------- >> >> ---------------------------------- >> The aim of this list is to facilitate the discussion between users >> of the FieldTrip toolbox, to share experiences and to discuss new >> ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html >> and http://www.ru.nl/neuroimaging/fieldtrip. >> > > ---------------------------------- > The aim of this list is to facilitate the discussion between users > of the FieldTrip toolbox, to share experiences and to discuss new > ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html > and http://www.ru.nl/neuroimaging/fieldtrip. ---------------------------------- The aim of this list is to facilitate the discussion between users of the FieldTrip toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/neuroimaging/fieldtrip. From a.stolk at FCDONDERS.RU.NL Tue Nov 10 17:39:49 2009 From: a.stolk at FCDONDERS.RU.NL (a.stolk@fcdonders.ru.nl) Date: Tue, 10 Nov 2009 17:39:49 +0100 Subject: data.label wrong after componentanalysis? In-Reply-To: <21188527.945751257871085522.JavaMail.root@watertor.uci.ru.nl> Message-ID: Hi Nathan, I managed to simulate your problem. The intersect function does indeed find matching labels (desired) and then orders those alphabetically (undesired). The most practical solution is to use 'match_str' which only matches the channelindices and, thus, does not give back your labelarray in alphabetical order. For example; [ai, bi] = match_str(a, b) with a = [1 2 3 4] (here in numbers, but should be strings) and b = [3 2] gives ai = [2 3] and bi = [2 1] I therefore replaced cfg.channel = intersect(cfg.channel, cfg.topolabel); with tmpchan = match_str(cfg.channel, cfg.topolabel); cfg.channel = cfg.channel(tmpchan); and everything worked fine here: data.cfg.channel = tmpcomp.cfg.channel. You'll find this replacement in tomorrow's version of FT. Thanks for your clear explanation and please let me know if these changes appear to be problematic to your analysis. Friendly regards, Arjen ----- Original Message ----- From: "Nathan Weisz" To: FIELDTRIP at NIC.SURFNET.NL Sent: Monday, October 26, 2009 9:17:31 PM GMT +01:00 Amsterdam / Berlin / Bern / Rome / Stockholm / Vienna Subject: [FIELDTRIP] data.label wrong after componentanalysis? hi everyone, for an analysis of EEG data i'm doing some ICA cleaning. since there are many conditions / epochs, i do the ICA on a subset of trials and then apply the calculated mixing matrix to the individual conditions. i noticed (and i'm quite sure it's no user related error) that after rejecting components and reconstructing the preprocessing data structure, that the sequence in data.label has changed (apparently into alphabetical order). however that rows in the 2-D matrices making up data.trial(xy) have not changed, accordingly. i noticed because the topography of the auditory N1 was a huge mess. changing the labels solved the problem, i.e.: ica_cleaned_data.label = data_before_ica_cleaning.label; for those interested here the original code: load([outdir '/dataB1F1.mat'], 'dataB1F1') %load data for one condition cfg=[]; cfg.topo=comp.topo; cfg.topolabel=comp.topolabel; tmpcomp=componentanalysis(cfg,dataB1F1); %apply precomputed ICA to condition cfg=[]; cfg.component=ncmp; dataB1F1=rejectcomponent(cfg, tmpcomp); %reject components obviously representing artefacts >> [comp.cfg.channel(1:5) tmpcomp.cfg.channel(1:5)] %demonstrate channel label mismatch ans = 'Lm' 'L1' 'LE1' 'L10' 'LE2' 'L11' 'LE3' 'L12' 'LD2' 'L13' the crucial line appears to be in componentanalysis line 220: cfg.channel = intersect(cfg.channel, cfg.topolabel); intersect sorts the outcome: >> a=randperm(10) a = 7 1 9 3 6 2 5 4 10 8 >> b=randperm(10) b = 6 3 5 1 8 2 10 4 9 7 >> intersect(a,b) ans = 1 2 3 4 5 6 7 8 9 10 since i use all channels, simply replacing the label-field with the original label-field works for me. best, nathan ---------------------------------- The aim of this list is to facilitate the discussion between users of the FieldTrip toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/neuroimaging/fieldtrip. ---------------------------------- The aim of this list is to facilitate the discussion between users of the FieldTrip toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/neuroimaging/fieldtrip. From joseph.brooks at UCL.AC.UK Fri Nov 13 22:21:57 2009 From: joseph.brooks at UCL.AC.UK (Joseph Brooks) Date: Fri, 13 Nov 2009 21:21:57 +0000 Subject: BDF file problems Message-ID: I'm new to Fieldtrip. I am working with Biosemi data (BDF file format). I've come across a problem when defining trials. I've come up with a work-around but I'm interested in whether others have encountered this problem and I want to alert the fieldtrip developers of this potential problem. I've tried it on several BDF files. Here is an example of my input and the error... cfgSSVEP = []; cfgSSVEP.dataset = [pathname,filename]; cfgSSVEP.trialdef.eventtype = 'STATUS'; cfgSSVEP.trialdef.eventvalue = {'21' '22'}; cfgSSVEP.trialdef.prestim = 1; cfgSSVEP.trialdef.poststim = 16; cfgSSVEP.dataset = [pathname,filename]; cfgSSVEP = definetrial(cfgSSVEP); cfgSSVEP.padding = 0; cfgSSVEP.continuous = 'yes'; evaluating trialfunction 'trialfun_general' Warning: Out of range value or NaN computed in integer arithmetic. > In read_event at 281 In trialfun_general at 50 In definetrial at 139 ??? Error using ==> cellstr at 34 Input must be a string. Error in ==> cell.intersect at 44 a = cellstr(a); Error in ==> trialfun_general at 104 elseif ~isempty(intersect(event(i).value, cfg.trialdef.eventvalue)) Error in ==> definetrial at 139 [trl, event] = feval(cfg.trialfun, cfg); ************* I've managed to "fix" the problem by changing line 104 in trialfun_general to: elseif ~isempty(intersect(num2str(event(i).value), cfg.trialdef.eventvalue)) Any feedback will be much appreciated... ---------------------------------- The aim of this list is to facilitate the discussion between users of the FieldTrip toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/neuroimaging/fieldtrip. From nelsonmj at CALTECH.EDU Mon Nov 16 22:46:12 2009 From: nelsonmj at CALTECH.EDU (Matthew Nelson) Date: Mon, 16 Nov 2009 22:46:12 +0100 Subject: Question about nonparametric statistical testing of coherence differences Message-ID: My question involves a situation in which one is comparing the coherence between two signals in two different conditions, and the coherence is generally high in both conditions, but we would like to say that the coherence is higher in one condition than the other. After some thought about this issue, I wonder if shuffling trials between the two conditions allows for a fair comparison to be made to the coherence in the raw data? For example, if a pair of signals has different relative phases in the two conditions, the overall coherence that exists in both conditions will be decreased by the trial shuffling. It’s also conceivable, though perhaps less likely, that the condition-shuffled data could have more coherence than either condition alone. In either case, the distribution of the cluster statistics of the coherence differences in the condition-shuffled data would certainly provide some sort of estimate of a null distribution of the coherence difference that does uses the actual data, but since the overall coherence values of the condition-shuffled and raw data could be so different, is it fair to say that this is a null distribution of the difference in coherence between the unshuffled conditions? If you have the time to respond, I’m curious to know what your thoughts are regarding this issue and specifically in a situation in which it is necessary to assess significance on one session. Performing the clustering and shuffling of coherence values across sessions obviously avoids this problem. For a test within a session, I wonder if it would be possible to use a bootstrapping or jackknife method combined with clustering to get a fair estimate of the variability of the cluster level statistics and perform hypothesis tests using that. ---------------------------------- The aim of this list is to facilitate the discussion between users of the FieldTrip toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/neuroimaging/fieldtrip. From adrian.m.bartlett at GMAIL.COM Mon Nov 16 23:44:53 2009 From: adrian.m.bartlett at GMAIL.COM (Adrian Bartlett) Date: Mon, 16 Nov 2009 17:44:53 -0500 Subject: Question about nonparametric statistical testing of coherence differences In-Reply-To: Message-ID: Hi Matthew, While It'll take me a bit to think about the single-condition case, you've definitely got the right idea for the condition contrast. The condition-shuffled surrogate data is in fact the null distribution for the H0: condition 1 = condition 2. Someone please correct me if I'm mistaken. Adrian M. Bartlett Perception & Plasticity Laboratory (http://www.yorku.ca/khoffman) Graduate Program in Psychology Neuroscience Graduate Diploma Program Centre for Vision Research York University Toronto, Ontario, Canada (416)736-2100x20997 adrianmb at yorku.ca On Mon, Nov 16, 2009 at 4:46 PM, Matthew Nelson wrote: > My question involves a situation in which one is comparing the coherence > between two signals in two different conditions, and the coherence is > generally high in both conditions, but we would like to say that the > coherence is higher in one condition than the other. After some > thought about this issue, I wonder if shuffling trials between the two > conditions allows for a fair comparison to be made to the coherence in > the raw data? For example, if a pair of signals has different relative > phases in the two conditions, the overall coherence that exists in > both conditions will be decreased by the trial shuffling. It’s also > conceivable, though perhaps less likely, that the condition-shuffled > data could have more coherence than either condition alone. In either > case, the distribution of the cluster statistics of the coherence > differences in the condition-shuffled data would certainly provide > some sort of estimate of a null distribution of the coherence > difference that does uses the actual data, but since the overall > coherence values of the condition-shuffled and raw data could be so > different, is it fair to say that this is a null distribution of the > difference in coherence between the unshuffled conditions? > > > If you have the time to respond, I’m curious to know what your > thoughts are regarding this issue and specifically in a situation in > which it is necessary to assess significance on one session. > Performing the clustering and shuffling of coherence values across > sessions obviously avoids this problem. For a test within a session, I > wonder if it would be possible to use a bootstrapping or jackknife > method combined with clustering to get a fair estimate of the > variability of the cluster level statistics and perform hypothesis > tests using that. > > ---------------------------------- > The aim of this list is to facilitate the discussion between users of the > FieldTrip toolbox, to share experiences and to discuss new ideas for MEG > and EEG analysis. See also > http://listserv.surfnet.nl/archives/fieldtrip.html and > http://www.ru.nl/neuroimaging/fieldtrip. > ---------------------------------- The aim of this list is to facilitate the discussion between users of the FieldTrip toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/neuroimaging/fieldtrip. -------------- next part -------------- An HTML attachment was scrubbed... URL: From e.maris at DONDERS.RU.NL Tue Nov 17 10:36:03 2009 From: e.maris at DONDERS.RU.NL (Eric Maris) Date: Tue, 17 Nov 2009 10:36:03 +0100 Subject: Question about nonparametric statistical testing of coherence differences In-Reply-To: Message-ID: Dear Matthew, Your questions relate to the core concepts behind statistical inference based on permutation. > My question involves a situation in which one is comparing the coherence > between two signals in two different conditions, and the coherence is > generally high in both conditions, but we would like to say that the > coherence is higher in one condition than the other. After some > thought about this issue, I wonder if shuffling trials between the two > conditions allows for a fair comparison to be made to the coherence in > the raw data? For example, if a pair of signals has different relative > phases in the two conditions, the overall coherence that exists in > both conditions will be decreased by the trial shuffling. It's also > conceivable, though perhaps less likely, that the condition-shuffled > data could have more coherence than either condition alone. In either > case, the distribution of the cluster statistics of the coherence > differences in the condition-shuffled data would certainly provide > some sort of estimate of a null distribution of the coherence > difference that does uses the actual data, but since the overall > coherence values of the condition-shuffled and raw data could be so > different, is it fair to say that this is a null distribution of the > difference in coherence between the unshuffled conditions? It is important to always keep in mind which null hypothesis is tested using permutation inference. This null hypothesis is exchangeability. For the case that you describe, exchangeability involves that the probability distributions of bivariate time series (or, equivalently, their Fourier coefficients) in the two experimental conditions are identical. You describe a situation in which this null hypothesis does not hold, and the reason for this is not a single but two parameters: coherence and relative phase. Both parameters differ across the two conditions that you describe. Now, if you want to test whether coherence differs across the two conditions and you don't want your inference to be affected by a difference in relative phase, then you have to come up with a test statistic that has the appropriate sensitivity. Such a test statistic might be the following: calculate the coherence difference between the two conditions using Fourier coefficients of which the phases were adjusted such that relative phase in the two conditions are both equal to zero. (This is a simple operation, involving a condition-specific phase shift applied to all Fourier coefficients of one of the two channels.) This example shows both the strength and the weakness of permutation inference. The strength is that you can construct your own test statistic such that it is sensitive to the physiological phenomenon in which you are interested. And the weakness is that the null hypothesis (exchangeability) is much more general than this specific physiological phenomenon. This means that a small permutation p-value allows you to infer that the two conditions most likely differ, but that inferring the precise cause of this difference depends on how clever you have been in designing a test statistic with the desired specificity. By the way, I did not understand the following sentence in your email: "It's also conceivable, though perhaps less likely, that the condition-shuffled data could have more coherence than either condition alone." For the situation that you describe, the coherence difference between the conditions (which is the relevant quantity for the phenomen in which you are interested) will on average be less for the permuted data than for the original data. > > If you have the time to respond, I'm curious to know what your > thoughts are regarding this issue and specifically in a situation in > which it is necessary to assess significance on one session. > Performing the clustering and shuffling of coherence values across > sessions obviously avoids this problem. For a test within a session, I > wonder if it would be possible to use a bootstrapping or jackknife > method combined with clustering to get a fair estimate of the > variability of the cluster level statistics and perform hypothesis > tests using that. Here the answer is simple. Permutation inference can only be used for comparing experimental conditions. However, I want to argue that, for investigating coherence, comparing experimental conditions is the only sensible thing one can do. The reason is that, for simple biophysical reasons, the null hypothesis of zero coherence within a single condition, will never be true, at least not in electrophysiological studies. This is because the potentials that are recorded in the two channels will always be affected by the physiological activity of common sources, simply because all potentials are volume conducted. Best, Eric dr. Eric Maris Donders Institute for Brain, Cognition and Behavior Center for Cognition and F.C. Donders Center for Cognitive Neuroimaging Radboud University P.O. Box 9104 6500 HE Nijmegen The Netherlands T:+31 24 3612651 Mobile: 06 39584581 F:+31 24 3616066 E: e.maris at donders.ru.nl MSc Cognitive Neuroscience: www.ru.nl/master/cns/ ---------------------------------- The aim of this list is to facilitate the discussion between users of the FieldTrip toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/neuroimaging/fieldtrip. From nelsonmj at CALTECH.EDU Tue Nov 17 13:33:46 2009 From: nelsonmj at CALTECH.EDU (Matthew Nelson) Date: Tue, 17 Nov 2009 13:33:46 +0100 Subject: Question about nonparametric statistical testing of coherence differences Message-ID: Thanks very much for your response Eric, I found it to be very helpful. On Tue, Nov 17, 2009 at 10:36 AM, Eric Maris wrote: > > It is important to always keep in mind which null hypothesis is tested using > permutation inference. This null hypothesis is exchangeability. For the case > that you describe, exchangeability involves that the probability > distributions of bivariate time series (or, equivalently, their Fourier > coefficients) in the two experimental conditions are identical. You describe > a situation in which this null hypothesis does not hold, and the reason for > this is not a single but two parameters: coherence and relative phase. Both > parameters differ across the two conditions that you describe. Now, if you > want to test whether coherence differs across the two conditions and you > don't want your inference to be affected by a difference in relative phase, > then you have to come up with a test statistic that has the appropriate > sensitivity. Such a test statistic might be the following: calculate the > coherence difference between the two conditions using Fourier coefficients > of which the phases were adjusted such that relative phase in the two > conditions are both equal to zero. (This is a simple operation, involving a > condition-specific phase shift applied to all Fourier coefficients of one of > the two channels.) It seems to me that this indeed is the test that I would be interested in for this situation. To reiterate the suggestion just to be clear that I understand it completely (and please let me know if I am misunderstanding it), this suggestion would be to adjust the phase of one signal in one condition so that the average relative phase between the two signals is the same for the two conditions, not to eliminate the phase information on each and every Fourier component. Thanks again for sharing your thoughts on that. > > By the way, I did not understand the following sentence in your email: "It's > also > conceivable, though perhaps less likely, that the condition-shuffled > data could have more coherence than either condition alone." For the > situation that you describe, the coherence difference between the conditions > (which is the relevant quantity for the phenomen in which you are > interested) will on average be less for the permuted data than for the > original data. Sorry for the confusion. For the situation that I specifically described in my first message, indeed the overall coherence in the permuted data would be less. What I was referring to in that sentence though was that in other situations, which I did not describe, it could be possible to have an increase in overall coherence in the shuffled data. For an example of such a situation, it seems to me that this could occur if the relative phases of the two signals are the same in both conditions but the overall spectral power differed between the two conditions for both signals such both signals had more power in condition one than in condition two. I haven’t tested this with simulations, but it seems that in the case the coherence could be higher in the trial shuffled case because of the induced correlation in spectral power between the signals resulting from mixing the two conditions. So following the line of thought from your suggestion above, in such a situation in order to prevent the magnitude differences from affecting the inference regarding the coherence difference between the two conditions, would you say that it would be appropriate to also adjust the overall magnitude of the pair of Fourier components in one condition to match the overall magnitude of the components in the other conditions when doing the permutation? > >> sessions obviously avoids this problem. For a test within a session, I >> wonder if it would be possible to use a bootstrapping or jackknife >> method combined with clustering to get a fair estimate of the >> variability of the cluster level statistics and perform hypothesis >> tests using that. > > Here the answer is simple. Permutation inference can only be used for > comparing experimental conditions. However, I want to argue that, for > investigating coherence, comparing experimental conditions is the only > sensible thing one can do. The reason is that, for simple biophysical > reasons, the null hypothesis of zero coherence within a single condition, > will never be true, at least not in electrophysiological studies. This is > because the potentials that are recorded in the two channels will always be > affected by the physiological activity of common sources, simply because all > potentials are volume conducted. > I agree completely. Just to clarify, I was suggesting using bootstrapping or jackknifing to estimate the variance of the coherence of each measure independently, and then use that to test the null hypothesis of no coherence difference between the two conditions rather than the null hypothesis of zero coherence. ---------------------------------- The aim of this list is to facilitate the discussion between users of the FieldTrip toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/neuroimaging/fieldtrip. From akiko at NYU.EDU Tue Nov 17 19:14:23 2009 From: akiko at NYU.EDU (Akiko Ikkai) Date: Tue, 17 Nov 2009 13:14:23 -0500 Subject: MEG rejectvisual summary Message-ID: Hi, I'm working on MEG data, and I have a very basic question on rejectvisual, with cfg.method = 'summary'; I understand that on channel number and trial number graphs, x- and y- axis (respectively) are variance across trials and channels. My question is what the acceptable range of these values are. SQUID jumps would be very obvious, but how about slow drifts (due to movement)? I suspect this depends on data, but if anyone could suggest some starting point (maybe based on experience?), I'd very appreciate it. Thanks! Akiko ---------------------------------- The aim of this list is to facilitate the discussion between users of the FieldTrip toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/neuroimaging/fieldtrip. From e.maris at DONDERS.RU.NL Tue Nov 17 21:04:00 2009 From: e.maris at DONDERS.RU.NL (Eric Maris) Date: Tue, 17 Nov 2009 21:04:00 +0100 Subject: Question about nonparametric statistical testing of coherence differences In-Reply-To: Message-ID: Dear Matthew, > > It is important to always keep in mind which null hypothesis is tested using > > permutation inference. This null hypothesis is exchangeability. For the case > > that you describe, exchangeability involves that the probability > > distributions of bivariate time series (or, equivalently, their Fourier > > coefficients) in the two experimental conditions are identical. You describe > > a situation in which this null hypothesis does not hold, and the reason for > > this is not a single but two parameters: coherence and relative phase. Both > > parameters differ across the two conditions that you describe. Now, if you > > want to test whether coherence differs across the two conditions and you > > don't want your inference to be affected by a difference in relative phase, > > then you have to come up with a test statistic that has the appropriate > > sensitivity. Such a test statistic might be the following: calculate the > > coherence difference between the two conditions using Fourier coefficients > > of which the phases were adjusted such that relative phase in the two > > conditions are both equal to zero. (This is a simple operation, involving a > > condition-specific phase shift applied to all Fourier coefficients of one of > > the two channels.) > > It seems to me that this indeed is the test that I would be interested in > for this situation. To reiterate the suggestion just to be clear that I > understand it completely (and please let me know if I am misunderstanding > it), this suggestion would be to adjust the phase of one signal in one > condition so that the average relative phase between the two signals is the > same for the two conditions, not to eliminate the phase information on each > and every Fourier component. Thanks again for sharing your thoughts on that. This is correct. Don't forget to apply this phase shift for every permutation, such that it becomes part of your test statistic. > > > > > By the way, I did not understand the following sentence in your email: "It's > > also > > conceivable, though perhaps less likely, that the condition-shuffled > > data could have more coherence than either condition alone." For the > > situation that you describe, the coherence difference between the conditions > > (which is the relevant quantity for the phenomen in which you are > > interested) will on average be less for the permuted data than for the > > original data. > > Sorry for the confusion. For the situation that I specifically described in > my first message, indeed the overall coherence in the permuted data would be > less. What I was referring to in that sentence though was that in other > situations, which I did not describe, it could be possible to have an > increase in overall coherence in the shuffled data. For an example of such a > situation, it seems to me that this could occur if the relative phases of > the two signals are the same in both conditions but the overall spectral > power differed between the two conditions for both signals such both signals > had more power in condition one than in condition two. I haven't tested this > with simulations, but it seems that in the case the coherence could be > higher in the trial shuffled case because of the induced correlation in > spectral power between the signals resulting from mixing the two conditions. In case you decide to run such a simulation, you may also include the phase-locking factor (Lachaux et al, 1999) in your calculation. The PLF does not depend on amplitude correlation over trials. > > So following the line of thought from your suggestion above, in such a > situation in order to prevent the magnitude differences from affecting the > inference regarding the coherence difference between the two conditions, > would you say that it would be appropriate to also adjust the overall > magnitude of the pair of Fourier components in one condition to match the > overall magnitude of the components in the other conditions when doing the > permutation? This may help. You can include this test statistic in your simulation, together with the PLF. > > > > >> sessions obviously avoids this problem. For a test within a session, I > >> wonder if it would be possible to use a bootstrapping or jackknife > >> method combined with clustering to get a fair estimate of the > >> variability of the cluster level statistics and perform hypothesis > >> tests using that. > > > > Here the answer is simple. Permutation inference can only be used for > > comparing experimental conditions. However, I want to argue that, for > > investigating coherence, comparing experimental conditions is the only > > sensible thing one can do. The reason is that, for simple biophysical > > reasons, the null hypothesis of zero coherence within a single condition, > > will never be true, at least not in electrophysiological studies. This is > > because the potentials that are recorded in the two channels will always be > > affected by the physiological activity of common sources, simply because all > > potentials are volume conducted. > > > > I agree completely. Just to clarify, I was suggesting using bootstrapping or > jackknifing to estimate the variance of the coherence of each measure > independently, and then use that to test the null hypothesis of no coherence > difference between the two conditions rather than the null hypothesis of > zero coherence. I would not advise this. The permutation test is to be preferred over bootstrap- and jacknife-based statistical test, because we can prove that the permutation test controls the false alarm rate. We cannot prove this for bootstrap- and jacknife-based tests. Best, Eric > > ---------------------------------- > The aim of this list is to facilitate the discussion between users of the FieldTrip > toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. > See also http://listserv.surfnet.nl/archives/fieldtrip.html and > http://www.ru.nl/neuroimaging/fieldtrip. ---------------------------------- The aim of this list is to facilitate the discussion between users of the FieldTrip toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/neuroimaging/fieldtrip. From nelsonmj at CALTECH.EDU Tue Nov 17 22:35:59 2009 From: nelsonmj at CALTECH.EDU (Matthew Nelson) Date: Tue, 17 Nov 2009 22:35:59 +0100 Subject: Question about nonparametric statistical testing of coherence differences Message-ID: Thanks again for your helpful response. ---------------------------------- The aim of this list is to facilitate the discussion between users of the FieldTrip toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/neuroimaging/fieldtrip. From Hanneke.vanDijk at MED.UNI-DUESSELDORF.DE Wed Nov 18 13:38:58 2009 From: Hanneke.vanDijk at MED.UNI-DUESSELDORF.DE (Hanneke Van Dijk) Date: Wed, 18 Nov 2009 13:38:58 +0100 Subject: using coil/isotrack information for sourceanalysis (neuromag data) Message-ID: Dear all, In my group we have a question regarding the use of the coil locations and/ or isotrack data to do source analysis. We are doing data analysis using FT and the MNE toolbox, on a dataset recorded with a Neuromag122 system. The four coils were placed in different locations then in the CTF system, which uses the anatomical landmarks (left ear, right ear and nasion). Here we placed the coils on the scalp; two approximately above the eyes and two behind the ears. We digitized the locations of the coils using the polhemus, togheter with the anatomical landmarks and some more points. We would very much like to know HOW and WHERE fieldtrip uses the coil-location information and if it is possible to use the polhemus data as well, to place the head at the correct location within the helmet and to do sourceanalysis. I noticed allready that when reading the fiff file with 'fiff_read_meas_info' (MNE) there is a field called .dig which seems to contain the coordinates of digitized locations. I have no idea though how to integrate this information into the data so fieldtrip can use it. Thanks in advance for any information, Hanneke van Dijk Institute for Clinical Neuroscience and Medical Psychology, Heinrich Heine Universitaet, Duesseldorf. ---------------------------------- The aim of this list is to facilitate the discussion between users of the FieldTrip toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/neuroimaging/fieldtrip. -------------- next part -------------- An HTML attachment was scrubbed... URL: From lhunt at FMRIB.OX.AC.UK Wed Nov 18 14:40:14 2009 From: lhunt at FMRIB.OX.AC.UK (Laurence Hunt) Date: Wed, 18 Nov 2009 13:40:14 +0000 Subject: using coil/isotrack information for sourceanalysis (neuromag data) In-Reply-To: <72E993C35FB11743B79FF9286E5B6D8B0F351C@Mail2-UKD.VMED.UKD> Message-ID: Dear Hanneke, The information stored in dig can indeed be read into fieldtrip; this is done by read_headshape, which reads in all the points and classifies them as fiducial (i.e. nasion/LPA/RPA), stored in shape.fid, or other, stored in shape.pnt. shape.pnt would therefore include your HPI coils and additional digitised points (and any digitised EEG sensor locations if you collected EEG also). As you're probably aware, there are two registrations that need to take place - the first is the registration of coil locations to sensor locations, and the second is the registration of the subject's MR scan to the coil locations/fiducials. The first is done at the time of recording (i.e. it is HPI); the sensors are by default read into fieldtrip using the same co-ordinates as the coils/digitised points (i.e. head coordinates rather than sensor coordinates, done by mne2grad in read_header). The second is done by fieldtrip, and is the registration of coil locations to the MR scan. This means that you wouldn't be able to improve the registration of coils etc. to the sensors (this registration has been done already by the HPI), but what you might be able to do is to use the additional points to improve the registration of the coil locations to the subject's MR scan. Typically they should be located on the scalp, and by minimising the mean squared error of the distance between coil locations/other digitised points and scalp you should be able to get a good registration. Unfortunately I'm not quite sure how or whether fieldtrip does this; I'm afraid I use fieldtrip mainly to read the data into SPM (which does allow you to use these additional points to aid registration to the subject's scalp surface). But I imagine fieldtrip is able to do this also, and perhaps someone who knows more about fieldtrip could explain how to use the information in read_headshape to achieve this? Hope this helps, Laurence =========================================== Laurence Hunt, DPhil Student Centre for Functional MRI of the Brain (FMRIB), University of Oxford lhunt at fmrib.ox.ac.uk Phone: (+44)1865-(2)22738 =========================================== On 18 Nov 2009, at 12:38, Hanneke Van Dijk wrote: > Dear all, > > In my group we have a question regarding the use of the coil > locations and/ or isotrack data to do source analysis. We are doing > data analysis using FT and the MNE toolbox, on a dataset recorded > with a Neuromag122 system. > > The four coils were placed in different locations then in the CTF > system, which uses the anatomical landmarks (left ear, right ear and > nasion). Here we placed the coils on the scalp; two approximately > above the eyes and two behind the ears. We digitized the locations > of the coils using the polhemus, togheter with the anatomical > landmarks and some more points. We would very much like to know HOW > and WHERE fieldtrip uses the coil-location information and if it is > possible to use the polhemus data as well, to place the head at the > correct location within the helmet and to do sourceanalysis. > > I noticed allready that when reading the fiff file with > 'fiff_read_meas_info' (MNE) there is a field called .dig which seems > to contain the coordinates of digitized locations. I have no idea > though how to integrate this information into the data so fieldtrip > can use it. > > Thanks in advance for any information, > > Hanneke van Dijk > > Institute for Clinical Neuroscience and Medical Psychology, > Heinrich Heine Universitaet, Duesseldorf. > > > > ---------------------------------- > > The aim of this list is to facilitate the discussion between users > of the FieldTrip toolbox, to share experiences and to discuss new > ideas for MEG and EEG analysis. > > http://listserv.surfnet.nl/archives/fieldtrip.html > > http://www.ru.nl/fcdonders/fieldtrip/ > ---------------------------------- The aim of this list is to facilitate the discussion between users of the FieldTrip toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/neuroimaging/fieldtrip. -------------- next part -------------- An HTML attachment was scrubbed... URL: From brian.roach at YALE.EDU Wed Nov 18 21:25:30 2009 From: brian.roach at YALE.EDU (Brian Roach) Date: Wed, 18 Nov 2009 12:25:30 -0800 Subject: research position in San Francisco, CA Message-ID: Fieldtrip Users, We are looking for new and experienced brain imagers with a background in signal processing to work in our UCSF-affiliated research lab. Please apply at the following link if interested: http://jobs-ncire.icims.com/jobs/1448/job thank you, Brian ---------------------------------- The aim of this list is to facilitate the discussion between users of the FieldTrip toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/neuroimaging/fieldtrip. -------------- next part -------------- An HTML attachment was scrubbed... URL: From nelsonmj at CALTECH.EDU Thu Nov 19 16:10:07 2009 From: nelsonmj at CALTECH.EDU (Matthew Nelson) Date: Thu, 19 Nov 2009 16:10:07 +0100 Subject: Question about permutation testing of an interaction in a two by two design Message-ID: After the terrific help I received following the last question, I thought I would post an additional question I am currently pondering. I’m also interested in comparing the coherence of a pair of signals in a 2x2 design. I am specifically interested in testing the interaction in this design and would like to do so using the cluster-based permutation tests to do so across time and frequency. I’m curious to receive feedback and input about the proper way to go about this. Performing the tests across sessions seems to me to be a bit easier to conceive and to write code for. In this case the design would be a within-sessions design, as all of the four trial types occur in each session. My impression is that the proper test could then be to calculate for each session the difference along one factor for each condition of the other factor, and then performing a permutation test of that difference among the conditions of the other factor with the test statistic merely being the mean difference of eth differences. It struck me that a 4-way permutation of the four trial types, but this would instead be more appropriate if the test statistic I was interested in was an omnibus anova test, not to test strictly the interaction which is my interest here. I am less sure how to perform the test if one wanted to do it within a single session where there may be different numbers of trials in each condition. I know this question relates more to permutation tests than to frequency analysis. If someone could even just point me towards a good reference where I can learn more about these more detailed aspects of permutation tests, I would appreciate it. Thanks. ---------------------------------- The aim of this list is to facilitate the discussion between users of the FieldTrip toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/neuroimaging/fieldtrip. From e.maris at DONDERS.RU.NL Thu Nov 19 22:06:04 2009 From: e.maris at DONDERS.RU.NL (Eric Maris) Date: Thu, 19 Nov 2009 22:06:04 +0100 Subject: Question about permutation testing of an interaction in a two by two design In-Reply-To: Message-ID: Dear Matthew, I agree with your proposal for an interaction test in a within-sessions design. (I have called this a within-units-of-observation design in the Maris & Oostenveld paper.) I know of no permutation test for an interaction effect in a between-units-of-observation design. The reason is that I do not see how such a test can be rephrased as a test of the exchangeability null hypothesis. This is a recurrent question on this discussion list. You may be good to browse through the archive of the discussion list. Best, Eric dr. Eric Maris Donders Institute for Brain, Cognition and Behavior Center for Cognition and F.C. Donders Center for Cognitive Neuroimaging Radboud University P.O. Box 9104 6500 HE Nijmegen The Netherlands T:+31 24 3612651 Mobile: 06 39584581 F:+31 24 3616066 E: e.maris at donders.ru.nl MSc Cognitive Neuroscience: www.ru.nl/master/cns/ > -----Oorspronkelijk bericht----- > Van: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] Namens > Matthew Nelson > Verzonden: donderdag 19 november 2009 16:10 > Aan: FIELDTRIP at NIC.SURFNET.NL > Onderwerp: [FIELDTRIP] Question about permutation testing of an interaction in a > two by two design > > After the terrific help I received following the last question, I thought I > would post an additional question I am currently pondering. > > I'm also interested in comparing the coherence of a pair of signals in a 2x2 > design. I am specifically interested in testing the interaction in this > design and would like to do so using the cluster-based permutation tests to > do so across time and frequency. I'm curious to receive feedback and input > about the proper way to go about this. > > Performing the tests across sessions seems to me to be a bit easier to > conceive and to write code for. In this case the design would be a > within-sessions design, as all of the four trial types occur in each > session. My impression is that the proper test could then be to calculate > for each session the difference along one factor for each condition of the > other factor, and then performing a permutation test of that difference > among the conditions of the other factor with the test statistic merely > being the mean difference of eth differences. It struck me that a 4-way > permutation of the four trial types, but this would instead be more > appropriate if the test statistic I was interested in was an omnibus anova > test, not to test strictly the interaction which is my interest here. > > I am less sure how to perform the test if one wanted to do it within a > single session where there may be different numbers of trials in each > condition. > > I know this question relates more to permutation tests than to frequency > analysis. If someone could even just point me towards a good reference where > I can learn more about these more detailed aspects of permutation tests, I > would appreciate it. Thanks. > > ---------------------------------- > The aim of this list is to facilitate the discussion between users of the FieldTrip > toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. > See also http://listserv.surfnet.nl/archives/fieldtrip.html and > http://www.ru.nl/neuroimaging/fieldtrip. ---------------------------------- The aim of this list is to facilitate the discussion between users of the FieldTrip toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/neuroimaging/fieldtrip. From nelsonmj at CALTECH.EDU Fri Nov 20 17:19:48 2009 From: nelsonmj at CALTECH.EDU (Matthew Nelson) Date: Fri, 20 Nov 2009 17:19:48 +0100 Subject: Question about permutation testing of an interaction in a two by two design Message-ID: Thanks very much for your response. I will browse through the archive here to see if I can find anything. One source I found elsewhere on the web can be found in this book on page 126-127: http://www.amazon.com/reader/038720279X?_encoding=UTF8&query=126#reader_038720279X If I'm understanding his description properly, this can be tested simply by using the ANOVA sum of squares test statistic for an interaction while permuting amongst all the conditions. I would suppose that an interaction contrast could be tested similarly using the sum of squares for the contrast as the test statistic while permuting amongst the combinations of conditions that factor into the particular contrast. But if you don't think that that permutation would provide the proper null hypothesis for either test (the omnibus interaction or an interaction contrast), I'd be curious to know. Thanks again very much, Matthew On Thu, 19 Nov 2009 22:06:04 +0100, Eric Maris wrote: >Dear Matthew, > >I agree with your proposal for an interaction test in a within-sessions >design. (I have called this a within-units-of-observation design in the >Maris & Oostenveld paper.) > >I know of no permutation test for an interaction effect in a >between-units-of-observation design. The reason is that I do not see how >such a test can be rephrased as a test of the exchangeability null >hypothesis. > >This is a recurrent question on this discussion list. You may be good to >browse through the archive of the discussion list. > >Best, > >Eric > > > >dr. Eric Maris >Donders Institute for Brain, Cognition and Behavior >Center for Cognition and F.C. Donders Center for Cognitive Neuroimaging >Radboud University >P.O. Box 9104 >6500 HE Nijmegen >The Netherlands >T:+31 24 3612651 >Mobile: 06 39584581 >F:+31 24 3616066 >E: e.maris at donders.ru.nl > >MSc Cognitive Neuroscience: www.ru.nl/master/cns/ > ---------------------------------- The aim of this list is to facilitate the discussion between users of the FieldTrip toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/neuroimaging/fieldtrip. From g.rousselet at PSY.GLA.AC.UK Fri Nov 20 18:17:46 2009 From: g.rousselet at PSY.GLA.AC.UK (Guillaume Rousselet) Date: Fri, 20 Nov 2009 17:17:46 +0000 Subject: Question about permutation testing of an interaction in a two by two design In-Reply-To: Message-ID: Matthew, based on the attached paper and Wilcox 2005 (Wilcox, R.R., Introduction to Robust Estimation and Hypothesis Testing. 2nd Ed. ed. 2005: Academic Press), the null F distributions for the main effects and the interaction are obtained by sampling with replacement independently from centred distributions. This is an extension of the bootstrap percentile-t technique. I'm not aware of robust ANOVA techniques employing permutation. On 20 Nov 2009, at 16:19, Matthew Nelson wrote: > Thanks very much for your response. I will browse through the > archive here > to see if I can find anything. > > One source I found elsewhere on the web can be found in this book on > page > 126-127: > > http://www.amazon.com/reader/038720279X?_encoding=UTF8&query=126#reader_038720279X > > If I'm understanding his description properly, this can be tested > simply by > using the ANOVA sum of squares test statistic for an interaction while > permuting amongst all the conditions. I would suppose that an > interaction > contrast could be tested similarly using the sum of squares for the > contrast > as the test statistic while permuting amongst the combinations of > conditions > that factor into the particular contrast. > > But if you don't think that that permutation would provide the > proper null > hypothesis for either test (the omnibus interaction or an interaction > contrast), I'd be curious to know. > > Thanks again very much, > > Matthew > > On Thu, 19 Nov 2009 22:06:04 +0100, Eric Maris > wrote: > >> Dear Matthew, >> >> I agree with your proposal for an interaction test in a within- >> sessions >> design. (I have called this a within-units-of-observation design in >> the >> Maris & Oostenveld paper.) >> >> I know of no permutation test for an interaction effect in a >> between-units-of-observation design. The reason is that I do not >> see how >> such a test can be rephrased as a test of the exchangeability null >> hypothesis. >> >> This is a recurrent question on this discussion list. You may be >> good to >> browse through the archive of the discussion list. >> >> Best, >> >> Eric >> >> >> >> dr. Eric Maris >> Donders Institute for Brain, Cognition and Behavior >> Center for Cognition and F.C. Donders Center for Cognitive >> Neuroimaging >> Radboud University >> P.O. Box 9104 >> 6500 HE Nijmegen >> The Netherlands >> T:+31 24 3612651 >> Mobile: 06 39584581 >> F:+31 24 3616066 >> E: e.maris at donders.ru.nl >> >> MSc Cognitive Neuroscience: www.ru.nl/master/cns/ >> > > ---------------------------------- > The aim of this list is to facilitate the discussion between users > of the FieldTrip toolbox, to share experiences and to discuss new > ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html > and http://www.ru.nl/neuroimaging/fieldtrip. ************************************************************************************ Guillaume A. Rousselet, Ph.D. Lecturer Centre for Cognitive Neuroimaging (CCNi) Department of Psychology Faculty of Information & Mathematical Sciences (FIMS) University of Glasgow 58 Hillhead Street Glasgow, UK G12 8QB The University of Glasgow, charity number SC004401 http://web.me.com/rousseg/GARs_website/ Email: g.rousselet at psy.gla.ac.uk Fax. +44 (0)141 330 4606 Tel. +44 (0)141 330 6652 Cell +44 (0)791 779 7833 "no test based upon a theory of probability can by itself provide any valuable evidence of the truth or falsehood of a hypothesis. But we may look at the purpose of tests from another viewpoint. Without hoping to know whether each separate hypothesis is true or false, we may search for rules to govern our behaviour with regard to them, in following which we insure that, in the long run of experience, we shall not often be wrong." Neyman J & Pearson E, 1933 ************************************************************************************ ---------------------------------- The aim of this list is to facilitate the discussion between users of the FieldTrip toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/neuroimaging/fieldtrip. -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: Berkovits_00_bootstrap.pdf Type: application/pdf Size: 82267 bytes Desc: not available URL: -------------- next part -------------- An HTML attachment was scrubbed... URL: From r.oostenveld at FCDONDERS.RU.NL Mon Nov 23 09:00:05 2009 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Mon, 23 Nov 2009 08:00:05 +0000 Subject: using coil/isotrack information for sourceanalysis (neuromag data) In-Reply-To: <60D7F31F-C6E0-4A3A-AB89-BCA9AEA185D6@fcdonders.ru.nl> Message-ID: Hi Hanneke, On 18 Nov 2009, at 14:40, Laurence Hunt wrote: > ... > Unfortunately I'm not quite sure how or whether fieldtrip does this; I'm afraid I use fieldtrip mainly to read the data into SPM (which does allow you to use these additional points to aid registration to the subject's scalp surface). But I imagine fieldtrip is able to do this also, and perhaps someone who knows more about fieldtrip could explain how to use the information in read_headshape to achieve this? Laurences description of the two steps are correct. First the position of the MEG sensors is expressed in a coordinate system relative to the fiducials, subseuqnelty the posiiton of the MRI has to be expressed in the same coordinate system. For the MEG gradiometer coils fieldtripFT relies on the low-level reader (in this case in combination with mne2grad.m) to contain the position in the correct coordinate system. In the CTF case (as an example), the res4 file contains the coil posiitons both in head coorindates, but also in dewar coordinates. FieldTrip reads the coil positions in head coordinates and stores them in grad.pnt and grad.ori (orientation is also relevant here). The usual procedure for the MRI in the CTF case is to use MRIViewer to click on the fiducials and then store the mri file with the coordinate system re-defined according to the fiducials. The volumerealign.m function allows to do the same in fieldtrip in case you don't have vendor-specific software to assign the coordinate system. What I'm not sure about is whether you want to represent the MEG coils and MRI relative to the localizer coils, or relative to the Nose/Ear fiducials. The first case is quite simple, because that only requires you to identify the localizer coils in the MRI. The second case is more tricky, because you then first have to specify the MEG coils and MRI in the localizer-coil coordinate system, compute the transformation from localizer coil coordinate system to fiducial coordinate system, and then apply that transform to both MEG coil positions+orientations and to the MRI. FT functions that pertain to this (but are normally low-level and not used by the end user) are headcoordinates, which allows you to compute the coordinate transformation matrix from A to B given three new points that describe coordinate system B, expressed in coordinate system A. The function forwinv/transform_sens can be used to apply the transformation to the sensors, The function warp_apply is used, and applying the transformation to the MRI is as simple as multiplying h, the output of headcoordinates with mri.tra, such that mri.tra = h*mri.tra. Important is that you carefully check the alignment of the MRI with the sensors by plotting them combined in 3D. The functions plot_slice and plot_sens (both in plotting) can be used for that. Hope this helps. Robert ----------------------------------------------------------- Robert Oostenveld, PhD Senior Researcher Donders Institute for Brain, Cognition and Behaviour Centre for Cognitive Neuroimaging Radboud University Nijmegen tel.: +31 (0)24 3619695 e-mail: r.oostenveld at donders.ru.nl web: http://www.ru.nl/neuroimaging skype: r.oostenveld ----------------------------------------------------------- ---------------------------------- The aim of this list is to facilitate the discussion between users of the FieldTrip toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/neuroimaging/fieldtrip. -------------- next part -------------- An HTML attachment was scrubbed... URL: From yiwen.li at MED.UNI-TUEBINGEN.DE Mon Nov 23 19:11:41 2009 From: yiwen.li at MED.UNI-TUEBINGEN.DE (Yiwen Li) Date: Mon, 23 Nov 2009 19:11:41 +0100 Subject: common spatial filter in lcmv beamforming Message-ID: Dear Fieldtrip Users, I have a question on computing common spatial filter for the time domain data (ERP) using lcmv beamforming. My experiment is a bilateral tactile discrimination task measured with the 275-channel CTF system. There are two experimental conditions that I want to compare within subjects on the source level. As the baseline between the two conditions might not be homogeneous, I would like to compute two common spatial filters based on the pooled data of both conditions for baseline and for the ERP during the tactile stimulation respectively. According to the example matlab script of computing common spatial filters on frequency data posted on the Fieldtrip website, I adapted it to the lcmv beamforming on the time domain data. The script is attach at the end. As my original trial length is 5.5s (-1.5 to 4s, -1s is visual instruction onset, 0s to 0.6s is tactile stimulation), the projection of each single trial through the common filter became extremely computationally demanding. Then I redefined the trials according to the time window of interest (as was suggested in the frequency domain source analysis), I got different source results as the beamformer_lcmv seem to take the average of the whole given data length and the covariance of the specified window to calculate the spatial filter. Now I realized that it was not correct to define such short time period for the averaged data and that I probably should have taken a longer time window, such as [-1.4 0.6]s that covers both baseline and tactile stimulation. But I am not clear about what kind of time window would be appropriate in my case? I have tried a couple of different time windows but so far I haven't got clear bilateral primary somatosensory sources yet, actually not even close to it, so I know I must have done something wrong. Any suggestions would be very much appreciated. Best regards, Yiwen cfg = []; cfg.channel = {'MEG'}; cfg.blc = 'no'; cfg.keeptrials = 'yes'; tlckavg = timelockanalysis(cfg, data); cfg = []; cfg.channel = {'MEG'}; cfg.blc = 'no'; cfg.removemean = 'no'; cfg.covariance = 'yes'; cfg.keeptrials = 'yes'; cfg.covariancewindow = [0.05 0.07]; % cfg.latency = [0.05 0.07]; tlckavg_toi = timelockanalysis(cfg, tlckavg); cfg.covariancewindow = [-1.37 -1.35]; % cfg.latency = [-1.37 -1.35]; tlckavg_blc = timelockanalysis(cfg, tlckavg); cfg = []; cfg.method = 'lcmv'; cfg.grid = grid; cfg.vol = vol; cfg.lambda = '5%'; cfg.keepfilter = 'yes'; source = sourceanalysis(cfg, tlckavg); cfg = []; cfg.method = 'lcmv'; cfg.grid = grid; % previously computed grid cfg.vol = vol; % previously computed volume conduction model cfg.grid.filter = source.avg.filter; % use the common filter computed in the previous step! cfg.lambda = '5%'; cfg.rawtrial = 'yes'; % project each single trial through the filter source = sourceanalysis(cfg, tlckavg); --------------------------------------------------------------------------------- Yiwen Li Hegner , PhD MEG-Center Institute of Medical Psychology and Behavioral Neurobiology University of Tübingen Germany ---------------------------------- The aim of this list is to facilitate the discussion between users of the FieldTrip toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/neuroimaging/fieldtrip. From rajamonis at MAIL.NIH.GOV Mon Nov 23 21:34:41 2009 From: rajamonis at MAIL.NIH.GOV (Rajamoni Nadar, Sreenivasan (NIH/NIMH) [E]) Date: Mon, 23 Nov 2009 15:34:41 -0500 Subject: FW: Fieldtrip to extract source signal Message-ID: Dr. Oostenveld, Attached is the code that I used to extract single trial source time series from MEG dataset (CTF). It is giving the following error while calling the routine prepare_leadfield. Could you please let me know the way to fix it? Thanks, Vasan %~~~~~~~~~~~~~~~ see the error message~~~~~~~~~~~~~~~ the input is timelock data with 273 channels and 300 timebins reading headmodel from file '/gs1/users/rajamoni/MEG_ds/AEDTPJOU_nback_20050422_01-f.ds/default.hdm' using gradiometers specified in the data precomputing leadfields for efficient handling of multiple trials reading headmodel from file '/gs1/users/rajamoni/MEG_ds/AEDTPJOU_nback_20050422_01-f.ds/default.hdm' using gradiometers specified in the data creating dipole grid based on user specified dipole positions 0 dipoles inside, 1 dipoles outside brain computing leadfield ??? Reference to non-existent field 'type'. Error in ==> prepare_leadfield at 133 if strcmp(vol.type, 'openmeeg') Error in ==> sourceanalysis at 322 [grid, cfg] = prepare_leadfield(cfg, data); ---------------------------------- The aim of this list is to facilitate the discussion between users of the FieldTrip toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/neuroimaging/fieldtrip. -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: single_trial_source_from_fieldtrip.m Type: application/octet-stream Size: 1486 bytes Desc: single_trial_source_from_fieldtrip.m URL: From moratti at MED.UCM.ES Tue Nov 24 10:19:43 2009 From: moratti at MED.UCM.ES (Stephan Moratti) Date: Tue, 24 Nov 2009 10:19:43 +0100 Subject: Question about permutation testing of an interaction in a two by two design Message-ID: Hi all, Thanks for the interesing discussion about the interaction with respect to permutation. I have been also struggling with this question. As we want to test the interaction (and not the main effect condition), I am not sure if resampling condition would produce the distribution of our null hypothesis. Regarding the interaction, we want to check if the mean values across conditions follow the same pattern in two groups (if we consider a group x condition interaction). If we make a line plot an interaction would be indicated by a line crossing if each line represents a group (ideally). No interaction would be represented by parallel lines for each group. So I wonder if by resampling the subject values between the groups keeping the condition structure intact, would create our null distribution for the interaction. If we resample condition, we would destroy the condition structure. What do you think? I would be happy for any input. Best, Stephan ---------------------------------- The aim of this list is to facilitate the discussion between users of the FieldTrip toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/neuroimaging/fieldtrip. From g.rousselet at PSY.GLA.AC.UK Tue Nov 24 11:18:02 2009 From: g.rousselet at PSY.GLA.AC.UK (Guillaume Rousselet) Date: Tue, 24 Nov 2009 10:18:02 +0000 Subject: Question about permutation testing of an interaction in a two by two design In-Reply-To: Message-ID: Dear Stephan, to build an appropriate null distribution, the resampling procedure must stick to the structure of your experimental design. In the case of a group x condition (repeated measure) interaction, the groups are independent but the conditions are not. To take that constraint into account, I think you need to resample from each group independently. However, for each group, because of the paired nature of the design, when you sample 1 subject, you have to sample both conditions from that subject (and all the time points and sensors), i.e. you sample subjects with replacement independently from each group, but keeping paired data points together. The strategy described here relies on a sampling with replacement under H0. In that case H0 is created by centering the data independently in each of the 4 cells of your design. So you start with a true null hypothesis and through resampling you can derive a table of F values for the interaction under H0. Hope this help, GAR On 24 Nov 2009, at 09:19, Stephan Moratti wrote: > Hi all, > > Thanks for the interesing discussion about the interaction with > respect to > permutation. I have been also struggling with this question. As we > want to > test the interaction (and not the main effect condition), I am not > sure if > resampling condition would produce the distribution of our null > hypothesis. > Regarding the interaction, we want to check if the mean values across > conditions follow the same pattern in two groups (if we consider a > group x > condition interaction). If we make a line plot an interaction would > be indicated > by a line crossing if each line represents a group (ideally). No > interaction > would be represented by parallel lines for each group. So I wonder > if by > resampling the subject values between the groups keeping the condition > structure intact, would create our null distribution for the > interaction. If we > resample condition, we would destroy the condition structure. > > What do you think? I would be happy for any input. > > Best, > > Stephan > > ---------------------------------- > The aim of this list is to facilitate the discussion between users > of the FieldTrip toolbox, to share experiences and to discuss new > ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html > and http://www.ru.nl/neuroimaging/fieldtrip. ************************************************************************************ Guillaume A. Rousselet, Ph.D. Lecturer Centre for Cognitive Neuroimaging (CCNi) Department of Psychology Faculty of Information & Mathematical Sciences (FIMS) University of Glasgow 58 Hillhead Street Glasgow, UK G12 8QB The University of Glasgow, charity number SC004401 http://web.me.com/rousseg/GARs_website/ Email: g.rousselet at psy.gla.ac.uk Fax. +44 (0)141 330 4606 Tel. +44 (0)141 330 6652 Cell +44 (0)791 779 7833 "YOU ARE NOT NORMAL. [...] you probably belong to the minority of the world's population that has a steady job, adequate access to social security, and enjoys substantial political freedoms. Moreover, you live on more than $2 a day, and, unlike 860 million others, you can read. The percentage of humanity that combines all of these attributes is minuscule. [...] Statistically, a "normal" human being in today's world is poor, lives in oppressive physical, social, and political conditions, and is ruled by unresponsive and corrupt government." Moises Naim - 2005 - Editor in chief of Foreign Policy ************************************************************************************ ---------------------------------- The aim of this list is to facilitate the discussion between users of the FieldTrip toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/neuroimaging/fieldtrip. -------------- next part -------------- An HTML attachment was scrubbed... URL: From sklein at BERKELEY.EDU Tue Nov 24 11:18:23 2009 From: sklein at BERKELEY.EDU (Stanley Klein) Date: Tue, 24 Nov 2009 02:18:23 -0800 Subject: How does one do simulations for statistics? Message-ID: I too have lots of questions on how to do statistics on EEG and MEG. Right now for example we are getting very similar EEG and MEG waveforms (following SVD) and are trying out various statistical ways of comparing them. In addition to using Fieldtrip's wonderful (but complicated) cluster permutation test for dealing with multiple comparisons and correlated noise issues we are trying other ideas. The only way that we can figure out whether we are on the right track is to do simulations where we know the correct answer. Does anyone have good advice on how to do good simulations? We are using the CTF machine for our EEG and MEG (and Biosemi for EEG alone). Every sample is about 2 msec. For a single trace  we are using something like the following Matlab code that gives a flat amplitude spectrum out to 15 Hz and then close to 1/f^2 beyond that. x(1:2)=[0 1]; for i=3:10000; x(i) = 1.81*x(i-1) -.85*x(i-2)+randn; %AR model for time series end The AR coefficients were obtained by trial and error and have a lot of flexibility. The question again is whether anyone has good suggestions for how to simulate EEG or MEG noise in the time domain? Even better would be something good to read. I'd like the noise to be manufactured in the time domain since I'll be doing other things for the signal in the time domain including multiplicative noise. Without good simulations how do people test all their statistics, especially when there is a bunch of preprocessing like SVD (or complicated, nonlinear interaction terms)? thanks, Stan Klein ---------------------------------- The aim of this list is to facilitate the discussion between users of the FieldTrip toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/neuroimaging/fieldtrip. From e.maris at DONDERS.RU.NL Tue Nov 24 12:11:18 2009 From: e.maris at DONDERS.RU.NL (Eric Maris) Date: Tue, 24 Nov 2009 12:11:18 +0100 Subject: Question about permutation testing of an interaction in a two by two design In-Reply-To: Message-ID: Dear Stephan, It is sometimes possible to reformulate an interaction effect null hypothesis such that it becomes a main effect null hypothesis (however, for a different dependent variable, obtained be calculating the difference between conditions). Such a reformulation is possible for a two-factorial design in which one independent variable is manipulated within subjects (in your case, this is condition), and the other between subjects (in your case, this is group). You do this by calculating subject-specific difference scores, [condition1 - condition2], and using these as the dependent variable in a between-groups comparison. This is possible by means of the standard independent-samples T-test, but also by means of a permutation test (involving permutation of the difference scores), which allows you to deal with the multiple comparison problem. For a factorial design that only involves between-subject independent variables, such a reformulation is not possible (at least, I am not aware of it). Best, Eric > -----Oorspronkelijk bericht----- > Van: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] Namens > Stephan Moratti > Verzonden: dinsdag 24 november 2009 10:20 > Aan: FIELDTRIP at NIC.SURFNET.NL > Onderwerp: Re: [FIELDTRIP] Question about permutation testing of an interaction > in a two by two design > > Hi all, > > Thanks for the interesing discussion about the interaction with respect to > permutation. I have been also struggling with this question. As we want to > test the interaction (and not the main effect condition), I am not sure if > resampling condition would produce the distribution of our null hypothesis. > Regarding the interaction, we want to check if the mean values across > conditions follow the same pattern in two groups (if we consider a group x > condition interaction). If we make a line plot an interaction would be indicated > by a line crossing if each line represents a group (ideally). No interaction > would be represented by parallel lines for each group. So I wonder if by > resampling the subject values between the groups keeping the condition > structure intact, would create our null distribution for the interaction. If we > resample condition, we would destroy the condition structure. > > What do you think? I would be happy for any input. > > Best, > > Stephan > > ---------------------------------- > The aim of this list is to facilitate the discussion between users of the FieldTrip > toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. > See also http://listserv.surfnet.nl/archives/fieldtrip.html and > http://www.ru.nl/neuroimaging/fieldtrip. ---------------------------------- The aim of this list is to facilitate the discussion between users of the FieldTrip toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/neuroimaging/fieldtrip. -------------- next part -------------- An HTML attachment was scrubbed... URL: From sklein at BERKELEY.EDU Tue Nov 24 12:43:39 2009 From: sklein at BERKELEY.EDU (Stanley Klein) Date: Tue, 24 Nov 2009 03:43:39 -0800 Subject: How does one do simulations for statistics? In-Reply-To: <9016c9f10911240218s3f8ebbf9r867a274fd3ad821@mail.gmail.com> Message-ID: Hi again, I have had a suggestion to try the freqsimulation function of Fieldtrip. But I would like to have something in the time domain so that I can play with autoregressive coefficients between sources and so that I can put in nonlinearities like multiplicative noise if I'd like. . Incidentally the AR coefficients that I had given corresponded to a filter that looks like: t=0:2:199; %t is in msec x=exp(-t/25).*sin(2*pi*t/60); %this gives about one damped cycle with 60 msec period XX=[x(3:100); x(2:99); x(1:98)]; coef=XX(1,:)/XX(2:3,:) %linear regression to get AR coefficients where coef = [1.806 -.852] from this linear regression, which is similar to what I had sent in my previous email for generating the noisy filtered time series. Again, my question is how to generate noise that looks like EEG or MEG. Can I do an adequate job simply by getting nice AR coefficients (what would some good coefficients be?) or do I need to do fancier things? For example, should I worry about sparse bursts of alpha? What do people commonly do to simulate data. I like to use simulated time series in addition to real data so that I am confident about what is going on underneath. Stan On Tue, Nov 24, 2009 at 2:18 AM, Stanley Klein wrote: > I too have lots of questions on how to do statistics on EEG and MEG. > Right now for example we are getting very similar EEG and MEG > waveforms (following SVD) and are trying out various statistical ways > of comparing them. In addition to using Fieldtrip's wonderful (but > complicated) cluster permutation test for dealing with multiple > comparisons and correlated noise issues we are trying other ideas. The > only way that we can figure out whether we are on the right track is > to do simulations where we know the correct answer. Does anyone have > good advice on how to do good simulations? We are using the CTF > machine for our EEG and MEG (and Biosemi for EEG alone). Every sample > is about 2 msec. For a single trace  we are using something like the > following Matlab code that gives a flat amplitude spectrum out to 15 > Hz and then close to 1/f^2 beyond that. > > x(1:2)=[0 1]; > for i=3:10000; >   x(i) = 1.81*x(i-1) -.85*x(i-2)+randn;  %AR model for time series > end > > The AR coefficients were obtained by trial and error and have a lot of > flexibility. > > The question again is whether anyone has good suggestions for how to > simulate EEG or MEG noise in the time domain?  Even better would be > something good to read.   I'd like the noise to be manufactured in the > time domain since I'll be doing other things for the signal in the > time domain including multiplicative noise. Without good simulations > how do people test all their statistics, especially when there is a > bunch of preprocessing like SVD (or complicated, nonlinear interaction > terms)? > thanks, > Stan Klein > ---------------------------------- The aim of this list is to facilitate the discussion between users of the FieldTrip toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/neuroimaging/fieldtrip. From moratti at MED.UCM.ES Tue Nov 24 14:51:52 2009 From: moratti at MED.UCM.ES (Stephan Moratti) Date: Tue, 24 Nov 2009 14:51:52 +0100 Subject: Question about permutation testing of an interaction in a two by two design Message-ID: Eric, Thanks a lot for your reply ! Best, Stephan ---------------------------------- The aim of this list is to facilitate the discussion between users of the FieldTrip toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/neuroimaging/fieldtrip. From moratti at MED.UCM.ES Tue Nov 24 15:04:49 2009 From: moratti at MED.UCM.ES (Stephan Moratti) Date: Tue, 24 Nov 2009 15:04:49 +0100 Subject: Question about permutation testing of an interaction in a two by two design Message-ID: Dear Guillaume, Thanks for the reply. I think what I meant with "keeping the condition structure", refelcts what you have described in your awnser (but in a far better way I gave to admit !). What I did is doing so in "R" (a statistical package) and then use fieldtrip to do the cluster statistic. Best and many thanks, Stephan ---------------------------------- The aim of this list is to facilitate the discussion between users of the FieldTrip toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/neuroimaging/fieldtrip. From wanglinsisi at GMAIL.COM Tue Nov 24 20:48:54 2009 From: wanglinsisi at GMAIL.COM (Lin Wang) Date: Tue, 24 Nov 2009 20:48:54 +0100 Subject: Question about permutation testing of an interaction in a two by two design In-Reply-To: Message-ID: Dear Eric, Thanks for your clear answer. I also have a question about the permutation testing of the interactions in the mixed factorial design. Suppose I have three factors, with two levels in each: 2Group(boys,girls)*2A(A1,A2)*2B(B1,B2). Factor Group is a between-subject factor, while factor A and B are within-subject factors. What I want to test is whether factors B influences factor A differently on boys and girls (a three-way interaction). Can I test the interaction between factor B and Group separately in B1 and B2 conditions? That is, first split the data into two parts (B1, B2), and then for each part test the interaction between factor A and Group by subtracting the observations of A1 from A2 and taking it as a new dependent variable. Furthermore, if I have another factor C(C1, C2), and I'm interested in whether the combination of B and C influences factor A differently on boys and girls. Can I first split the data into four parts according to the combination of factor B and C (B1C1, B1C2, B2C1, B2C2) and do the interaction between factor A and Group separately for each part? Thank you in advance. Lin 2009/11/24 Eric Maris > Dear Stephan, > > > > > > It is sometimes possible to reformulate an interaction effect null > hypothesis such that it becomes a main effect null hypothesis (however, for > a different dependent variable, obtained be calculating the difference > between conditions). Such a reformulation is possible for a two-factorial > design in which one independent variable is manipulated within subjects (in > your case, this is condition), and the other between subjects (in your case, > this is group). You do this by calculating subject-specific difference > scores, [condition1 - condition2], and using these as the dependent variable > in a between-groups comparison. This is possible by means of the standard > independent-samples T-test, but also by means of a permutation test > (involving permutation of the difference scores), which allows you to deal > with the multiple comparison problem. > > > > For a factorial design that only involves between-subject independent > variables, such a reformulation is not possible (at least, I am not aware of > it). > > > > > > Best, > > > > Eric > > > > > > > > > > > -----Oorspronkelijk bericht----- > > > Van: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] Namens > > > Stephan Moratti > > > Verzonden: dinsdag 24 november 2009 10:20 > > > Aan: FIELDTRIP at NIC.SURFNET.NL > > > Onderwerp: Re: [FIELDTRIP] Question about permutation testing of an > interaction > > > in a two by two design > > > > > > Hi all, > > > > > > Thanks for the interesing discussion about the interaction with respect > to > > > permutation. I have been also struggling with this question. As we want > to > > > test the interaction (and not the main effect condition), I am not sure > if > > > resampling condition would produce the distribution of our null > hypothesis. > > > Regarding the interaction, we want to check if the mean values across > > > conditions follow the same pattern in two groups (if we consider a group > x > > > condition interaction). If we make a line plot an interaction would be > indicated > > > by a line crossing if each line represents a group (ideally). No > interaction > > > would be represented by parallel lines for each group. So I wonder if by > > > resampling the subject values between the groups keeping the condition > > > structure intact, would create our null distribution for the interaction. > If we > > > resample condition, we would destroy the condition structure. > > > > > > What do you think? I would be happy for any input. > > > > > > Best, > > > > > > Stephan > > > > > > ---------------------------------- > > > The aim of this list is to facilitate the discussion between users of the > FieldTrip > > > toolbox, to share experiences and to discuss new ideas for MEG and EEG > analysis. > > > See also http://listserv.surfnet.nl/archives/fieldtrip.html and > > > http://www.ru.nl/neuroimaging/fieldtrip. > > ---------------------------------- > > The aim of this list is to facilitate the discussion between users of the > FieldTrip toolbox, to share experiences and to discuss new ideas for MEG and > EEG analysis. > > http://listserv.surfnet.nl/archives/fieldtrip.html > > http://www.ru.nl/fcdonders/fieldtrip/ > ---------------------------------- The aim of this list is to facilitate the discussion between users of the FieldTrip toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/neuroimaging/fieldtrip. -------------- next part -------------- An HTML attachment was scrubbed... URL: From e.maris at DONDERS.RU.NL Tue Nov 24 23:39:18 2009 From: e.maris at DONDERS.RU.NL (Eric Maris) Date: Tue, 24 Nov 2009 23:39:18 +0100 Subject: Question about permutation testing of an interaction in a two by two design In-Reply-To: Message-ID: Dear Lin, Thanks for your clear answer. I also have a question about the permutation testing of the interactions in the mixed factorial design. Suppose I have three factors, with two levels in each: 2Group(boys,girls)*2A(A1,A2)*2B(B1,B2). Factor Group is a between-subject factor, while factor A and B are within-subject factors. What I want to test is whether factors B influences factor A differently on boys and girls (a three-way interaction). Can I test the interaction between factor B and Group separately in B1 and B2 conditions? That is, first split the data into two parts (B1, B2), and then for each part test the interaction between factor A and Group by subtracting the observations of A1 from A2 and taking it as a new dependent variable. Furthermore, if I have another factor C(C1, C2), and I'm interested in whether the combination of B and C influences factor A differently on boys and girls. Can I first split the data into four parts according to the combination of factor B and C (B1C1, B1C2, B2C1, B2C2) and do the interaction between factor A and Group separately for each part? I do not think it is necessary to split the data and do separate analyses on the different parts. Reformulating an interacting effect null hypothesis as a main effect null hypothesis for a different dependent variable is possible if you have at most a single between-subjects variable in your design. Thus, it also works in the case you describe, with two within-subjects and one between-subjects variable. The dependent variable that must be calculated is the two-way interaction effect contrast for the 2-factorial within-subjects design with the variables A and B: [A1,B1] + [A2,B2] - [A1,B2] - [A2,B1]. You then perform a independent samples T-test on the interaction contrast variable, comparing the two levels of your between-subjects variable. This reformulation is also possible when there are more than two within-subjects variables in the design. The only thing that changes is the interaction effec contrast. Best, Eric dr. Eric Maris Donders Institute for Brain, Cognition and Behavior Center for Cognition and F.C. Donders Center for Cognitive Neuroimaging Radboud University P.O. Box 9104 6500 HE Nijmegen The Netherlands T:+31 24 3612651 Mobile: 06 39584581 F:+31 24 3616066 E: e. maris at donders.ru.nl MSc Cognitive Neuroscience: www.ru.nl/master/cns/ Thank you in advance. Lin 2009/11/24 Eric Maris Dear Stephan, It is sometimes possible to reformulate an interaction effect null hypothesis such that it becomes a main effect null hypothesis (however, for a different dependent variable, obtained be calculating the difference between conditions). Such a reformulation is possible for a two-factorial design in which one independent variable is manipulated within subjects (in your case, this is condition), and the other between subjects (in your case, this is group). You do this by calculating subject-specific difference scores, [condition1 - condition2], and using these as the dependent variable in a between-groups comparison. This is possible by means of the standard independent-samples T-test, but also by means of a permutation test (involving permutation of the difference scores), which allows you to deal with the multiple comparison problem. For a factorial design that only involves between-subject independent variables, such a reformulation is not possible (at least, I am not aware of it). Best, Eric > -----Oorspronkelijk bericht----- > Van: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] Namens > Stephan Moratti > Verzonden: dinsdag 24 november 2009 10:20 > Aan: FIELDTRIP at NIC.SURFNET.NL > Onderwerp: Re: [FIELDTRIP] Question about permutation testing of an interaction > in a two by two design > > Hi all, > > Thanks for the interesing discussion about the interaction with respect to > permutation. I have been also struggling with this question. As we want to > test the interaction (and not the main effect condition), I am not sure if > resampling condition would produce the distribution of our null hypothesis. > Regarding the interaction, we want to check if the mean values across > conditions follow the same pattern in two groups (if we consider a group x > condition interaction). If we make a line plot an interaction would be indicated > by a line crossing if each line represents a group (ideally). No interaction > would be represented by parallel lines for each group. So I wonder if by > resampling the subject values between the groups keeping the condition > structure intact, would create our null distribution for the interaction. If we > resample condition, we would destroy the condition structure. > > What do you think? I would be happy for any input. > > Best, > > Stephan > > ---------------------------------- > The aim of this list is to facilitate the discussion between users of the FieldTrip > toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. > See also http://listserv.surfnet.nl/archives/fieldtrip.html and > http://www.ru.nl/neuroimaging/fieldtrip. ---------------------------------- The aim of this list is to facilitate the discussion between users of the FieldTrip toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. http://listserv.surfnet.nl/archives/fieldtrip.html http://www.ru.nl/fcdonders/fieldtrip/ ---------------------------------- The aim of this list is to facilitate the discussion between users of the FieldTrip toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. http://listserv.surfnet.nl/archives/fieldtrip.html http://www.ru.nl/fcdonders/fieldtrip/ ---------------------------------- The aim of this list is to facilitate the discussion between users of the FieldTrip toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/neuroimaging/fieldtrip. -------------- next part -------------- An HTML attachment was scrubbed... URL: From dahliash at STANFORD.EDU Wed Nov 25 05:43:21 2009 From: dahliash at STANFORD.EDU (Dahlia Sharon) Date: Wed, 25 Nov 2009 05:43:21 +0100 Subject: freqstatistics: direct access to t statistic of observed data Message-ID: Hi, I'm running freqstatistics to test for a difference in coherence between two stimulus conditions (data is time x freq with only 1 channel combination), using the montecarlo and permutation options. Could anyone instruct me how to access the t statistic (NOT the cluster level statistic but that of the raw spectra) of the observed data (for all time-frequency points), and its threshold? Thanks!!! Dahlia. ---------------------------------- The aim of this list is to facilitate the discussion between users of the FieldTrip toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/neuroimaging/fieldtrip. From wanglinsisi at GMAIL.COM Wed Nov 25 09:37:51 2009 From: wanglinsisi at GMAIL.COM (Lin Wang) Date: Wed, 25 Nov 2009 09:37:51 +0100 Subject: Question about permutation testing of an interaction in a two by two design In-Reply-To: <03B30C59D4B24992926172AEE418B8DA@ru42146fac3249> Message-ID: Dear Eric, Thank you very much for you reply. I'm clear about the testing of multiple-way interaction now. I suppose the tests I mentioned in the last email is simple effect test. Am I right? Thanks again. Lin 2009/11/24 Eric Maris > Dear Lin, > > > > > > > > Thanks for your clear answer. I also have a question about the permutation > testing of the interactions in the mixed factorial design. > > Suppose I have three factors, with two levels in each: > 2Group(boys,girls)*2A(A1,A2)*2B(B1,B2). Factor Group is a between-subject > factor, while factor A and B are within-subject factors. What I want to test > is whether factors B influences factor A differently on boys and girls (a > three-way interaction). > > Can I test the interaction between factor B and Group separately in B1 and > B2 conditions? That is, first split the data into two parts (B1, B2), and > then for each part test the interaction between factor A and Group by > subtracting the observations of A1 from A2 and taking it as a new dependent > variable. > > Furthermore, if I have another factor C(C1, C2), and I'm interested in > whether the combination of B and C influences factor A differently on boys > and girls. Can I first split the data into four parts according to the > combination of factor B and C (B1C1, B1C2, B2C1, B2C2) and do the > interaction between factor A and Group separately for each part? > > I do not think it is necessary to split the data and do separate analyses > on the different parts. > > Reformulating an interacting effect null hypothesis as a main effect null > hypothesis for a different dependent variable is possible if you have at > most a single between-subjects variable in your design. Thus, it also works > in the case you describe, with two within-subjects and one between-subjects > variable. The dependent variable that must be calculated is the two-way > interaction effect contrast for the 2-factorial within-subjects design with > the variables A and B: [A1,B1] + [A2,B2] – [A1,B2] – [A2,B1]. You then > perform a independent samples T-test on the interaction contrast variable, > comparing the two levels of your between-subjects variable. > > This reformulation is also possible when there are more than two > within-subjects variables in the design. The only thing that changes is the > interaction effec contrast. > > > > Best, > > Eric > > > > dr. Eric Maris > Donders Institute for Brain, Cognition and Behavior > > Center for Cognition and F.C. Donders Center for Cognitive Neuroimaging > > Radboud University > P.O. Box 9104 > 6500 HE Nijmegen > The Netherlands > T:+31 24 3612651 > Mobile: 06 39584581 > > F:+31 24 3616066 > E: e.maris at donders.ru.nl > > > > MSc Cognitive Neuroscience: www.ru.nl/master/cns/ > > > > > > > Thank you in advance. > > Lin > > > 2009/11/24 Eric Maris > > Dear Stephan, > > > > > > It is sometimes possible to reformulate an interaction effect null > hypothesis such that it becomes a main effect null hypothesis (however, for > a different dependent variable, obtained be calculating the difference > between conditions). Such a reformulation is possible for a two-factorial > design in which one independent variable is manipulated within subjects (in > your case, this is condition), and the other between subjects (in your case, > this is group). You do this by calculating subject-specific difference > scores, [condition1 - condition2], and using these as the dependent variable > in a between-groups comparison. This is possible by means of the standard > independent-samples T-test, but also by means of a permutation test > (involving permutation of the difference scores), which allows you to deal > with the multiple comparison problem. > > > > For a factorial design that only involves between-subject independent > variables, such a reformulation is not possible (at least, I am not aware of > it). > > > > > > Best, > > > > Eric > > > > > > > > > > > -----Oorspronkelijk bericht----- > > > Van: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] Namens > > > Stephan Moratti > > > Verzonden: dinsdag 24 november 2009 10:20 > > > Aan: FIELDTRIP at NIC.SURFNET.NL > > > Onderwerp: Re: [FIELDTRIP] Question about permutation testing of an > interaction > > > in a two by two design > > > > > > Hi all, > > > > > > Thanks for the interesing discussion about the interaction with respect > to > > > permutation. I have been also struggling with this question. As we want > to > > > test the interaction (and not the main effect condition), I am not sure > if > > > resampling condition would produce the distribution of our null > hypothesis. > > > Regarding the interaction, we want to check if the mean values across > > > conditions follow the same pattern in two groups (if we consider a group > x > > > condition interaction). If we make a line plot an interaction would be > indicated > > > by a line crossing if each line represents a group (ideally). No > interaction > > > would be represented by parallel lines for each group. So I wonder if by > > > resampling the subject values between the groups keeping the condition > > > structure intact, would create our null distribution for the interaction. > If we > > > resample condition, we would destroy the condition structure. > > > > > > What do you think? I would be happy for any input. > > > > > > Best, > > > > > > Stephan > > > > > > ---------------------------------- > > > The aim of this list is to facilitate the discussion between users of the > FieldTrip > > > toolbox, to share experiences and to discuss new ideas for MEG and EEG > analysis. > > > See also http://listserv.surfnet.nl/archives/fieldtrip.html and > > > http://www.ru.nl/neuroimaging/fieldtrip. > > ---------------------------------- > > The aim of this list is to facilitate the discussion between users of the > FieldTrip toolbox, to share experiences and to discuss new ideas for MEG and > EEG analysis. > > http://listserv.surfnet.nl/archives/fieldtrip.html > > http://www.ru.nl/fcdonders/fieldtrip/ > > > > ---------------------------------- > > The aim of this list is to facilitate the discussion between users of the > FieldTrip toolbox, to share experiences and to discuss new ideas for MEG and > EEG analysis. > > http://listserv.surfnet.nl/archives/fieldtrip.html > > http://www.ru.nl/fcdonders/fieldtrip/ > > ---------------------------------- > > The aim of this list is to facilitate the discussion between users of the > FieldTrip toolbox, to share experiences and to discuss new ideas for MEG and > EEG analysis. > > http://listserv.surfnet.nl/archives/fieldtrip.html > > http://www.ru.nl/fcdonders/fieldtrip/ > ---------------------------------- The aim of this list is to facilitate the discussion between users of the FieldTrip toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/neuroimaging/fieldtrip. -------------- next part -------------- An HTML attachment was scrubbed... URL: From rajamonis at MAIL.NIH.GOV Thu Nov 26 14:53:36 2009 From: rajamonis at MAIL.NIH.GOV (Rajamoni Nadar, Sreenivasan (NIH/NIMH) [E]) Date: Thu, 26 Nov 2009 08:53:36 -0500 Subject: single trial source signal Message-ID: FieldTrip Users, Is it possible to get single trial source signal using FieldTrip? I would appreciate if anybody could provide code for the same. Thank you, Vasan ---------------------------------- The aim of this list is to facilitate the discussion between users of the FieldTrip toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/neuroimaging/fieldtrip. From Hanneke.vanDijk at MED.UNI-DUESSELDORF.DE Sat Nov 28 22:46:15 2009 From: Hanneke.vanDijk at MED.UNI-DUESSELDORF.DE (Hanneke Van Dijk) Date: Sat, 28 Nov 2009 22:46:15 +0100 Subject: single trial source signal Message-ID: Dear Vasan, You could try doing freqanalysis with cfg.output = 'fourier'; and then sourceanalysis with cfg.method = 'pcc'. If I remember well you should specify cfg.keeptrials = 'yes'; For freqanalysis I used cfg.method = 'mtmfft' ( = without keeping time-information), and cfg.taper = 'hanning'; That should work. If you need more info I should have a look at my scripts so please let me know then! Good luck! Hanneke _______________________ Institute for Clinical Neuroscience and Medical Psychology Heinrich Heine Universitaet, Duesseldorf. -----Oorspronkelijk bericht----- Van: FieldTrip discussion list namens Rajamoni Nadar, Sreenivasan (NIH/NIMH) [E] Verzonden: do 26.11.2009 14:53 Aan: FIELDTRIP at NIC.SURFNET.NL Onderwerp: [FIELDTRIP] single trial source signal FieldTrip Users, Is it possible to get single trial source signal using FieldTrip? I would appreciate if anybody could provide code for the same. Thank you, Vasan ---------------------------------- The aim of this list is to facilitate the discussion between users of the FieldTrip toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/neuroimaging/fieldtrip. ---------------------------------- The aim of this list is to facilitate the discussion between users of the FieldTrip toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/neuroimaging/fieldtrip. From Hanneke.vanDijk at MED.UNI-DUESSELDORF.DE Sun Nov 29 09:38:55 2009 From: Hanneke.vanDijk at MED.UNI-DUESSELDORF.DE (Hanneke Van Dijk) Date: Sun, 29 Nov 2009 09:38:55 +0100 Subject: single trial source signal Message-ID: Dear Vasan, Since I don't know exactly how far you are in doing the analysis, I just send you the basic script that shows the most important parameters. Don't forget to do freqanalysis with cfg.output = 'fourier' and cfg.method = 'mtmfft' for the specific frequency (cfg.foilim) you want to focus on. cfg = []; cfg.grid.pos = location of source coordinate;% [x y z] to fill in cfg.frequency = frequency of interest; cfg.vol = headmodel; %to make yourself see http://fieldtrip.fcdonders.nl/example/make_leadfields_using_different_headmodels cfg.projectnoise = 'yes';%to compute the neural activity index using sourcedescriptives cfg.lambda = '10%';%the amount of noice to estimate estimated cfg.method = 'pcc'; cfg.keeptrials = 'yes'; Virtual_channeldata = sourceanalysis(cfg,freq); You can do sourcedescriptives after that. 'help freqanalysis', 'help sourceanalysis' and 'help sourcedescriptives' should also help you further. Or you could have a look at the fieldtrip website. There are a lot of options to taylor the analysis to your data. Hope this helps! Best, Hanneke van Dijk ------------------------------------------------------------ Institute for Clinical Neuroscience and Medical Psychology Heinrich Heine Universitaet, Duesseldorf, Germany ------------------------------------------------------------ -----Oorspronkelijk bericht----- Van: FieldTrip discussion list namens Rajamoni Nadar, Sreenivasan (NIH/NIMH) [E] Verzonden: do 26.11.2009 14:53 Aan: FIELDTRIP at NIC.SURFNET.NL Onderwerp: [FIELDTRIP] single trial source signal FieldTrip Users, Is it possible to get single trial source signal using FieldTrip? I would appreciate if anybody could provide code for the same. Thank you, Vasan ---------------------------------- The aim of this list is to facilitate the discussion between users of the FieldTrip toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/neuroimaging/fieldtrip. ---------------------------------- The aim of this list is to facilitate the discussion between users of the FieldTrip toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/neuroimaging/fieldtrip. From sreenivasan.r.nadar at GMAIL.COM Mon Nov 30 21:02:13 2009 From: sreenivasan.r.nadar at GMAIL.COM (Sreenivasan Rajamoni Nadar) Date: Mon, 30 Nov 2009 15:02:13 -0500 Subject: single trial source signal In-Reply-To: <72E993C35FB11743B79FF9286E5B6D8B0F3538@Mail2-UKD.VMED.UKD> Message-ID: Dear FieldTrip users, I personally feel that the FieldTrip (latest version) does not seems to having the capability to extract single trial source signals using any of the the time domain beamformers: LCMV, MNE, SAM, LORETA, RV or using the frequency domain beamformer methods like DICS and PCC !! Please let me know if any of you made plugin codes to Fieldtrip to get single trial source data? Robert, Could you let me know if there is any other version which does the above? Thank you, Vasan ---------------------------------- The aim of this list is to facilitate the discussion between users of the FieldTrip toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/neuroimaging/fieldtrip. -------------- next part -------------- An HTML attachment was scrubbed... URL: From s.mohr at PSY.GLA.AC.UK Tue Nov 3 14:30:14 2009 From: s.mohr at PSY.GLA.AC.UK (Sibylle Mohr) Date: Tue, 3 Nov 2009 14:30:14 +0100 Subject: multiplotTFR goes wrong Message-ID: Dear Fieldtrippers, I have a problem concerning multiplotTFR, which I did not have a couple of months ago: I import 4 conditions (lexical match/lexical mismatch and stereotypical match / stereotypical mismatch). After doing a multitaper analysis for different frequencies I do a baseline correction using 'zscore' across the averaged trials for each condition. When I plot the resulting zscore corrected conditions using multiploTFR contrasting 'lexical mismatch' with 'lexical match' and afterwards 'stereotypical mismatch' with 'stereotypical match', it looks like the stereotypical conditions are almost the inverse plot of my lexical conditions. I always clear the cfg before I start a new plot. I also use cfg.interactive = 'yes'. Any ideas why this is happening..? I'll attach the scripts for the multitaper analysis, the baseline correction, and for the plotting. Thanks, Sibylle ----------------------- MULTITAPER ANALYSIS function hifreq_ana % anaphora files: high frequencies % BESA datafiles in one condition filename_ana{1} = { 'An1_sb1_lexmatch-export.dat' 'An1_sb9_lexmatch-export.dat' 'An1_sb13_lexmatch-export.dat' 'An1_sb17_lexmatch-export.dat' 'An1_sb21_lexmatch-export.dat' 'An2_sb2_lexmatch-export.dat' 'An2_sb6_lexmatch-export.dat' 'An2_sb10_lexmatch-export.dat' 'An2_sb18_lexmatch-export.dat' 'An2_sb22_lexmatch-export.dat' 'An3_sb3_lexmatch-export.dat' 'An3_sb7_lexmatch-export.dat' 'An3_sb11_lexmatch-export.dat' 'An3_sb15_lexmatch-export.dat' 'An3_sb23_lexmatch-export.dat' 'An4_sb4_lexmatch-export.dat' 'An4_sb8_lexmatch-export.dat' 'An4_sb12_lexmatch-export.dat' 'An4_sb16_lexmatch-export.dat' 'An4_sb24_lexmatch-export.dat' }; % BESA datafiles in the other condition filename_ana{2} = { 'An1_sb1_lexmis-export.dat' 'An1_sb9_lexmis-export.dat' 'An1_sb13_lexmis-export.dat' 'An1_sb17_lexmis-export.dat' 'An1_sb21_lexmis-export.dat' 'An2_sb2_lexmis-export.dat' 'An2_sb6_lexmis-export.dat' 'An2_sb10_lexmis-export.dat' 'An2_sb18_lexmis-export.dat' 'An2_sb22_lexmis-export.dat' 'An3_sb3_lexmis-export.dat' 'An3_sb7_lexmis-export.dat' 'An3_sb11_lexmis-export.dat' 'An3_sb15_lexmis-export.dat' 'An3_sb23_lexmis-export.dat' 'An4_sb4_lexmis-export.dat' 'An4_sb8_lexmis-export.dat' 'An4_sb12_lexmis-export.dat' 'An4_sb16_lexmis-export.dat' 'An4_sb24_lexmis-export.dat' }; filename_ana{3} = { 'An1_sb1_stermatch-export.dat' 'An1_sb9_stermatch-export.dat' 'An1_sb13_stermatch-export.dat' 'An1_sb17_stermatch-export.dat' 'An1_sb21_stermatch-export.dat' 'An2_sb2_stermatch-export.dat' 'An2_sb6_stermatch-export.dat' 'An2_sb10_stermatch-export.dat' 'An2_sb18_stermatch-export.dat' 'An2_sb22_stermatch-export.dat' 'An3_sb3_stermatch-export.dat' 'An3_sb7_stermatch-export.dat' 'An3_sb11_stermatch-export.dat' 'An3_sb15_stermatch-export.dat' 'An3_sb23_stermatch-export.dat' 'An4_sb4_stermatch-export.dat' 'An4_sb8_stermatch-export.dat' 'An4_sb12_stermatch-export.dat' 'An4_sb16_stermatch-export.dat' 'An4_sb24_stermatch-export.dat' }; % BESA datafiles in the other condition filename_ana{4} = { 'An1_sb1_stermis-export.dat' 'An1_sb9_stermis-export.dat' 'An1_sb13_stermis-export.dat' 'An1_sb17_stermis-export.dat' 'An1_sb21_stermis-export.dat' 'An2_sb2_stermis-export.dat' 'An2_sb6_stermis-export.dat' 'An2_sb10_stermis-export.dat' 'An2_sb18_stermis-export.dat' 'An2_sb22_stermis-export.dat' 'An3_sb3_stermis-export.dat' 'An3_sb7_stermis-export.dat' 'An3_sb11_stermis-export.dat' 'An3_sb15_stermis-export.dat' 'An3_sb23_stermis-export.dat' 'An4_sb4_stermis-export.dat' 'An4_sb8_stermis-export.dat' 'An4_sb12_stermis-export.dat' 'An4_sb16_stermis-export.dat' 'An4_sb24_stermis-export.dat' }; ncond = length(filename_ana); nsubj = length(filename_ana{1}); tmp = importdata('New_elect72.elp'); for j = 1:ncond clear data for i=1:nsubj data = besa2fieldtrip(filename_ana{j}{i}); % % import electrode file and create electrode arrays % % with coordinates in elp file % % match channel and electrode names data.label = tmp.textdata(:,2); clear cfg; cfg.foi = [30:4:130]; numfoi = length(cfg.foi); cfg.t_ftimwin = zeros(1,numfoi); cfg.t_ftimwin(:) = 0.25; cfg.method = 'mtmconvol'; cfg.output = 'pow'; cfg.toi = [-0.5:0.02:1.5]; cfg.taper = 'dpss'; cfg.tapsmofrq = zeros(1,numfoi); cfg.tapsmofrq(:) = 16; cfg.keeptrials = 'yes'; freqhi = freqanalysis(cfg,data); % change from double to single precision to save space on the harddisk single = struct2single(freqhi); save(sprintf('/analyse/12/Project0042/Gender_new/dat- files_multitaper/anaphora/hi_freq_%d_%d.mat',j,i),'single'); clear single end; % subject loop end; % condition loop exit; --------------------------------------- BASELINE CORRECTION SCRIPT function allfreq_zscores name = {'lex','lexmis','ster','stermis'}; ldir = '/analyse/12/Project0042/Gender_new/dat-files_multitaper/'; path = {'anaphora/','cataphora/'}; frq = {'lo','med'}; pathname = {'ana','cat'}; %pathname = {'cat'}; %................. LO AND MEDIUM FREQUENCY ANALYSIS for p = 1:length(path) for f = 1:length(frq) for i = 1:length(name) load(sprintf('%s%s%s_%s.mat',ldir,path{p},frq{f},name{i})); for j = 1:20 if f == 1 if i == 1 freq = freqlo_lexmatch{j}; elseif i == 2 freq = freqlo_lexmis{j}; elseif i == 3 freq = freqlo_stermatch{j}; elseif i == 4 freq = freqlo_stermis{j}; end; elseif f == 2 if i == 1 freq = freqmed_lexmatch{j}; elseif i == 2 freq = freqmed_lexmis{j}; elseif i == 3 freq = freqmed_stermatch{j}; elseif i == 4 freq = freqmed_stermis{j}; end; end; double = struct2double(freq); clear freq; %... check if there is the trial-dimension or not if length(size(double.powspctrm)) == 4 double = freqdescriptives([],double); end; cfg = []; cfg.baseline = [-0.5 0]; cfg.baselinetype = 'zscore'; freq = freqbaseline(cfg,double); clear double freqdes{j} = struct2single(freq); clear freq end; % subject loop save(sprintf('%s%s_%s_z_%s.mat',ldir,pathname{p},frq{f},name{i}),'freqdes'); clear freqdes end; % condition loop end; % frequency loop end; % path loop %.................. HI FREQUENCY ANALYSIS disp('SWITCHING TO HIGH FREQUENCIES') for p = 1:length(path); %two different paths for i = 1:length(name); %four different conditions for j = 1:20 %(length of subjects) tmp=load(sprintf('%s%shi_freq_%d_%d.mat',ldir,path{p},i,j)); % convert to double before starting calculations double = struct2double(tmp.single); clear freq % average across trials using freqdescriptives double = freqdescriptives([],double); % do baseline normalization across the AVERAGED trials (for normalization % over SINGLE trials, switch around freqdescriptives and freqbaseline) clear cfg; cfg.baseline = [-0.5 0]; cfg.baselinetype = 'zscore'; fqhi = freqbaseline(cfg,double); clear double freqdes{j} = struct2single(fqhi); clear fqhi end; % subject loop/ j-loop %save freqdescriptives of 20 subjets (single precision) into one cell-array, and save that %per condition. save(sprintf('%s%s_hi_z_%s.mat',ldir,pathname{p},name{i}),'freqdes'); clear freqdes end; % condition loop / i-loop end; % path loop exit; -------------------------------------- PLOTTING SCRIPT %.................HI FREQUENCY ANALYSIS PLOTS clear all; load(sprintf('cat_hi_z_lex.mat')); hi_lmatch=freqdes; clear freqdes load(sprintf('cat_hi_z_lexmis.mat')); hi_lmis=freqdes; clear freqdes load(sprintf('cat_hi_z_ster.mat')); hi_smatch=freqdes; clear freqdes load(sprintf('cat_hi_z_stermis.mat')); hi_smis=freqdes; clear freqdes clear grandhi1_lexmatch grandhi1_lmis grandhi1_smatch grandhi1_smis; cfg = []; grandhi1_lmatch = freqgrandaverage(cfg, hi_lmatch{:}); grandhi1_lmis = freqgrandaverage(cfg, hi_lmis{:}); grandhi1_smatch = freqgrandaverage(cfg, hi_smatch{:}); grandhi1_smis = freqgrandaverage(cfg, hi_smis{:}); clear avgdif_a; clear avgdif_b; avgdif_a = grandhi1_lmis; avgdif_a.powspctrm = ((grandhi1_lmis.powspctrm - grandhi1_lmatch.powspctrm)./grandhi1_lmatch.powspctrm).*100; avgdif_b = grandhi1_smis; avgdif_b.powspctrm = ((grandhi1_smis.powspctrm - grandhi1_smatch.powspctrm)./grandhi1_smatch.powspctrm).*100; clear cfg; load('elec.mat'); % scale the electrodes to a realistic head size (in cm) elec.pnt = 10*elec.pnt; clear cfg; cfg= []; cfg.elec = elec; cfg.colorbar = 'yes'; cfg.xparam = 'time'; cfg.yparam = 'freq'; cfg.zparam = 'powspctrm'; cfg.showlabels = 'yes'; cfg.layout = 'sibylle.lay'; cfg.interactive = 'yes'; cfg.title = 'lexical_conditions'; cfg.xlim = ([-0.5 1.5]); cfg.ylim = [30 130]; %cfg.zlim = [-50 50]; figure; multiplotTFR(cfg, avgdif_a); title('FreqHi Cata: lexical match vs. mismatch'); clear cfg; cfg= []; cfg.elec = elec; cfg.colorbar = 'yes'; cfg.xparam = 'time'; cfg.yparam = 'freq'; cfg.zparam = 'powspctrm'; cfg.showlabels = 'yes'; cfg.layout = 'sibylle.lay'; cfg.interactive = 'yes'; cfg.title = 'lexical_conditions'; cfg.xlim = ([-0.5 1.5]); cfg.ylim = [30 130]; %cfg.zlim = [-50 50]; figure; multiplotTFR(cfg, avgdif_b); title('FreqHi Cata: stereotypicalmatch vs. mismatch'); -------------------------------- ---------------------------------- The aim of this list is to facilitate the discussion between users of the FieldTrip toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/neuroimaging/fieldtrip. From akiko at NYU.EDU Sun Nov 8 20:30:35 2009 From: akiko at NYU.EDU (Akiko Ikkai) Date: Sun, 8 Nov 2009 14:30:35 -0500 Subject: artifact rejection with limited time period Message-ID: Hello, I'm looking for a way to run rejectvisual on specific time periods without cropping the epochs. We are working on intracranial EEG data, with eye movement parameters (x,y, pupil) added from the eye tracker. Subjects make eye movements to target in the periphery. Our epoch is between [-1.0 2.5] around the onset of the response phase, where subjects are instructed to make eye movements (usually eye movements are detected around .25 to .35 after the onset of the response phase). I'd like to reject trials where subjects made wrong/unnecessary eye movements during the response phase. Currently, I'm running cfg = []; cfg.alim = 6e3; cfg.method = 'channel'; good = rejectvisual(cfg.ft_data); to visualize eye channels, but I'd like to limit the display only to [0 1.5] around the response phase (eye movements during intertrial interval is not much of a problem for now). I don't think it's a good idea to trim data only to this period, considering I'd like to run ERP and TFR on this data. So, is there any commands I can add to limit the display time periods in rejectvisual, but at the end of the day, I can still keep the intact epochs? Thanks in advance! Akiko ---------------------------------- The aim of this list is to facilitate the discussion between users of the FieldTrip toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/neuroimaging/fieldtrip. From rmontefusco at MED.UCHILE.CL Sun Nov 8 22:16:27 2009 From: rmontefusco at MED.UCHILE.CL (Rodrigo A. Montefusco Siegmund) Date: Sun, 8 Nov 2009 18:16:27 -0300 Subject: artifact rejection with limited time period In-Reply-To: <5fe0dcd43968dc.4af6d60b@mail.nyu.edu> Message-ID: Hi try using this command line cfg.latency = [0 1.5]; I hope it helps best regards Rodrigo > Hello, > > I'm looking for a way to run rejectvisual on specific time periods without > cropping the epochs. We are > working on intracranial EEG data, with eye movement parameters (x,y, > pupil) added from the eye > tracker. Subjects make eye movements to target in the periphery. Our epoch > is between [-1.0 2.5] > around the onset of the response phase, where subjects are instructed to > make eye movements > (usually eye movements are detected around .25 to .35 after the onset of > the response phase). > > I'd like to reject trials where subjects made wrong/unnecessary eye > movements during the response > phase. > > Currently, I'm running > cfg = []; > cfg.alim = 6e3; > cfg.method = 'channel'; > good = rejectvisual(cfg.ft_data); > > to visualize eye channels, but I'd like to limit the display only to [0 > 1.5] around the response phase > (eye movements during intertrial interval is not much of a problem for > now). I don't think it's a good > idea to trim data only to this period, considering I'd like to run ERP and > TFR on this data. > > So, is there any commands I can add to limit the display time periods in > rejectvisual, but at the end of > the day, I can still keep the intact epochs? > > Thanks in advance! Akiko > > ---------------------------------- > The aim of this list is to facilitate the discussion between users of the > FieldTrip toolbox, to share experiences and to discuss new ideas for MEG > and EEG analysis. See also > http://listserv.surfnet.nl/archives/fieldtrip.html and > http://www.ru.nl/neuroimaging/fieldtrip. > =================================== Rodrigo A. Montefusco Siegmund Doctorado en Ciencias Biomédicas Programa de Fisiología y Biofí­sica I. C. B. M. Facultad de Medicina Universidad de Chile Fono: 56 09 82793847 email: rmontefusco at med.uchile.cl =================================== ---------------------------------- The aim of this list is to facilitate the discussion between users of the FieldTrip toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/neuroimaging/fieldtrip. From r.oostenveld at FCDONDERS.RU.NL Mon Nov 9 09:22:53 2009 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Mon, 9 Nov 2009 09:22:53 +0100 Subject: multiplotTFR goes wrong In-Reply-To: Message-ID: Dear Sibylle, Your script looks ok, and I don't recall any changes that might relate to the problem that you are describing. Could you try to run the script using an old version of fieldtrip, corresponding to the original date of your analysis? If the old version and new version then indeed produce inconsistent results, you can look at each of the individual steps to pinpoint the step in the analysis where it goes wrong. To help you perform the analysis with an older fieldtrip version, I have copied some old versions onto the ftp server. All versions of fieldtrip-lite-2009??01.zip are now present, i.e. the first day of each month. I hope this goes back enough. best regards, Robert On 3 Nov 2009, at 14:30, Sibylle Mohr wrote: > Dear Fieldtrippers, > > I have a problem concerning multiplotTFR, which I did not have a > couple of months ago: > I import 4 conditions (lexical match/lexical mismatch and > stereotypical match / > stereotypical mismatch). After doing a multitaper analysis for > different frequencies I do a > baseline correction using 'zscore' across the averaged trials for > each condition. When I > plot the resulting zscore corrected conditions using multiploTFR > contrasting 'lexical > mismatch' with 'lexical match' and afterwards 'stereotypical > mismatch' with 'stereotypical > match', it looks like the stereotypical conditions are almost the > inverse plot of my lexical > conditions. I always clear the cfg before I start a new plot. I also > use cfg.interactive = > 'yes'. Any ideas why this is happening..? > > I'll attach the scripts for the multitaper analysis, the baseline > correction, and for the > plotting. > > Thanks, > > Sibylle > > ----------------------- > MULTITAPER ANALYSIS > > function hifreq_ana > > % anaphora files: high frequencies > > % BESA datafiles in one condition > filename_ana{1} = { > 'An1_sb1_lexmatch-export.dat' > 'An1_sb9_lexmatch-export.dat' > 'An1_sb13_lexmatch-export.dat' > 'An1_sb17_lexmatch-export.dat' > 'An1_sb21_lexmatch-export.dat' > 'An2_sb2_lexmatch-export.dat' > 'An2_sb6_lexmatch-export.dat' > 'An2_sb10_lexmatch-export.dat' > 'An2_sb18_lexmatch-export.dat' > 'An2_sb22_lexmatch-export.dat' > 'An3_sb3_lexmatch-export.dat' > 'An3_sb7_lexmatch-export.dat' > 'An3_sb11_lexmatch-export.dat' > 'An3_sb15_lexmatch-export.dat' > 'An3_sb23_lexmatch-export.dat' > 'An4_sb4_lexmatch-export.dat' > 'An4_sb8_lexmatch-export.dat' > 'An4_sb12_lexmatch-export.dat' > 'An4_sb16_lexmatch-export.dat' > 'An4_sb24_lexmatch-export.dat' > }; > > > % BESA datafiles in the other condition > filename_ana{2} = { > 'An1_sb1_lexmis-export.dat' > 'An1_sb9_lexmis-export.dat' > 'An1_sb13_lexmis-export.dat' > 'An1_sb17_lexmis-export.dat' > 'An1_sb21_lexmis-export.dat' > 'An2_sb2_lexmis-export.dat' > 'An2_sb6_lexmis-export.dat' > 'An2_sb10_lexmis-export.dat' > 'An2_sb18_lexmis-export.dat' > 'An2_sb22_lexmis-export.dat' > 'An3_sb3_lexmis-export.dat' > 'An3_sb7_lexmis-export.dat' > 'An3_sb11_lexmis-export.dat' > 'An3_sb15_lexmis-export.dat' > 'An3_sb23_lexmis-export.dat' > 'An4_sb4_lexmis-export.dat' > 'An4_sb8_lexmis-export.dat' > 'An4_sb12_lexmis-export.dat' > 'An4_sb16_lexmis-export.dat' > 'An4_sb24_lexmis-export.dat' > }; > > filename_ana{3} = { > 'An1_sb1_stermatch-export.dat' > 'An1_sb9_stermatch-export.dat' > 'An1_sb13_stermatch-export.dat' > 'An1_sb17_stermatch-export.dat' > 'An1_sb21_stermatch-export.dat' > 'An2_sb2_stermatch-export.dat' > 'An2_sb6_stermatch-export.dat' > 'An2_sb10_stermatch-export.dat' > 'An2_sb18_stermatch-export.dat' > 'An2_sb22_stermatch-export.dat' > 'An3_sb3_stermatch-export.dat' > 'An3_sb7_stermatch-export.dat' > 'An3_sb11_stermatch-export.dat' > 'An3_sb15_stermatch-export.dat' > 'An3_sb23_stermatch-export.dat' > 'An4_sb4_stermatch-export.dat' > 'An4_sb8_stermatch-export.dat' > 'An4_sb12_stermatch-export.dat' > 'An4_sb16_stermatch-export.dat' > 'An4_sb24_stermatch-export.dat' > }; > > > % BESA datafiles in the other condition > filename_ana{4} = { > 'An1_sb1_stermis-export.dat' > 'An1_sb9_stermis-export.dat' > 'An1_sb13_stermis-export.dat' > 'An1_sb17_stermis-export.dat' > 'An1_sb21_stermis-export.dat' > 'An2_sb2_stermis-export.dat' > 'An2_sb6_stermis-export.dat' > 'An2_sb10_stermis-export.dat' > 'An2_sb18_stermis-export.dat' > 'An2_sb22_stermis-export.dat' > 'An3_sb3_stermis-export.dat' > 'An3_sb7_stermis-export.dat' > 'An3_sb11_stermis-export.dat' > 'An3_sb15_stermis-export.dat' > 'An3_sb23_stermis-export.dat' > 'An4_sb4_stermis-export.dat' > 'An4_sb8_stermis-export.dat' > 'An4_sb12_stermis-export.dat' > 'An4_sb16_stermis-export.dat' > 'An4_sb24_stermis-export.dat' > }; > > ncond = length(filename_ana); > nsubj = length(filename_ana{1}); > > > tmp = importdata('New_elect72.elp'); > > for j = 1:ncond > clear data > > for i=1:nsubj > data = besa2fieldtrip(filename_ana{j}{i}); > % % import electrode file and create electrode arrays > % % with coordinates in elp file > % % match channel and electrode names > data.label = tmp.textdata(:,2); > > clear cfg; > cfg.foi = [30:4:130]; > numfoi = length(cfg.foi); > cfg.t_ftimwin = zeros(1,numfoi); > cfg.t_ftimwin(:) = 0.25; > cfg.method = 'mtmconvol'; > cfg.output = 'pow'; > cfg.toi = [-0.5:0.02:1.5]; > cfg.taper = 'dpss'; > cfg.tapsmofrq = zeros(1,numfoi); > cfg.tapsmofrq(:) = 16; > cfg.keeptrials = 'yes'; > > freqhi = freqanalysis(cfg,data); > % change from double to single precision to save space on the harddisk > single = struct2single(freqhi); > save(sprintf('/analyse/12/Project0042/Gender_new/dat- > files_multitaper/anaphora/hi_freq_%d_%d.mat',j,i),'single'); > clear single > > end; % subject loop > end; % condition loop > exit; > --------------------------------------- > > BASELINE CORRECTION SCRIPT > > function allfreq_zscores > > name = {'lex','lexmis','ster','stermis'}; > ldir = '/analyse/12/Project0042/Gender_new/dat-files_multitaper/'; > path = {'anaphora/','cataphora/'}; > > frq = {'lo','med'}; > pathname = {'ana','cat'}; > %pathname = {'cat'}; > %................. LO AND MEDIUM FREQUENCY ANALYSIS > > for p = 1:length(path) > for f = 1:length(frq) > for i = 1:length(name) > load(sprintf('%s%s%s_%s.mat',ldir,path{p},frq{f},name{i})); > for j = 1:20 > if f == 1 > if i == 1 > freq = freqlo_lexmatch{j}; > elseif i == 2 > freq = freqlo_lexmis{j}; > elseif i == 3 > freq = freqlo_stermatch{j}; > elseif i == 4 > freq = freqlo_stermis{j}; > end; > elseif f == 2 > if i == 1 > freq = freqmed_lexmatch{j}; > elseif i == 2 > freq = freqmed_lexmis{j}; > elseif i == 3 > freq = freqmed_stermatch{j}; > elseif i == 4 > freq = freqmed_stermis{j}; > end; > end; > > double = struct2double(freq); > clear freq; > > %... check if there is the trial-dimension or not > if length(size(double.powspctrm)) == 4 > double = freqdescriptives([],double); > end; > > cfg = []; > cfg.baseline = [-0.5 0]; > cfg.baselinetype = 'zscore'; > freq = freqbaseline(cfg,double); > clear double > > freqdes{j} = struct2single(freq); > clear freq > end; % subject loop > save(sprintf('%s%s_%s_z_ > %s.mat',ldir,pathname{p},frq{f},name{i}),'freqdes'); > clear freqdes > end; % condition loop > end; % frequency loop > end; % path loop > > %.................. HI FREQUENCY ANALYSIS > > disp('SWITCHING TO HIGH FREQUENCIES') > > for p = 1:length(path); %two different paths > for i = 1:length(name); %four different conditions > for j = 1:20 %(length of subjects) > tmp=load(sprintf('%s%shi_freq_%d_%d.mat',ldir,path{p},i,j)); > > % convert to double before starting calculations > double = struct2double(tmp.single); > clear freq > > % average across trials using freqdescriptives > double = freqdescriptives([],double); > > % do baseline normalization across the AVERAGED trials (for > normalization > % over SINGLE trials, switch around freqdescriptives and freqbaseline) > clear cfg; > cfg.baseline = [-0.5 0]; > cfg.baselinetype = 'zscore'; > fqhi = freqbaseline(cfg,double); > clear double > > freqdes{j} = struct2single(fqhi); > clear fqhi > end; % subject loop/ j-loop > %save freqdescriptives of 20 subjets (single precision) into one > cell-array, and save that > %per condition. > save(sprintf('%s%s_hi_z_%s.mat',ldir,pathname{p},name{i}),'freqdes'); > clear freqdes > end; % condition loop / i-loop > end; % path loop > exit; > > -------------------------------------- > > PLOTTING SCRIPT > > %.................HI FREQUENCY ANALYSIS PLOTS > > clear all; > load(sprintf('cat_hi_z_lex.mat')); > hi_lmatch=freqdes; > clear freqdes > > load(sprintf('cat_hi_z_lexmis.mat')); > hi_lmis=freqdes; > clear freqdes > > load(sprintf('cat_hi_z_ster.mat')); > hi_smatch=freqdes; > clear freqdes > > load(sprintf('cat_hi_z_stermis.mat')); > hi_smis=freqdes; > clear freqdes > > > clear grandhi1_lexmatch grandhi1_lmis grandhi1_smatch grandhi1_smis; > cfg = []; > grandhi1_lmatch = freqgrandaverage(cfg, hi_lmatch{:}); > grandhi1_lmis = freqgrandaverage(cfg, hi_lmis{:}); > grandhi1_smatch = freqgrandaverage(cfg, hi_smatch{:}); > grandhi1_smis = freqgrandaverage(cfg, hi_smis{:}); > > clear avgdif_a; > clear avgdif_b; > avgdif_a = grandhi1_lmis; > avgdif_a.powspctrm = ((grandhi1_lmis.powspctrm - > grandhi1_lmatch.powspctrm)./grandhi1_lmatch.powspctrm).*100; > > avgdif_b = grandhi1_smis; > avgdif_b.powspctrm = ((grandhi1_smis.powspctrm - > grandhi1_smatch.powspctrm)./grandhi1_smatch.powspctrm).*100; > > clear cfg; > load('elec.mat'); > % scale the electrodes to a realistic head size (in cm) > elec.pnt = 10*elec.pnt; > clear cfg; > cfg= []; > cfg.elec = elec; > cfg.colorbar = 'yes'; > cfg.xparam = 'time'; > cfg.yparam = 'freq'; > cfg.zparam = 'powspctrm'; > cfg.showlabels = 'yes'; > cfg.layout = 'sibylle.lay'; > cfg.interactive = 'yes'; > cfg.title = 'lexical_conditions'; > cfg.xlim = ([-0.5 1.5]); > cfg.ylim = [30 130]; > %cfg.zlim = [-50 50]; > figure; multiplotTFR(cfg, avgdif_a); > title('FreqHi Cata: lexical match vs. mismatch'); > > clear cfg; > cfg= []; > cfg.elec = elec; > cfg.colorbar = 'yes'; > cfg.xparam = 'time'; > cfg.yparam = 'freq'; > cfg.zparam = 'powspctrm'; > cfg.showlabels = 'yes'; > cfg.layout = 'sibylle.lay'; > cfg.interactive = 'yes'; > cfg.title = 'lexical_conditions'; > cfg.xlim = ([-0.5 1.5]); > cfg.ylim = [30 130]; > %cfg.zlim = [-50 50]; > figure; multiplotTFR(cfg, avgdif_b); > title('FreqHi Cata: stereotypicalmatch vs. mismatch'); > -------------------------------- > > ---------------------------------- > The aim of this list is to facilitate the discussion between users > of the FieldTrip toolbox, to share experiences and to discuss new > ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html > and http://www.ru.nl/neuroimaging/fieldtrip. > ---------------------------------- The aim of this list is to facilitate the discussion between users of the FieldTrip toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/neuroimaging/fieldtrip. From s.mohr at PSY.GLA.AC.UK Mon Nov 9 13:37:45 2009 From: s.mohr at PSY.GLA.AC.UK (sibylle) Date: Mon, 9 Nov 2009 12:37:45 +0000 Subject: multiplotTFR goes wrong In-Reply-To: <599BA806-FDC8-4695-AF49-E9028B727CBF@fcdonders.ru.nl> Message-ID: Dear Robert, thanks a lot for your reply! As you suggested, I will give it a try with an old fieldtrip version. Cheers & best wishes, Sibylle On 9 Nov 2009, at 08:22, Robert Oostenveld wrote: > Dear Sibylle, > > Your script looks ok, and I don't recall any changes that might > relate to the problem that you are describing. Could you try to run > the script using an old version of fieldtrip, corresponding to the > original date of your analysis? If the old version and new version > then indeed produce inconsistent results, you can look at each of > the individual steps to pinpoint the step in the analysis where it > goes wrong. > > To help you perform the analysis with an older fieldtrip version, I > have copied some old versions onto the ftp server. All versions of > fieldtrip-lite-2009??01.zip are now present, i.e. the first day of > each month. I hope this goes back enough. > > best regards, > Robert > > > On 3 Nov 2009, at 14:30, Sibylle Mohr wrote: > >> Dear Fieldtrippers, >> >> I have a problem concerning multiplotTFR, which I did not have a >> couple of months ago: >> I import 4 conditions (lexical match/lexical mismatch and >> stereotypical match / >> stereotypical mismatch). After doing a multitaper analysis for >> different frequencies I do a >> baseline correction using 'zscore' across the averaged trials for >> each condition. When I >> plot the resulting zscore corrected conditions using multiploTFR >> contrasting 'lexical >> mismatch' with 'lexical match' and afterwards 'stereotypical >> mismatch' with 'stereotypical >> match', it looks like the stereotypical conditions are almost the >> inverse plot of my lexical >> conditions. I always clear the cfg before I start a new plot. I >> also use cfg.interactive = >> 'yes'. Any ideas why this is happening..? >> >> I'll attach the scripts for the multitaper analysis, the baseline >> correction, and for the >> plotting. >> >> Thanks, >> >> Sibylle >> >> ----------------------- >> MULTITAPER ANALYSIS >> >> function hifreq_ana >> >> % anaphora files: high frequencies >> >> % BESA datafiles in one condition >> filename_ana{1} = { >> 'An1_sb1_lexmatch-export.dat' >> 'An1_sb9_lexmatch-export.dat' >> 'An1_sb13_lexmatch-export.dat' >> 'An1_sb17_lexmatch-export.dat' >> 'An1_sb21_lexmatch-export.dat' >> 'An2_sb2_lexmatch-export.dat' >> 'An2_sb6_lexmatch-export.dat' >> 'An2_sb10_lexmatch-export.dat' >> 'An2_sb18_lexmatch-export.dat' >> 'An2_sb22_lexmatch-export.dat' >> 'An3_sb3_lexmatch-export.dat' >> 'An3_sb7_lexmatch-export.dat' >> 'An3_sb11_lexmatch-export.dat' >> 'An3_sb15_lexmatch-export.dat' >> 'An3_sb23_lexmatch-export.dat' >> 'An4_sb4_lexmatch-export.dat' >> 'An4_sb8_lexmatch-export.dat' >> 'An4_sb12_lexmatch-export.dat' >> 'An4_sb16_lexmatch-export.dat' >> 'An4_sb24_lexmatch-export.dat' >> }; >> >> >> % BESA datafiles in the other condition >> filename_ana{2} = { >> 'An1_sb1_lexmis-export.dat' >> 'An1_sb9_lexmis-export.dat' >> 'An1_sb13_lexmis-export.dat' >> 'An1_sb17_lexmis-export.dat' >> 'An1_sb21_lexmis-export.dat' >> 'An2_sb2_lexmis-export.dat' >> 'An2_sb6_lexmis-export.dat' >> 'An2_sb10_lexmis-export.dat' >> 'An2_sb18_lexmis-export.dat' >> 'An2_sb22_lexmis-export.dat' >> 'An3_sb3_lexmis-export.dat' >> 'An3_sb7_lexmis-export.dat' >> 'An3_sb11_lexmis-export.dat' >> 'An3_sb15_lexmis-export.dat' >> 'An3_sb23_lexmis-export.dat' >> 'An4_sb4_lexmis-export.dat' >> 'An4_sb8_lexmis-export.dat' >> 'An4_sb12_lexmis-export.dat' >> 'An4_sb16_lexmis-export.dat' >> 'An4_sb24_lexmis-export.dat' >> }; >> >> filename_ana{3} = { >> 'An1_sb1_stermatch-export.dat' >> 'An1_sb9_stermatch-export.dat' >> 'An1_sb13_stermatch-export.dat' >> 'An1_sb17_stermatch-export.dat' >> 'An1_sb21_stermatch-export.dat' >> 'An2_sb2_stermatch-export.dat' >> 'An2_sb6_stermatch-export.dat' >> 'An2_sb10_stermatch-export.dat' >> 'An2_sb18_stermatch-export.dat' >> 'An2_sb22_stermatch-export.dat' >> 'An3_sb3_stermatch-export.dat' >> 'An3_sb7_stermatch-export.dat' >> 'An3_sb11_stermatch-export.dat' >> 'An3_sb15_stermatch-export.dat' >> 'An3_sb23_stermatch-export.dat' >> 'An4_sb4_stermatch-export.dat' >> 'An4_sb8_stermatch-export.dat' >> 'An4_sb12_stermatch-export.dat' >> 'An4_sb16_stermatch-export.dat' >> 'An4_sb24_stermatch-export.dat' >> }; >> >> >> % BESA datafiles in the other condition >> filename_ana{4} = { >> 'An1_sb1_stermis-export.dat' >> 'An1_sb9_stermis-export.dat' >> 'An1_sb13_stermis-export.dat' >> 'An1_sb17_stermis-export.dat' >> 'An1_sb21_stermis-export.dat' >> 'An2_sb2_stermis-export.dat' >> 'An2_sb6_stermis-export.dat' >> 'An2_sb10_stermis-export.dat' >> 'An2_sb18_stermis-export.dat' >> 'An2_sb22_stermis-export.dat' >> 'An3_sb3_stermis-export.dat' >> 'An3_sb7_stermis-export.dat' >> 'An3_sb11_stermis-export.dat' >> 'An3_sb15_stermis-export.dat' >> 'An3_sb23_stermis-export.dat' >> 'An4_sb4_stermis-export.dat' >> 'An4_sb8_stermis-export.dat' >> 'An4_sb12_stermis-export.dat' >> 'An4_sb16_stermis-export.dat' >> 'An4_sb24_stermis-export.dat' >> }; >> >> ncond = length(filename_ana); >> nsubj = length(filename_ana{1}); >> >> >> tmp = importdata('New_elect72.elp'); >> >> for j = 1:ncond >> clear data >> >> for i=1:nsubj >> data = besa2fieldtrip(filename_ana{j}{i}); >> % % import electrode file and create electrode arrays >> % % with coordinates in elp file >> % % match channel and electrode names >> data.label = tmp.textdata(:,2); >> >> clear cfg; >> cfg.foi = [30:4:130]; >> numfoi = length(cfg.foi); >> cfg.t_ftimwin = zeros(1,numfoi); >> cfg.t_ftimwin(:) = 0.25; >> cfg.method = 'mtmconvol'; >> cfg.output = 'pow'; >> cfg.toi = [-0.5:0.02:1.5]; >> cfg.taper = 'dpss'; >> cfg.tapsmofrq = zeros(1,numfoi); >> cfg.tapsmofrq(:) = 16; >> cfg.keeptrials = 'yes'; >> >> freqhi = freqanalysis(cfg,data); >> % change from double to single precision to save space on the >> harddisk >> single = struct2single(freqhi); >> save(sprintf('/analyse/12/Project0042/Gender_new/dat- >> files_multitaper/anaphora/hi_freq_%d_%d.mat',j,i),'single'); >> clear single >> >> end; % subject loop >> end; % condition loop >> exit; >> --------------------------------------- >> >> BASELINE CORRECTION SCRIPT >> >> function allfreq_zscores >> >> name = {'lex','lexmis','ster','stermis'}; >> ldir = '/analyse/12/Project0042/Gender_new/dat-files_multitaper/'; >> path = {'anaphora/','cataphora/'}; >> >> frq = {'lo','med'}; >> pathname = {'ana','cat'}; >> %pathname = {'cat'}; >> %................. LO AND MEDIUM FREQUENCY ANALYSIS >> >> for p = 1:length(path) >> for f = 1:length(frq) >> for i = 1:length(name) >> load(sprintf('%s%s%s_%s.mat',ldir,path{p},frq{f},name{i})); >> for j = 1:20 >> if f == 1 >> if i == 1 >> freq = freqlo_lexmatch{j}; >> elseif i == 2 >> freq = freqlo_lexmis{j}; >> elseif i == 3 >> freq = freqlo_stermatch{j}; >> elseif i == 4 >> freq = freqlo_stermis{j}; >> end; >> elseif f == 2 >> if i == 1 >> freq = freqmed_lexmatch{j}; >> elseif i == 2 >> freq = freqmed_lexmis{j}; >> elseif i == 3 >> freq = freqmed_stermatch{j}; >> elseif i == 4 >> freq = freqmed_stermis{j}; >> end; >> end; >> >> double = struct2double(freq); >> clear freq; >> >> %... check if there is the trial-dimension or not >> if length(size(double.powspctrm)) == 4 >> double = freqdescriptives([],double); >> end; >> >> cfg = []; >> cfg.baseline = [-0.5 0]; >> cfg.baselinetype = 'zscore'; >> freq = freqbaseline(cfg,double); >> clear double >> >> freqdes{j} = struct2single(freq); >> clear freq >> end; % subject loop >> save(sprintf('%s%s_%s_z_ >> %s.mat',ldir,pathname{p},frq{f},name{i}),'freqdes'); >> clear freqdes >> end; % condition loop >> end; % frequency loop >> end; % path loop >> >> %.................. HI FREQUENCY ANALYSIS >> >> disp('SWITCHING TO HIGH FREQUENCIES') >> >> for p = 1:length(path); %two different paths >> for i = 1:length(name); %four different conditions >> for j = 1:20 %(length of subjects) >> tmp=load(sprintf('%s%shi_freq_%d_%d.mat',ldir,path{p},i,j)); >> >> % convert to double before starting calculations >> double = struct2double(tmp.single); >> clear freq >> >> % average across trials using freqdescriptives >> double = freqdescriptives([],double); >> >> % do baseline normalization across the AVERAGED trials (for >> normalization >> % over SINGLE trials, switch around freqdescriptives and >> freqbaseline) >> clear cfg; >> cfg.baseline = [-0.5 0]; >> cfg.baselinetype = 'zscore'; >> fqhi = freqbaseline(cfg,double); >> clear double >> >> freqdes{j} = struct2single(fqhi); >> clear fqhi >> end; % subject loop/ j-loop >> %save freqdescriptives of 20 subjets (single precision) into one >> cell-array, and save that >> %per condition. >> save(sprintf('%s%s_hi_z_%s.mat',ldir,pathname{p},name{i}),'freqdes'); >> clear freqdes >> end; % condition loop / i-loop >> end; % path loop >> exit; >> >> -------------------------------------- >> >> PLOTTING SCRIPT >> >> %.................HI FREQUENCY ANALYSIS PLOTS >> >> clear all; >> load(sprintf('cat_hi_z_lex.mat')); >> hi_lmatch=freqdes; >> clear freqdes >> >> load(sprintf('cat_hi_z_lexmis.mat')); >> hi_lmis=freqdes; >> clear freqdes >> >> load(sprintf('cat_hi_z_ster.mat')); >> hi_smatch=freqdes; >> clear freqdes >> >> load(sprintf('cat_hi_z_stermis.mat')); >> hi_smis=freqdes; >> clear freqdes >> >> >> clear grandhi1_lexmatch grandhi1_lmis grandhi1_smatch grandhi1_smis; >> cfg = []; >> grandhi1_lmatch = freqgrandaverage(cfg, hi_lmatch{:}); >> grandhi1_lmis = freqgrandaverage(cfg, hi_lmis{:}); >> grandhi1_smatch = freqgrandaverage(cfg, hi_smatch{:}); >> grandhi1_smis = freqgrandaverage(cfg, hi_smis{:}); >> >> clear avgdif_a; >> clear avgdif_b; >> avgdif_a = grandhi1_lmis; >> avgdif_a.powspctrm = ((grandhi1_lmis.powspctrm - >> grandhi1_lmatch.powspctrm)./grandhi1_lmatch.powspctrm).*100; >> >> avgdif_b = grandhi1_smis; >> avgdif_b.powspctrm = ((grandhi1_smis.powspctrm - >> grandhi1_smatch.powspctrm)./grandhi1_smatch.powspctrm).*100; >> >> clear cfg; >> load('elec.mat'); >> % scale the electrodes to a realistic head size (in cm) >> elec.pnt = 10*elec.pnt; >> clear cfg; >> cfg= []; >> cfg.elec = elec; >> cfg.colorbar = 'yes'; >> cfg.xparam = 'time'; >> cfg.yparam = 'freq'; >> cfg.zparam = 'powspctrm'; >> cfg.showlabels = 'yes'; >> cfg.layout = 'sibylle.lay'; >> cfg.interactive = 'yes'; >> cfg.title = 'lexical_conditions'; >> cfg.xlim = ([-0.5 1.5]); >> cfg.ylim = [30 130]; >> %cfg.zlim = [-50 50]; >> figure; multiplotTFR(cfg, avgdif_a); >> title('FreqHi Cata: lexical match vs. mismatch'); >> >> clear cfg; >> cfg= []; >> cfg.elec = elec; >> cfg.colorbar = 'yes'; >> cfg.xparam = 'time'; >> cfg.yparam = 'freq'; >> cfg.zparam = 'powspctrm'; >> cfg.showlabels = 'yes'; >> cfg.layout = 'sibylle.lay'; >> cfg.interactive = 'yes'; >> cfg.title = 'lexical_conditions'; >> cfg.xlim = ([-0.5 1.5]); >> cfg.ylim = [30 130]; >> %cfg.zlim = [-50 50]; >> figure; multiplotTFR(cfg, avgdif_b); >> title('FreqHi Cata: stereotypicalmatch vs. mismatch'); >> -------------------------------- >> >> ---------------------------------- >> The aim of this list is to facilitate the discussion between users >> of the FieldTrip toolbox, to share experiences and to discuss new >> ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html >> and http://www.ru.nl/neuroimaging/fieldtrip. >> > > ---------------------------------- > The aim of this list is to facilitate the discussion between users > of the FieldTrip toolbox, to share experiences and to discuss new > ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html > and http://www.ru.nl/neuroimaging/fieldtrip. ---------------------------------- The aim of this list is to facilitate the discussion between users of the FieldTrip toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/neuroimaging/fieldtrip. From a.stolk at FCDONDERS.RU.NL Tue Nov 10 17:39:49 2009 From: a.stolk at FCDONDERS.RU.NL (a.stolk@fcdonders.ru.nl) Date: Tue, 10 Nov 2009 17:39:49 +0100 Subject: data.label wrong after componentanalysis? In-Reply-To: <21188527.945751257871085522.JavaMail.root@watertor.uci.ru.nl> Message-ID: Hi Nathan, I managed to simulate your problem. The intersect function does indeed find matching labels (desired) and then orders those alphabetically (undesired). The most practical solution is to use 'match_str' which only matches the channelindices and, thus, does not give back your labelarray in alphabetical order. For example; [ai, bi] = match_str(a, b) with a = [1 2 3 4] (here in numbers, but should be strings) and b = [3 2] gives ai = [2 3] and bi = [2 1] I therefore replaced cfg.channel = intersect(cfg.channel, cfg.topolabel); with tmpchan = match_str(cfg.channel, cfg.topolabel); cfg.channel = cfg.channel(tmpchan); and everything worked fine here: data.cfg.channel = tmpcomp.cfg.channel. You'll find this replacement in tomorrow's version of FT. Thanks for your clear explanation and please let me know if these changes appear to be problematic to your analysis. Friendly regards, Arjen ----- Original Message ----- From: "Nathan Weisz" To: FIELDTRIP at NIC.SURFNET.NL Sent: Monday, October 26, 2009 9:17:31 PM GMT +01:00 Amsterdam / Berlin / Bern / Rome / Stockholm / Vienna Subject: [FIELDTRIP] data.label wrong after componentanalysis? hi everyone, for an analysis of EEG data i'm doing some ICA cleaning. since there are many conditions / epochs, i do the ICA on a subset of trials and then apply the calculated mixing matrix to the individual conditions. i noticed (and i'm quite sure it's no user related error) that after rejecting components and reconstructing the preprocessing data structure, that the sequence in data.label has changed (apparently into alphabetical order). however that rows in the 2-D matrices making up data.trial(xy) have not changed, accordingly. i noticed because the topography of the auditory N1 was a huge mess. changing the labels solved the problem, i.e.: ica_cleaned_data.label = data_before_ica_cleaning.label; for those interested here the original code: load([outdir '/dataB1F1.mat'], 'dataB1F1') %load data for one condition cfg=[]; cfg.topo=comp.topo; cfg.topolabel=comp.topolabel; tmpcomp=componentanalysis(cfg,dataB1F1); %apply precomputed ICA to condition cfg=[]; cfg.component=ncmp; dataB1F1=rejectcomponent(cfg, tmpcomp); %reject components obviously representing artefacts >> [comp.cfg.channel(1:5) tmpcomp.cfg.channel(1:5)] %demonstrate channel label mismatch ans = 'Lm' 'L1' 'LE1' 'L10' 'LE2' 'L11' 'LE3' 'L12' 'LD2' 'L13' the crucial line appears to be in componentanalysis line 220: cfg.channel = intersect(cfg.channel, cfg.topolabel); intersect sorts the outcome: >> a=randperm(10) a = 7 1 9 3 6 2 5 4 10 8 >> b=randperm(10) b = 6 3 5 1 8 2 10 4 9 7 >> intersect(a,b) ans = 1 2 3 4 5 6 7 8 9 10 since i use all channels, simply replacing the label-field with the original label-field works for me. best, nathan ---------------------------------- The aim of this list is to facilitate the discussion between users of the FieldTrip toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/neuroimaging/fieldtrip. ---------------------------------- The aim of this list is to facilitate the discussion between users of the FieldTrip toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/neuroimaging/fieldtrip. From joseph.brooks at UCL.AC.UK Fri Nov 13 22:21:57 2009 From: joseph.brooks at UCL.AC.UK (Joseph Brooks) Date: Fri, 13 Nov 2009 21:21:57 +0000 Subject: BDF file problems Message-ID: I'm new to Fieldtrip. I am working with Biosemi data (BDF file format). I've come across a problem when defining trials. I've come up with a work-around but I'm interested in whether others have encountered this problem and I want to alert the fieldtrip developers of this potential problem. I've tried it on several BDF files. Here is an example of my input and the error... cfgSSVEP = []; cfgSSVEP.dataset = [pathname,filename]; cfgSSVEP.trialdef.eventtype = 'STATUS'; cfgSSVEP.trialdef.eventvalue = {'21' '22'}; cfgSSVEP.trialdef.prestim = 1; cfgSSVEP.trialdef.poststim = 16; cfgSSVEP.dataset = [pathname,filename]; cfgSSVEP = definetrial(cfgSSVEP); cfgSSVEP.padding = 0; cfgSSVEP.continuous = 'yes'; evaluating trialfunction 'trialfun_general' Warning: Out of range value or NaN computed in integer arithmetic. > In read_event at 281 In trialfun_general at 50 In definetrial at 139 ??? Error using ==> cellstr at 34 Input must be a string. Error in ==> cell.intersect at 44 a = cellstr(a); Error in ==> trialfun_general at 104 elseif ~isempty(intersect(event(i).value, cfg.trialdef.eventvalue)) Error in ==> definetrial at 139 [trl, event] = feval(cfg.trialfun, cfg); ************* I've managed to "fix" the problem by changing line 104 in trialfun_general to: elseif ~isempty(intersect(num2str(event(i).value), cfg.trialdef.eventvalue)) Any feedback will be much appreciated... ---------------------------------- The aim of this list is to facilitate the discussion between users of the FieldTrip toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/neuroimaging/fieldtrip. From nelsonmj at CALTECH.EDU Mon Nov 16 22:46:12 2009 From: nelsonmj at CALTECH.EDU (Matthew Nelson) Date: Mon, 16 Nov 2009 22:46:12 +0100 Subject: Question about nonparametric statistical testing of coherence differences Message-ID: My question involves a situation in which one is comparing the coherence between two signals in two different conditions, and the coherence is generally high in both conditions, but we would like to say that the coherence is higher in one condition than the other. After some thought about this issue, I wonder if shuffling trials between the two conditions allows for a fair comparison to be made to the coherence in the raw data? For example, if a pair of signals has different relative phases in the two conditions, the overall coherence that exists in both conditions will be decreased by the trial shuffling. It’s also conceivable, though perhaps less likely, that the condition-shuffled data could have more coherence than either condition alone. In either case, the distribution of the cluster statistics of the coherence differences in the condition-shuffled data would certainly provide some sort of estimate of a null distribution of the coherence difference that does uses the actual data, but since the overall coherence values of the condition-shuffled and raw data could be so different, is it fair to say that this is a null distribution of the difference in coherence between the unshuffled conditions? If you have the time to respond, I’m curious to know what your thoughts are regarding this issue and specifically in a situation in which it is necessary to assess significance on one session. Performing the clustering and shuffling of coherence values across sessions obviously avoids this problem. For a test within a session, I wonder if it would be possible to use a bootstrapping or jackknife method combined with clustering to get a fair estimate of the variability of the cluster level statistics and perform hypothesis tests using that. ---------------------------------- The aim of this list is to facilitate the discussion between users of the FieldTrip toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/neuroimaging/fieldtrip. From adrian.m.bartlett at GMAIL.COM Mon Nov 16 23:44:53 2009 From: adrian.m.bartlett at GMAIL.COM (Adrian Bartlett) Date: Mon, 16 Nov 2009 17:44:53 -0500 Subject: Question about nonparametric statistical testing of coherence differences In-Reply-To: Message-ID: Hi Matthew, While It'll take me a bit to think about the single-condition case, you've definitely got the right idea for the condition contrast. The condition-shuffled surrogate data is in fact the null distribution for the H0: condition 1 = condition 2. Someone please correct me if I'm mistaken. Adrian M. Bartlett Perception & Plasticity Laboratory (http://www.yorku.ca/khoffman) Graduate Program in Psychology Neuroscience Graduate Diploma Program Centre for Vision Research York University Toronto, Ontario, Canada (416)736-2100x20997 adrianmb at yorku.ca On Mon, Nov 16, 2009 at 4:46 PM, Matthew Nelson wrote: > My question involves a situation in which one is comparing the coherence > between two signals in two different conditions, and the coherence is > generally high in both conditions, but we would like to say that the > coherence is higher in one condition than the other. After some > thought about this issue, I wonder if shuffling trials between the two > conditions allows for a fair comparison to be made to the coherence in > the raw data? For example, if a pair of signals has different relative > phases in the two conditions, the overall coherence that exists in > both conditions will be decreased by the trial shuffling. It’s also > conceivable, though perhaps less likely, that the condition-shuffled > data could have more coherence than either condition alone. In either > case, the distribution of the cluster statistics of the coherence > differences in the condition-shuffled data would certainly provide > some sort of estimate of a null distribution of the coherence > difference that does uses the actual data, but since the overall > coherence values of the condition-shuffled and raw data could be so > different, is it fair to say that this is a null distribution of the > difference in coherence between the unshuffled conditions? > > > If you have the time to respond, I’m curious to know what your > thoughts are regarding this issue and specifically in a situation in > which it is necessary to assess significance on one session. > Performing the clustering and shuffling of coherence values across > sessions obviously avoids this problem. For a test within a session, I > wonder if it would be possible to use a bootstrapping or jackknife > method combined with clustering to get a fair estimate of the > variability of the cluster level statistics and perform hypothesis > tests using that. > > ---------------------------------- > The aim of this list is to facilitate the discussion between users of the > FieldTrip toolbox, to share experiences and to discuss new ideas for MEG > and EEG analysis. See also > http://listserv.surfnet.nl/archives/fieldtrip.html and > http://www.ru.nl/neuroimaging/fieldtrip. > ---------------------------------- The aim of this list is to facilitate the discussion between users of the FieldTrip toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/neuroimaging/fieldtrip. -------------- next part -------------- An HTML attachment was scrubbed... URL: From e.maris at DONDERS.RU.NL Tue Nov 17 10:36:03 2009 From: e.maris at DONDERS.RU.NL (Eric Maris) Date: Tue, 17 Nov 2009 10:36:03 +0100 Subject: Question about nonparametric statistical testing of coherence differences In-Reply-To: Message-ID: Dear Matthew, Your questions relate to the core concepts behind statistical inference based on permutation. > My question involves a situation in which one is comparing the coherence > between two signals in two different conditions, and the coherence is > generally high in both conditions, but we would like to say that the > coherence is higher in one condition than the other. After some > thought about this issue, I wonder if shuffling trials between the two > conditions allows for a fair comparison to be made to the coherence in > the raw data? For example, if a pair of signals has different relative > phases in the two conditions, the overall coherence that exists in > both conditions will be decreased by the trial shuffling. It's also > conceivable, though perhaps less likely, that the condition-shuffled > data could have more coherence than either condition alone. In either > case, the distribution of the cluster statistics of the coherence > differences in the condition-shuffled data would certainly provide > some sort of estimate of a null distribution of the coherence > difference that does uses the actual data, but since the overall > coherence values of the condition-shuffled and raw data could be so > different, is it fair to say that this is a null distribution of the > difference in coherence between the unshuffled conditions? It is important to always keep in mind which null hypothesis is tested using permutation inference. This null hypothesis is exchangeability. For the case that you describe, exchangeability involves that the probability distributions of bivariate time series (or, equivalently, their Fourier coefficients) in the two experimental conditions are identical. You describe a situation in which this null hypothesis does not hold, and the reason for this is not a single but two parameters: coherence and relative phase. Both parameters differ across the two conditions that you describe. Now, if you want to test whether coherence differs across the two conditions and you don't want your inference to be affected by a difference in relative phase, then you have to come up with a test statistic that has the appropriate sensitivity. Such a test statistic might be the following: calculate the coherence difference between the two conditions using Fourier coefficients of which the phases were adjusted such that relative phase in the two conditions are both equal to zero. (This is a simple operation, involving a condition-specific phase shift applied to all Fourier coefficients of one of the two channels.) This example shows both the strength and the weakness of permutation inference. The strength is that you can construct your own test statistic such that it is sensitive to the physiological phenomenon in which you are interested. And the weakness is that the null hypothesis (exchangeability) is much more general than this specific physiological phenomenon. This means that a small permutation p-value allows you to infer that the two conditions most likely differ, but that inferring the precise cause of this difference depends on how clever you have been in designing a test statistic with the desired specificity. By the way, I did not understand the following sentence in your email: "It's also conceivable, though perhaps less likely, that the condition-shuffled data could have more coherence than either condition alone." For the situation that you describe, the coherence difference between the conditions (which is the relevant quantity for the phenomen in which you are interested) will on average be less for the permuted data than for the original data. > > If you have the time to respond, I'm curious to know what your > thoughts are regarding this issue and specifically in a situation in > which it is necessary to assess significance on one session. > Performing the clustering and shuffling of coherence values across > sessions obviously avoids this problem. For a test within a session, I > wonder if it would be possible to use a bootstrapping or jackknife > method combined with clustering to get a fair estimate of the > variability of the cluster level statistics and perform hypothesis > tests using that. Here the answer is simple. Permutation inference can only be used for comparing experimental conditions. However, I want to argue that, for investigating coherence, comparing experimental conditions is the only sensible thing one can do. The reason is that, for simple biophysical reasons, the null hypothesis of zero coherence within a single condition, will never be true, at least not in electrophysiological studies. This is because the potentials that are recorded in the two channels will always be affected by the physiological activity of common sources, simply because all potentials are volume conducted. Best, Eric dr. Eric Maris Donders Institute for Brain, Cognition and Behavior Center for Cognition and F.C. Donders Center for Cognitive Neuroimaging Radboud University P.O. Box 9104 6500 HE Nijmegen The Netherlands T:+31 24 3612651 Mobile: 06 39584581 F:+31 24 3616066 E: e.maris at donders.ru.nl MSc Cognitive Neuroscience: www.ru.nl/master/cns/ ---------------------------------- The aim of this list is to facilitate the discussion between users of the FieldTrip toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/neuroimaging/fieldtrip. From nelsonmj at CALTECH.EDU Tue Nov 17 13:33:46 2009 From: nelsonmj at CALTECH.EDU (Matthew Nelson) Date: Tue, 17 Nov 2009 13:33:46 +0100 Subject: Question about nonparametric statistical testing of coherence differences Message-ID: Thanks very much for your response Eric, I found it to be very helpful. On Tue, Nov 17, 2009 at 10:36 AM, Eric Maris wrote: > > It is important to always keep in mind which null hypothesis is tested using > permutation inference. This null hypothesis is exchangeability. For the case > that you describe, exchangeability involves that the probability > distributions of bivariate time series (or, equivalently, their Fourier > coefficients) in the two experimental conditions are identical. You describe > a situation in which this null hypothesis does not hold, and the reason for > this is not a single but two parameters: coherence and relative phase. Both > parameters differ across the two conditions that you describe. Now, if you > want to test whether coherence differs across the two conditions and you > don't want your inference to be affected by a difference in relative phase, > then you have to come up with a test statistic that has the appropriate > sensitivity. Such a test statistic might be the following: calculate the > coherence difference between the two conditions using Fourier coefficients > of which the phases were adjusted such that relative phase in the two > conditions are both equal to zero. (This is a simple operation, involving a > condition-specific phase shift applied to all Fourier coefficients of one of > the two channels.) It seems to me that this indeed is the test that I would be interested in for this situation. To reiterate the suggestion just to be clear that I understand it completely (and please let me know if I am misunderstanding it), this suggestion would be to adjust the phase of one signal in one condition so that the average relative phase between the two signals is the same for the two conditions, not to eliminate the phase information on each and every Fourier component. Thanks again for sharing your thoughts on that. > > By the way, I did not understand the following sentence in your email: "It's > also > conceivable, though perhaps less likely, that the condition-shuffled > data could have more coherence than either condition alone." For the > situation that you describe, the coherence difference between the conditions > (which is the relevant quantity for the phenomen in which you are > interested) will on average be less for the permuted data than for the > original data. Sorry for the confusion. For the situation that I specifically described in my first message, indeed the overall coherence in the permuted data would be less. What I was referring to in that sentence though was that in other situations, which I did not describe, it could be possible to have an increase in overall coherence in the shuffled data. For an example of such a situation, it seems to me that this could occur if the relative phases of the two signals are the same in both conditions but the overall spectral power differed between the two conditions for both signals such both signals had more power in condition one than in condition two. I haven’t tested this with simulations, but it seems that in the case the coherence could be higher in the trial shuffled case because of the induced correlation in spectral power between the signals resulting from mixing the two conditions. So following the line of thought from your suggestion above, in such a situation in order to prevent the magnitude differences from affecting the inference regarding the coherence difference between the two conditions, would you say that it would be appropriate to also adjust the overall magnitude of the pair of Fourier components in one condition to match the overall magnitude of the components in the other conditions when doing the permutation? > >> sessions obviously avoids this problem. For a test within a session, I >> wonder if it would be possible to use a bootstrapping or jackknife >> method combined with clustering to get a fair estimate of the >> variability of the cluster level statistics and perform hypothesis >> tests using that. > > Here the answer is simple. Permutation inference can only be used for > comparing experimental conditions. However, I want to argue that, for > investigating coherence, comparing experimental conditions is the only > sensible thing one can do. The reason is that, for simple biophysical > reasons, the null hypothesis of zero coherence within a single condition, > will never be true, at least not in electrophysiological studies. This is > because the potentials that are recorded in the two channels will always be > affected by the physiological activity of common sources, simply because all > potentials are volume conducted. > I agree completely. Just to clarify, I was suggesting using bootstrapping or jackknifing to estimate the variance of the coherence of each measure independently, and then use that to test the null hypothesis of no coherence difference between the two conditions rather than the null hypothesis of zero coherence. ---------------------------------- The aim of this list is to facilitate the discussion between users of the FieldTrip toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/neuroimaging/fieldtrip. From akiko at NYU.EDU Tue Nov 17 19:14:23 2009 From: akiko at NYU.EDU (Akiko Ikkai) Date: Tue, 17 Nov 2009 13:14:23 -0500 Subject: MEG rejectvisual summary Message-ID: Hi, I'm working on MEG data, and I have a very basic question on rejectvisual, with cfg.method = 'summary'; I understand that on channel number and trial number graphs, x- and y- axis (respectively) are variance across trials and channels. My question is what the acceptable range of these values are. SQUID jumps would be very obvious, but how about slow drifts (due to movement)? I suspect this depends on data, but if anyone could suggest some starting point (maybe based on experience?), I'd very appreciate it. Thanks! Akiko ---------------------------------- The aim of this list is to facilitate the discussion between users of the FieldTrip toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/neuroimaging/fieldtrip. From e.maris at DONDERS.RU.NL Tue Nov 17 21:04:00 2009 From: e.maris at DONDERS.RU.NL (Eric Maris) Date: Tue, 17 Nov 2009 21:04:00 +0100 Subject: Question about nonparametric statistical testing of coherence differences In-Reply-To: Message-ID: Dear Matthew, > > It is important to always keep in mind which null hypothesis is tested using > > permutation inference. This null hypothesis is exchangeability. For the case > > that you describe, exchangeability involves that the probability > > distributions of bivariate time series (or, equivalently, their Fourier > > coefficients) in the two experimental conditions are identical. You describe > > a situation in which this null hypothesis does not hold, and the reason for > > this is not a single but two parameters: coherence and relative phase. Both > > parameters differ across the two conditions that you describe. Now, if you > > want to test whether coherence differs across the two conditions and you > > don't want your inference to be affected by a difference in relative phase, > > then you have to come up with a test statistic that has the appropriate > > sensitivity. Such a test statistic might be the following: calculate the > > coherence difference between the two conditions using Fourier coefficients > > of which the phases were adjusted such that relative phase in the two > > conditions are both equal to zero. (This is a simple operation, involving a > > condition-specific phase shift applied to all Fourier coefficients of one of > > the two channels.) > > It seems to me that this indeed is the test that I would be interested in > for this situation. To reiterate the suggestion just to be clear that I > understand it completely (and please let me know if I am misunderstanding > it), this suggestion would be to adjust the phase of one signal in one > condition so that the average relative phase between the two signals is the > same for the two conditions, not to eliminate the phase information on each > and every Fourier component. Thanks again for sharing your thoughts on that. This is correct. Don't forget to apply this phase shift for every permutation, such that it becomes part of your test statistic. > > > > > By the way, I did not understand the following sentence in your email: "It's > > also > > conceivable, though perhaps less likely, that the condition-shuffled > > data could have more coherence than either condition alone." For the > > situation that you describe, the coherence difference between the conditions > > (which is the relevant quantity for the phenomen in which you are > > interested) will on average be less for the permuted data than for the > > original data. > > Sorry for the confusion. For the situation that I specifically described in > my first message, indeed the overall coherence in the permuted data would be > less. What I was referring to in that sentence though was that in other > situations, which I did not describe, it could be possible to have an > increase in overall coherence in the shuffled data. For an example of such a > situation, it seems to me that this could occur if the relative phases of > the two signals are the same in both conditions but the overall spectral > power differed between the two conditions for both signals such both signals > had more power in condition one than in condition two. I haven't tested this > with simulations, but it seems that in the case the coherence could be > higher in the trial shuffled case because of the induced correlation in > spectral power between the signals resulting from mixing the two conditions. In case you decide to run such a simulation, you may also include the phase-locking factor (Lachaux et al, 1999) in your calculation. The PLF does not depend on amplitude correlation over trials. > > So following the line of thought from your suggestion above, in such a > situation in order to prevent the magnitude differences from affecting the > inference regarding the coherence difference between the two conditions, > would you say that it would be appropriate to also adjust the overall > magnitude of the pair of Fourier components in one condition to match the > overall magnitude of the components in the other conditions when doing the > permutation? This may help. You can include this test statistic in your simulation, together with the PLF. > > > > >> sessions obviously avoids this problem. For a test within a session, I > >> wonder if it would be possible to use a bootstrapping or jackknife > >> method combined with clustering to get a fair estimate of the > >> variability of the cluster level statistics and perform hypothesis > >> tests using that. > > > > Here the answer is simple. Permutation inference can only be used for > > comparing experimental conditions. However, I want to argue that, for > > investigating coherence, comparing experimental conditions is the only > > sensible thing one can do. The reason is that, for simple biophysical > > reasons, the null hypothesis of zero coherence within a single condition, > > will never be true, at least not in electrophysiological studies. This is > > because the potentials that are recorded in the two channels will always be > > affected by the physiological activity of common sources, simply because all > > potentials are volume conducted. > > > > I agree completely. Just to clarify, I was suggesting using bootstrapping or > jackknifing to estimate the variance of the coherence of each measure > independently, and then use that to test the null hypothesis of no coherence > difference between the two conditions rather than the null hypothesis of > zero coherence. I would not advise this. The permutation test is to be preferred over bootstrap- and jacknife-based statistical test, because we can prove that the permutation test controls the false alarm rate. We cannot prove this for bootstrap- and jacknife-based tests. Best, Eric > > ---------------------------------- > The aim of this list is to facilitate the discussion between users of the FieldTrip > toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. > See also http://listserv.surfnet.nl/archives/fieldtrip.html and > http://www.ru.nl/neuroimaging/fieldtrip. ---------------------------------- The aim of this list is to facilitate the discussion between users of the FieldTrip toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/neuroimaging/fieldtrip. From nelsonmj at CALTECH.EDU Tue Nov 17 22:35:59 2009 From: nelsonmj at CALTECH.EDU (Matthew Nelson) Date: Tue, 17 Nov 2009 22:35:59 +0100 Subject: Question about nonparametric statistical testing of coherence differences Message-ID: Thanks again for your helpful response. ---------------------------------- The aim of this list is to facilitate the discussion between users of the FieldTrip toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/neuroimaging/fieldtrip. From Hanneke.vanDijk at MED.UNI-DUESSELDORF.DE Wed Nov 18 13:38:58 2009 From: Hanneke.vanDijk at MED.UNI-DUESSELDORF.DE (Hanneke Van Dijk) Date: Wed, 18 Nov 2009 13:38:58 +0100 Subject: using coil/isotrack information for sourceanalysis (neuromag data) Message-ID: Dear all, In my group we have a question regarding the use of the coil locations and/ or isotrack data to do source analysis. We are doing data analysis using FT and the MNE toolbox, on a dataset recorded with a Neuromag122 system. The four coils were placed in different locations then in the CTF system, which uses the anatomical landmarks (left ear, right ear and nasion). Here we placed the coils on the scalp; two approximately above the eyes and two behind the ears. We digitized the locations of the coils using the polhemus, togheter with the anatomical landmarks and some more points. We would very much like to know HOW and WHERE fieldtrip uses the coil-location information and if it is possible to use the polhemus data as well, to place the head at the correct location within the helmet and to do sourceanalysis. I noticed allready that when reading the fiff file with 'fiff_read_meas_info' (MNE) there is a field called .dig which seems to contain the coordinates of digitized locations. I have no idea though how to integrate this information into the data so fieldtrip can use it. Thanks in advance for any information, Hanneke van Dijk Institute for Clinical Neuroscience and Medical Psychology, Heinrich Heine Universitaet, Duesseldorf. ---------------------------------- The aim of this list is to facilitate the discussion between users of the FieldTrip toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/neuroimaging/fieldtrip. -------------- next part -------------- An HTML attachment was scrubbed... URL: From lhunt at FMRIB.OX.AC.UK Wed Nov 18 14:40:14 2009 From: lhunt at FMRIB.OX.AC.UK (Laurence Hunt) Date: Wed, 18 Nov 2009 13:40:14 +0000 Subject: using coil/isotrack information for sourceanalysis (neuromag data) In-Reply-To: <72E993C35FB11743B79FF9286E5B6D8B0F351C@Mail2-UKD.VMED.UKD> Message-ID: Dear Hanneke, The information stored in dig can indeed be read into fieldtrip; this is done by read_headshape, which reads in all the points and classifies them as fiducial (i.e. nasion/LPA/RPA), stored in shape.fid, or other, stored in shape.pnt. shape.pnt would therefore include your HPI coils and additional digitised points (and any digitised EEG sensor locations if you collected EEG also). As you're probably aware, there are two registrations that need to take place - the first is the registration of coil locations to sensor locations, and the second is the registration of the subject's MR scan to the coil locations/fiducials. The first is done at the time of recording (i.e. it is HPI); the sensors are by default read into fieldtrip using the same co-ordinates as the coils/digitised points (i.e. head coordinates rather than sensor coordinates, done by mne2grad in read_header). The second is done by fieldtrip, and is the registration of coil locations to the MR scan. This means that you wouldn't be able to improve the registration of coils etc. to the sensors (this registration has been done already by the HPI), but what you might be able to do is to use the additional points to improve the registration of the coil locations to the subject's MR scan. Typically they should be located on the scalp, and by minimising the mean squared error of the distance between coil locations/other digitised points and scalp you should be able to get a good registration. Unfortunately I'm not quite sure how or whether fieldtrip does this; I'm afraid I use fieldtrip mainly to read the data into SPM (which does allow you to use these additional points to aid registration to the subject's scalp surface). But I imagine fieldtrip is able to do this also, and perhaps someone who knows more about fieldtrip could explain how to use the information in read_headshape to achieve this? Hope this helps, Laurence =========================================== Laurence Hunt, DPhil Student Centre for Functional MRI of the Brain (FMRIB), University of Oxford lhunt at fmrib.ox.ac.uk Phone: (+44)1865-(2)22738 =========================================== On 18 Nov 2009, at 12:38, Hanneke Van Dijk wrote: > Dear all, > > In my group we have a question regarding the use of the coil > locations and/ or isotrack data to do source analysis. We are doing > data analysis using FT and the MNE toolbox, on a dataset recorded > with a Neuromag122 system. > > The four coils were placed in different locations then in the CTF > system, which uses the anatomical landmarks (left ear, right ear and > nasion). Here we placed the coils on the scalp; two approximately > above the eyes and two behind the ears. We digitized the locations > of the coils using the polhemus, togheter with the anatomical > landmarks and some more points. We would very much like to know HOW > and WHERE fieldtrip uses the coil-location information and if it is > possible to use the polhemus data as well, to place the head at the > correct location within the helmet and to do sourceanalysis. > > I noticed allready that when reading the fiff file with > 'fiff_read_meas_info' (MNE) there is a field called .dig which seems > to contain the coordinates of digitized locations. I have no idea > though how to integrate this information into the data so fieldtrip > can use it. > > Thanks in advance for any information, > > Hanneke van Dijk > > Institute for Clinical Neuroscience and Medical Psychology, > Heinrich Heine Universitaet, Duesseldorf. > > > > ---------------------------------- > > The aim of this list is to facilitate the discussion between users > of the FieldTrip toolbox, to share experiences and to discuss new > ideas for MEG and EEG analysis. > > http://listserv.surfnet.nl/archives/fieldtrip.html > > http://www.ru.nl/fcdonders/fieldtrip/ > ---------------------------------- The aim of this list is to facilitate the discussion between users of the FieldTrip toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/neuroimaging/fieldtrip. -------------- next part -------------- An HTML attachment was scrubbed... URL: From brian.roach at YALE.EDU Wed Nov 18 21:25:30 2009 From: brian.roach at YALE.EDU (Brian Roach) Date: Wed, 18 Nov 2009 12:25:30 -0800 Subject: research position in San Francisco, CA Message-ID: Fieldtrip Users, We are looking for new and experienced brain imagers with a background in signal processing to work in our UCSF-affiliated research lab. Please apply at the following link if interested: http://jobs-ncire.icims.com/jobs/1448/job thank you, Brian ---------------------------------- The aim of this list is to facilitate the discussion between users of the FieldTrip toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/neuroimaging/fieldtrip. -------------- next part -------------- An HTML attachment was scrubbed... URL: From nelsonmj at CALTECH.EDU Thu Nov 19 16:10:07 2009 From: nelsonmj at CALTECH.EDU (Matthew Nelson) Date: Thu, 19 Nov 2009 16:10:07 +0100 Subject: Question about permutation testing of an interaction in a two by two design Message-ID: After the terrific help I received following the last question, I thought I would post an additional question I am currently pondering. I’m also interested in comparing the coherence of a pair of signals in a 2x2 design. I am specifically interested in testing the interaction in this design and would like to do so using the cluster-based permutation tests to do so across time and frequency. I’m curious to receive feedback and input about the proper way to go about this. Performing the tests across sessions seems to me to be a bit easier to conceive and to write code for. In this case the design would be a within-sessions design, as all of the four trial types occur in each session. My impression is that the proper test could then be to calculate for each session the difference along one factor for each condition of the other factor, and then performing a permutation test of that difference among the conditions of the other factor with the test statistic merely being the mean difference of eth differences. It struck me that a 4-way permutation of the four trial types, but this would instead be more appropriate if the test statistic I was interested in was an omnibus anova test, not to test strictly the interaction which is my interest here. I am less sure how to perform the test if one wanted to do it within a single session where there may be different numbers of trials in each condition. I know this question relates more to permutation tests than to frequency analysis. If someone could even just point me towards a good reference where I can learn more about these more detailed aspects of permutation tests, I would appreciate it. Thanks. ---------------------------------- The aim of this list is to facilitate the discussion between users of the FieldTrip toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/neuroimaging/fieldtrip. From e.maris at DONDERS.RU.NL Thu Nov 19 22:06:04 2009 From: e.maris at DONDERS.RU.NL (Eric Maris) Date: Thu, 19 Nov 2009 22:06:04 +0100 Subject: Question about permutation testing of an interaction in a two by two design In-Reply-To: Message-ID: Dear Matthew, I agree with your proposal for an interaction test in a within-sessions design. (I have called this a within-units-of-observation design in the Maris & Oostenveld paper.) I know of no permutation test for an interaction effect in a between-units-of-observation design. The reason is that I do not see how such a test can be rephrased as a test of the exchangeability null hypothesis. This is a recurrent question on this discussion list. You may be good to browse through the archive of the discussion list. Best, Eric dr. Eric Maris Donders Institute for Brain, Cognition and Behavior Center for Cognition and F.C. Donders Center for Cognitive Neuroimaging Radboud University P.O. Box 9104 6500 HE Nijmegen The Netherlands T:+31 24 3612651 Mobile: 06 39584581 F:+31 24 3616066 E: e.maris at donders.ru.nl MSc Cognitive Neuroscience: www.ru.nl/master/cns/ > -----Oorspronkelijk bericht----- > Van: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] Namens > Matthew Nelson > Verzonden: donderdag 19 november 2009 16:10 > Aan: FIELDTRIP at NIC.SURFNET.NL > Onderwerp: [FIELDTRIP] Question about permutation testing of an interaction in a > two by two design > > After the terrific help I received following the last question, I thought I > would post an additional question I am currently pondering. > > I'm also interested in comparing the coherence of a pair of signals in a 2x2 > design. I am specifically interested in testing the interaction in this > design and would like to do so using the cluster-based permutation tests to > do so across time and frequency. I'm curious to receive feedback and input > about the proper way to go about this. > > Performing the tests across sessions seems to me to be a bit easier to > conceive and to write code for. In this case the design would be a > within-sessions design, as all of the four trial types occur in each > session. My impression is that the proper test could then be to calculate > for each session the difference along one factor for each condition of the > other factor, and then performing a permutation test of that difference > among the conditions of the other factor with the test statistic merely > being the mean difference of eth differences. It struck me that a 4-way > permutation of the four trial types, but this would instead be more > appropriate if the test statistic I was interested in was an omnibus anova > test, not to test strictly the interaction which is my interest here. > > I am less sure how to perform the test if one wanted to do it within a > single session where there may be different numbers of trials in each > condition. > > I know this question relates more to permutation tests than to frequency > analysis. If someone could even just point me towards a good reference where > I can learn more about these more detailed aspects of permutation tests, I > would appreciate it. Thanks. > > ---------------------------------- > The aim of this list is to facilitate the discussion between users of the FieldTrip > toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. > See also http://listserv.surfnet.nl/archives/fieldtrip.html and > http://www.ru.nl/neuroimaging/fieldtrip. ---------------------------------- The aim of this list is to facilitate the discussion between users of the FieldTrip toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/neuroimaging/fieldtrip. From nelsonmj at CALTECH.EDU Fri Nov 20 17:19:48 2009 From: nelsonmj at CALTECH.EDU (Matthew Nelson) Date: Fri, 20 Nov 2009 17:19:48 +0100 Subject: Question about permutation testing of an interaction in a two by two design Message-ID: Thanks very much for your response. I will browse through the archive here to see if I can find anything. One source I found elsewhere on the web can be found in this book on page 126-127: http://www.amazon.com/reader/038720279X?_encoding=UTF8&query=126#reader_038720279X If I'm understanding his description properly, this can be tested simply by using the ANOVA sum of squares test statistic for an interaction while permuting amongst all the conditions. I would suppose that an interaction contrast could be tested similarly using the sum of squares for the contrast as the test statistic while permuting amongst the combinations of conditions that factor into the particular contrast. But if you don't think that that permutation would provide the proper null hypothesis for either test (the omnibus interaction or an interaction contrast), I'd be curious to know. Thanks again very much, Matthew On Thu, 19 Nov 2009 22:06:04 +0100, Eric Maris wrote: >Dear Matthew, > >I agree with your proposal for an interaction test in a within-sessions >design. (I have called this a within-units-of-observation design in the >Maris & Oostenveld paper.) > >I know of no permutation test for an interaction effect in a >between-units-of-observation design. The reason is that I do not see how >such a test can be rephrased as a test of the exchangeability null >hypothesis. > >This is a recurrent question on this discussion list. You may be good to >browse through the archive of the discussion list. > >Best, > >Eric > > > >dr. Eric Maris >Donders Institute for Brain, Cognition and Behavior >Center for Cognition and F.C. Donders Center for Cognitive Neuroimaging >Radboud University >P.O. Box 9104 >6500 HE Nijmegen >The Netherlands >T:+31 24 3612651 >Mobile: 06 39584581 >F:+31 24 3616066 >E: e.maris at donders.ru.nl > >MSc Cognitive Neuroscience: www.ru.nl/master/cns/ > ---------------------------------- The aim of this list is to facilitate the discussion between users of the FieldTrip toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/neuroimaging/fieldtrip. From g.rousselet at PSY.GLA.AC.UK Fri Nov 20 18:17:46 2009 From: g.rousselet at PSY.GLA.AC.UK (Guillaume Rousselet) Date: Fri, 20 Nov 2009 17:17:46 +0000 Subject: Question about permutation testing of an interaction in a two by two design In-Reply-To: Message-ID: Matthew, based on the attached paper and Wilcox 2005 (Wilcox, R.R., Introduction to Robust Estimation and Hypothesis Testing. 2nd Ed. ed. 2005: Academic Press), the null F distributions for the main effects and the interaction are obtained by sampling with replacement independently from centred distributions. This is an extension of the bootstrap percentile-t technique. I'm not aware of robust ANOVA techniques employing permutation. On 20 Nov 2009, at 16:19, Matthew Nelson wrote: > Thanks very much for your response. I will browse through the > archive here > to see if I can find anything. > > One source I found elsewhere on the web can be found in this book on > page > 126-127: > > http://www.amazon.com/reader/038720279X?_encoding=UTF8&query=126#reader_038720279X > > If I'm understanding his description properly, this can be tested > simply by > using the ANOVA sum of squares test statistic for an interaction while > permuting amongst all the conditions. I would suppose that an > interaction > contrast could be tested similarly using the sum of squares for the > contrast > as the test statistic while permuting amongst the combinations of > conditions > that factor into the particular contrast. > > But if you don't think that that permutation would provide the > proper null > hypothesis for either test (the omnibus interaction or an interaction > contrast), I'd be curious to know. > > Thanks again very much, > > Matthew > > On Thu, 19 Nov 2009 22:06:04 +0100, Eric Maris > wrote: > >> Dear Matthew, >> >> I agree with your proposal for an interaction test in a within- >> sessions >> design. (I have called this a within-units-of-observation design in >> the >> Maris & Oostenveld paper.) >> >> I know of no permutation test for an interaction effect in a >> between-units-of-observation design. The reason is that I do not >> see how >> such a test can be rephrased as a test of the exchangeability null >> hypothesis. >> >> This is a recurrent question on this discussion list. You may be >> good to >> browse through the archive of the discussion list. >> >> Best, >> >> Eric >> >> >> >> dr. Eric Maris >> Donders Institute for Brain, Cognition and Behavior >> Center for Cognition and F.C. Donders Center for Cognitive >> Neuroimaging >> Radboud University >> P.O. Box 9104 >> 6500 HE Nijmegen >> The Netherlands >> T:+31 24 3612651 >> Mobile: 06 39584581 >> F:+31 24 3616066 >> E: e.maris at donders.ru.nl >> >> MSc Cognitive Neuroscience: www.ru.nl/master/cns/ >> > > ---------------------------------- > The aim of this list is to facilitate the discussion between users > of the FieldTrip toolbox, to share experiences and to discuss new > ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html > and http://www.ru.nl/neuroimaging/fieldtrip. ************************************************************************************ Guillaume A. Rousselet, Ph.D. Lecturer Centre for Cognitive Neuroimaging (CCNi) Department of Psychology Faculty of Information & Mathematical Sciences (FIMS) University of Glasgow 58 Hillhead Street Glasgow, UK G12 8QB The University of Glasgow, charity number SC004401 http://web.me.com/rousseg/GARs_website/ Email: g.rousselet at psy.gla.ac.uk Fax. +44 (0)141 330 4606 Tel. +44 (0)141 330 6652 Cell +44 (0)791 779 7833 "no test based upon a theory of probability can by itself provide any valuable evidence of the truth or falsehood of a hypothesis. But we may look at the purpose of tests from another viewpoint. Without hoping to know whether each separate hypothesis is true or false, we may search for rules to govern our behaviour with regard to them, in following which we insure that, in the long run of experience, we shall not often be wrong." Neyman J & Pearson E, 1933 ************************************************************************************ ---------------------------------- The aim of this list is to facilitate the discussion between users of the FieldTrip toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/neuroimaging/fieldtrip. -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: Berkovits_00_bootstrap.pdf Type: application/pdf Size: 82267 bytes Desc: not available URL: -------------- next part -------------- An HTML attachment was scrubbed... URL: From r.oostenveld at FCDONDERS.RU.NL Mon Nov 23 09:00:05 2009 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Mon, 23 Nov 2009 08:00:05 +0000 Subject: using coil/isotrack information for sourceanalysis (neuromag data) In-Reply-To: <60D7F31F-C6E0-4A3A-AB89-BCA9AEA185D6@fcdonders.ru.nl> Message-ID: Hi Hanneke, On 18 Nov 2009, at 14:40, Laurence Hunt wrote: > ... > Unfortunately I'm not quite sure how or whether fieldtrip does this; I'm afraid I use fieldtrip mainly to read the data into SPM (which does allow you to use these additional points to aid registration to the subject's scalp surface). But I imagine fieldtrip is able to do this also, and perhaps someone who knows more about fieldtrip could explain how to use the information in read_headshape to achieve this? Laurences description of the two steps are correct. First the position of the MEG sensors is expressed in a coordinate system relative to the fiducials, subseuqnelty the posiiton of the MRI has to be expressed in the same coordinate system. For the MEG gradiometer coils fieldtripFT relies on the low-level reader (in this case in combination with mne2grad.m) to contain the position in the correct coordinate system. In the CTF case (as an example), the res4 file contains the coil posiitons both in head coorindates, but also in dewar coordinates. FieldTrip reads the coil positions in head coordinates and stores them in grad.pnt and grad.ori (orientation is also relevant here). The usual procedure for the MRI in the CTF case is to use MRIViewer to click on the fiducials and then store the mri file with the coordinate system re-defined according to the fiducials. The volumerealign.m function allows to do the same in fieldtrip in case you don't have vendor-specific software to assign the coordinate system. What I'm not sure about is whether you want to represent the MEG coils and MRI relative to the localizer coils, or relative to the Nose/Ear fiducials. The first case is quite simple, because that only requires you to identify the localizer coils in the MRI. The second case is more tricky, because you then first have to specify the MEG coils and MRI in the localizer-coil coordinate system, compute the transformation from localizer coil coordinate system to fiducial coordinate system, and then apply that transform to both MEG coil positions+orientations and to the MRI. FT functions that pertain to this (but are normally low-level and not used by the end user) are headcoordinates, which allows you to compute the coordinate transformation matrix from A to B given three new points that describe coordinate system B, expressed in coordinate system A. The function forwinv/transform_sens can be used to apply the transformation to the sensors, The function warp_apply is used, and applying the transformation to the MRI is as simple as multiplying h, the output of headcoordinates with mri.tra, such that mri.tra = h*mri.tra. Important is that you carefully check the alignment of the MRI with the sensors by plotting them combined in 3D. The functions plot_slice and plot_sens (both in plotting) can be used for that. Hope this helps. Robert ----------------------------------------------------------- Robert Oostenveld, PhD Senior Researcher Donders Institute for Brain, Cognition and Behaviour Centre for Cognitive Neuroimaging Radboud University Nijmegen tel.: +31 (0)24 3619695 e-mail: r.oostenveld at donders.ru.nl web: http://www.ru.nl/neuroimaging skype: r.oostenveld ----------------------------------------------------------- ---------------------------------- The aim of this list is to facilitate the discussion between users of the FieldTrip toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/neuroimaging/fieldtrip. -------------- next part -------------- An HTML attachment was scrubbed... URL: From yiwen.li at MED.UNI-TUEBINGEN.DE Mon Nov 23 19:11:41 2009 From: yiwen.li at MED.UNI-TUEBINGEN.DE (Yiwen Li) Date: Mon, 23 Nov 2009 19:11:41 +0100 Subject: common spatial filter in lcmv beamforming Message-ID: Dear Fieldtrip Users, I have a question on computing common spatial filter for the time domain data (ERP) using lcmv beamforming. My experiment is a bilateral tactile discrimination task measured with the 275-channel CTF system. There are two experimental conditions that I want to compare within subjects on the source level. As the baseline between the two conditions might not be homogeneous, I would like to compute two common spatial filters based on the pooled data of both conditions for baseline and for the ERP during the tactile stimulation respectively. According to the example matlab script of computing common spatial filters on frequency data posted on the Fieldtrip website, I adapted it to the lcmv beamforming on the time domain data. The script is attach at the end. As my original trial length is 5.5s (-1.5 to 4s, -1s is visual instruction onset, 0s to 0.6s is tactile stimulation), the projection of each single trial through the common filter became extremely computationally demanding. Then I redefined the trials according to the time window of interest (as was suggested in the frequency domain source analysis), I got different source results as the beamformer_lcmv seem to take the average of the whole given data length and the covariance of the specified window to calculate the spatial filter. Now I realized that it was not correct to define such short time period for the averaged data and that I probably should have taken a longer time window, such as [-1.4 0.6]s that covers both baseline and tactile stimulation. But I am not clear about what kind of time window would be appropriate in my case? I have tried a couple of different time windows but so far I haven't got clear bilateral primary somatosensory sources yet, actually not even close to it, so I know I must have done something wrong. Any suggestions would be very much appreciated. Best regards, Yiwen cfg = []; cfg.channel = {'MEG'}; cfg.blc = 'no'; cfg.keeptrials = 'yes'; tlckavg = timelockanalysis(cfg, data); cfg = []; cfg.channel = {'MEG'}; cfg.blc = 'no'; cfg.removemean = 'no'; cfg.covariance = 'yes'; cfg.keeptrials = 'yes'; cfg.covariancewindow = [0.05 0.07]; % cfg.latency = [0.05 0.07]; tlckavg_toi = timelockanalysis(cfg, tlckavg); cfg.covariancewindow = [-1.37 -1.35]; % cfg.latency = [-1.37 -1.35]; tlckavg_blc = timelockanalysis(cfg, tlckavg); cfg = []; cfg.method = 'lcmv'; cfg.grid = grid; cfg.vol = vol; cfg.lambda = '5%'; cfg.keepfilter = 'yes'; source = sourceanalysis(cfg, tlckavg); cfg = []; cfg.method = 'lcmv'; cfg.grid = grid; % previously computed grid cfg.vol = vol; % previously computed volume conduction model cfg.grid.filter = source.avg.filter; % use the common filter computed in the previous step! cfg.lambda = '5%'; cfg.rawtrial = 'yes'; % project each single trial through the filter source = sourceanalysis(cfg, tlckavg); --------------------------------------------------------------------------------- Yiwen Li Hegner , PhD MEG-Center Institute of Medical Psychology and Behavioral Neurobiology University of Tübingen Germany ---------------------------------- The aim of this list is to facilitate the discussion between users of the FieldTrip toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/neuroimaging/fieldtrip. From rajamonis at MAIL.NIH.GOV Mon Nov 23 21:34:41 2009 From: rajamonis at MAIL.NIH.GOV (Rajamoni Nadar, Sreenivasan (NIH/NIMH) [E]) Date: Mon, 23 Nov 2009 15:34:41 -0500 Subject: FW: Fieldtrip to extract source signal Message-ID: Dr. Oostenveld, Attached is the code that I used to extract single trial source time series from MEG dataset (CTF). It is giving the following error while calling the routine prepare_leadfield. Could you please let me know the way to fix it? Thanks, Vasan %~~~~~~~~~~~~~~~ see the error message~~~~~~~~~~~~~~~ the input is timelock data with 273 channels and 300 timebins reading headmodel from file '/gs1/users/rajamoni/MEG_ds/AEDTPJOU_nback_20050422_01-f.ds/default.hdm' using gradiometers specified in the data precomputing leadfields for efficient handling of multiple trials reading headmodel from file '/gs1/users/rajamoni/MEG_ds/AEDTPJOU_nback_20050422_01-f.ds/default.hdm' using gradiometers specified in the data creating dipole grid based on user specified dipole positions 0 dipoles inside, 1 dipoles outside brain computing leadfield ??? Reference to non-existent field 'type'. Error in ==> prepare_leadfield at 133 if strcmp(vol.type, 'openmeeg') Error in ==> sourceanalysis at 322 [grid, cfg] = prepare_leadfield(cfg, data); ---------------------------------- The aim of this list is to facilitate the discussion between users of the FieldTrip toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/neuroimaging/fieldtrip. -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: single_trial_source_from_fieldtrip.m Type: application/octet-stream Size: 1486 bytes Desc: single_trial_source_from_fieldtrip.m URL: From moratti at MED.UCM.ES Tue Nov 24 10:19:43 2009 From: moratti at MED.UCM.ES (Stephan Moratti) Date: Tue, 24 Nov 2009 10:19:43 +0100 Subject: Question about permutation testing of an interaction in a two by two design Message-ID: Hi all, Thanks for the interesing discussion about the interaction with respect to permutation. I have been also struggling with this question. As we want to test the interaction (and not the main effect condition), I am not sure if resampling condition would produce the distribution of our null hypothesis. Regarding the interaction, we want to check if the mean values across conditions follow the same pattern in two groups (if we consider a group x condition interaction). If we make a line plot an interaction would be indicated by a line crossing if each line represents a group (ideally). No interaction would be represented by parallel lines for each group. So I wonder if by resampling the subject values between the groups keeping the condition structure intact, would create our null distribution for the interaction. If we resample condition, we would destroy the condition structure. What do you think? I would be happy for any input. Best, Stephan ---------------------------------- The aim of this list is to facilitate the discussion between users of the FieldTrip toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/neuroimaging/fieldtrip. From g.rousselet at PSY.GLA.AC.UK Tue Nov 24 11:18:02 2009 From: g.rousselet at PSY.GLA.AC.UK (Guillaume Rousselet) Date: Tue, 24 Nov 2009 10:18:02 +0000 Subject: Question about permutation testing of an interaction in a two by two design In-Reply-To: Message-ID: Dear Stephan, to build an appropriate null distribution, the resampling procedure must stick to the structure of your experimental design. In the case of a group x condition (repeated measure) interaction, the groups are independent but the conditions are not. To take that constraint into account, I think you need to resample from each group independently. However, for each group, because of the paired nature of the design, when you sample 1 subject, you have to sample both conditions from that subject (and all the time points and sensors), i.e. you sample subjects with replacement independently from each group, but keeping paired data points together. The strategy described here relies on a sampling with replacement under H0. In that case H0 is created by centering the data independently in each of the 4 cells of your design. So you start with a true null hypothesis and through resampling you can derive a table of F values for the interaction under H0. Hope this help, GAR On 24 Nov 2009, at 09:19, Stephan Moratti wrote: > Hi all, > > Thanks for the interesing discussion about the interaction with > respect to > permutation. I have been also struggling with this question. As we > want to > test the interaction (and not the main effect condition), I am not > sure if > resampling condition would produce the distribution of our null > hypothesis. > Regarding the interaction, we want to check if the mean values across > conditions follow the same pattern in two groups (if we consider a > group x > condition interaction). If we make a line plot an interaction would > be indicated > by a line crossing if each line represents a group (ideally). No > interaction > would be represented by parallel lines for each group. So I wonder > if by > resampling the subject values between the groups keeping the condition > structure intact, would create our null distribution for the > interaction. If we > resample condition, we would destroy the condition structure. > > What do you think? I would be happy for any input. > > Best, > > Stephan > > ---------------------------------- > The aim of this list is to facilitate the discussion between users > of the FieldTrip toolbox, to share experiences and to discuss new > ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html > and http://www.ru.nl/neuroimaging/fieldtrip. ************************************************************************************ Guillaume A. Rousselet, Ph.D. Lecturer Centre for Cognitive Neuroimaging (CCNi) Department of Psychology Faculty of Information & Mathematical Sciences (FIMS) University of Glasgow 58 Hillhead Street Glasgow, UK G12 8QB The University of Glasgow, charity number SC004401 http://web.me.com/rousseg/GARs_website/ Email: g.rousselet at psy.gla.ac.uk Fax. +44 (0)141 330 4606 Tel. +44 (0)141 330 6652 Cell +44 (0)791 779 7833 "YOU ARE NOT NORMAL. [...] you probably belong to the minority of the world's population that has a steady job, adequate access to social security, and enjoys substantial political freedoms. Moreover, you live on more than $2 a day, and, unlike 860 million others, you can read. The percentage of humanity that combines all of these attributes is minuscule. [...] Statistically, a "normal" human being in today's world is poor, lives in oppressive physical, social, and political conditions, and is ruled by unresponsive and corrupt government." Moises Naim - 2005 - Editor in chief of Foreign Policy ************************************************************************************ ---------------------------------- The aim of this list is to facilitate the discussion between users of the FieldTrip toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/neuroimaging/fieldtrip. -------------- next part -------------- An HTML attachment was scrubbed... URL: From sklein at BERKELEY.EDU Tue Nov 24 11:18:23 2009 From: sklein at BERKELEY.EDU (Stanley Klein) Date: Tue, 24 Nov 2009 02:18:23 -0800 Subject: How does one do simulations for statistics? Message-ID: I too have lots of questions on how to do statistics on EEG and MEG. Right now for example we are getting very similar EEG and MEG waveforms (following SVD) and are trying out various statistical ways of comparing them. In addition to using Fieldtrip's wonderful (but complicated) cluster permutation test for dealing with multiple comparisons and correlated noise issues we are trying other ideas. The only way that we can figure out whether we are on the right track is to do simulations where we know the correct answer. Does anyone have good advice on how to do good simulations? We are using the CTF machine for our EEG and MEG (and Biosemi for EEG alone). Every sample is about 2 msec. For a single trace  we are using something like the following Matlab code that gives a flat amplitude spectrum out to 15 Hz and then close to 1/f^2 beyond that. x(1:2)=[0 1]; for i=3:10000; x(i) = 1.81*x(i-1) -.85*x(i-2)+randn; %AR model for time series end The AR coefficients were obtained by trial and error and have a lot of flexibility. The question again is whether anyone has good suggestions for how to simulate EEG or MEG noise in the time domain? Even better would be something good to read. I'd like the noise to be manufactured in the time domain since I'll be doing other things for the signal in the time domain including multiplicative noise. Without good simulations how do people test all their statistics, especially when there is a bunch of preprocessing like SVD (or complicated, nonlinear interaction terms)? thanks, Stan Klein ---------------------------------- The aim of this list is to facilitate the discussion between users of the FieldTrip toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/neuroimaging/fieldtrip. From e.maris at DONDERS.RU.NL Tue Nov 24 12:11:18 2009 From: e.maris at DONDERS.RU.NL (Eric Maris) Date: Tue, 24 Nov 2009 12:11:18 +0100 Subject: Question about permutation testing of an interaction in a two by two design In-Reply-To: Message-ID: Dear Stephan, It is sometimes possible to reformulate an interaction effect null hypothesis such that it becomes a main effect null hypothesis (however, for a different dependent variable, obtained be calculating the difference between conditions). Such a reformulation is possible for a two-factorial design in which one independent variable is manipulated within subjects (in your case, this is condition), and the other between subjects (in your case, this is group). You do this by calculating subject-specific difference scores, [condition1 - condition2], and using these as the dependent variable in a between-groups comparison. This is possible by means of the standard independent-samples T-test, but also by means of a permutation test (involving permutation of the difference scores), which allows you to deal with the multiple comparison problem. For a factorial design that only involves between-subject independent variables, such a reformulation is not possible (at least, I am not aware of it). Best, Eric > -----Oorspronkelijk bericht----- > Van: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] Namens > Stephan Moratti > Verzonden: dinsdag 24 november 2009 10:20 > Aan: FIELDTRIP at NIC.SURFNET.NL > Onderwerp: Re: [FIELDTRIP] Question about permutation testing of an interaction > in a two by two design > > Hi all, > > Thanks for the interesing discussion about the interaction with respect to > permutation. I have been also struggling with this question. As we want to > test the interaction (and not the main effect condition), I am not sure if > resampling condition would produce the distribution of our null hypothesis. > Regarding the interaction, we want to check if the mean values across > conditions follow the same pattern in two groups (if we consider a group x > condition interaction). If we make a line plot an interaction would be indicated > by a line crossing if each line represents a group (ideally). No interaction > would be represented by parallel lines for each group. So I wonder if by > resampling the subject values between the groups keeping the condition > structure intact, would create our null distribution for the interaction. If we > resample condition, we would destroy the condition structure. > > What do you think? I would be happy for any input. > > Best, > > Stephan > > ---------------------------------- > The aim of this list is to facilitate the discussion between users of the FieldTrip > toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. > See also http://listserv.surfnet.nl/archives/fieldtrip.html and > http://www.ru.nl/neuroimaging/fieldtrip. ---------------------------------- The aim of this list is to facilitate the discussion between users of the FieldTrip toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/neuroimaging/fieldtrip. -------------- next part -------------- An HTML attachment was scrubbed... URL: From sklein at BERKELEY.EDU Tue Nov 24 12:43:39 2009 From: sklein at BERKELEY.EDU (Stanley Klein) Date: Tue, 24 Nov 2009 03:43:39 -0800 Subject: How does one do simulations for statistics? In-Reply-To: <9016c9f10911240218s3f8ebbf9r867a274fd3ad821@mail.gmail.com> Message-ID: Hi again, I have had a suggestion to try the freqsimulation function of Fieldtrip. But I would like to have something in the time domain so that I can play with autoregressive coefficients between sources and so that I can put in nonlinearities like multiplicative noise if I'd like. . Incidentally the AR coefficients that I had given corresponded to a filter that looks like: t=0:2:199; %t is in msec x=exp(-t/25).*sin(2*pi*t/60); %this gives about one damped cycle with 60 msec period XX=[x(3:100); x(2:99); x(1:98)]; coef=XX(1,:)/XX(2:3,:) %linear regression to get AR coefficients where coef = [1.806 -.852] from this linear regression, which is similar to what I had sent in my previous email for generating the noisy filtered time series. Again, my question is how to generate noise that looks like EEG or MEG. Can I do an adequate job simply by getting nice AR coefficients (what would some good coefficients be?) or do I need to do fancier things? For example, should I worry about sparse bursts of alpha? What do people commonly do to simulate data. I like to use simulated time series in addition to real data so that I am confident about what is going on underneath. Stan On Tue, Nov 24, 2009 at 2:18 AM, Stanley Klein wrote: > I too have lots of questions on how to do statistics on EEG and MEG. > Right now for example we are getting very similar EEG and MEG > waveforms (following SVD) and are trying out various statistical ways > of comparing them. In addition to using Fieldtrip's wonderful (but > complicated) cluster permutation test for dealing with multiple > comparisons and correlated noise issues we are trying other ideas. The > only way that we can figure out whether we are on the right track is > to do simulations where we know the correct answer. Does anyone have > good advice on how to do good simulations? We are using the CTF > machine for our EEG and MEG (and Biosemi for EEG alone). Every sample > is about 2 msec. For a single trace  we are using something like the > following Matlab code that gives a flat amplitude spectrum out to 15 > Hz and then close to 1/f^2 beyond that. > > x(1:2)=[0 1]; > for i=3:10000; >   x(i) = 1.81*x(i-1) -.85*x(i-2)+randn;  %AR model for time series > end > > The AR coefficients were obtained by trial and error and have a lot of > flexibility. > > The question again is whether anyone has good suggestions for how to > simulate EEG or MEG noise in the time domain?  Even better would be > something good to read.   I'd like the noise to be manufactured in the > time domain since I'll be doing other things for the signal in the > time domain including multiplicative noise. Without good simulations > how do people test all their statistics, especially when there is a > bunch of preprocessing like SVD (or complicated, nonlinear interaction > terms)? > thanks, > Stan Klein > ---------------------------------- The aim of this list is to facilitate the discussion between users of the FieldTrip toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/neuroimaging/fieldtrip. From moratti at MED.UCM.ES Tue Nov 24 14:51:52 2009 From: moratti at MED.UCM.ES (Stephan Moratti) Date: Tue, 24 Nov 2009 14:51:52 +0100 Subject: Question about permutation testing of an interaction in a two by two design Message-ID: Eric, Thanks a lot for your reply ! Best, Stephan ---------------------------------- The aim of this list is to facilitate the discussion between users of the FieldTrip toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/neuroimaging/fieldtrip. From moratti at MED.UCM.ES Tue Nov 24 15:04:49 2009 From: moratti at MED.UCM.ES (Stephan Moratti) Date: Tue, 24 Nov 2009 15:04:49 +0100 Subject: Question about permutation testing of an interaction in a two by two design Message-ID: Dear Guillaume, Thanks for the reply. I think what I meant with "keeping the condition structure", refelcts what you have described in your awnser (but in a far better way I gave to admit !). What I did is doing so in "R" (a statistical package) and then use fieldtrip to do the cluster statistic. Best and many thanks, Stephan ---------------------------------- The aim of this list is to facilitate the discussion between users of the FieldTrip toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/neuroimaging/fieldtrip. From wanglinsisi at GMAIL.COM Tue Nov 24 20:48:54 2009 From: wanglinsisi at GMAIL.COM (Lin Wang) Date: Tue, 24 Nov 2009 20:48:54 +0100 Subject: Question about permutation testing of an interaction in a two by two design In-Reply-To: Message-ID: Dear Eric, Thanks for your clear answer. I also have a question about the permutation testing of the interactions in the mixed factorial design. Suppose I have three factors, with two levels in each: 2Group(boys,girls)*2A(A1,A2)*2B(B1,B2). Factor Group is a between-subject factor, while factor A and B are within-subject factors. What I want to test is whether factors B influences factor A differently on boys and girls (a three-way interaction). Can I test the interaction between factor B and Group separately in B1 and B2 conditions? That is, first split the data into two parts (B1, B2), and then for each part test the interaction between factor A and Group by subtracting the observations of A1 from A2 and taking it as a new dependent variable. Furthermore, if I have another factor C(C1, C2), and I'm interested in whether the combination of B and C influences factor A differently on boys and girls. Can I first split the data into four parts according to the combination of factor B and C (B1C1, B1C2, B2C1, B2C2) and do the interaction between factor A and Group separately for each part? Thank you in advance. Lin 2009/11/24 Eric Maris > Dear Stephan, > > > > > > It is sometimes possible to reformulate an interaction effect null > hypothesis such that it becomes a main effect null hypothesis (however, for > a different dependent variable, obtained be calculating the difference > between conditions). Such a reformulation is possible for a two-factorial > design in which one independent variable is manipulated within subjects (in > your case, this is condition), and the other between subjects (in your case, > this is group). You do this by calculating subject-specific difference > scores, [condition1 - condition2], and using these as the dependent variable > in a between-groups comparison. This is possible by means of the standard > independent-samples T-test, but also by means of a permutation test > (involving permutation of the difference scores), which allows you to deal > with the multiple comparison problem. > > > > For a factorial design that only involves between-subject independent > variables, such a reformulation is not possible (at least, I am not aware of > it). > > > > > > Best, > > > > Eric > > > > > > > > > > > -----Oorspronkelijk bericht----- > > > Van: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] Namens > > > Stephan Moratti > > > Verzonden: dinsdag 24 november 2009 10:20 > > > Aan: FIELDTRIP at NIC.SURFNET.NL > > > Onderwerp: Re: [FIELDTRIP] Question about permutation testing of an > interaction > > > in a two by two design > > > > > > Hi all, > > > > > > Thanks for the interesing discussion about the interaction with respect > to > > > permutation. I have been also struggling with this question. As we want > to > > > test the interaction (and not the main effect condition), I am not sure > if > > > resampling condition would produce the distribution of our null > hypothesis. > > > Regarding the interaction, we want to check if the mean values across > > > conditions follow the same pattern in two groups (if we consider a group > x > > > condition interaction). If we make a line plot an interaction would be > indicated > > > by a line crossing if each line represents a group (ideally). No > interaction > > > would be represented by parallel lines for each group. So I wonder if by > > > resampling the subject values between the groups keeping the condition > > > structure intact, would create our null distribution for the interaction. > If we > > > resample condition, we would destroy the condition structure. > > > > > > What do you think? I would be happy for any input. > > > > > > Best, > > > > > > Stephan > > > > > > ---------------------------------- > > > The aim of this list is to facilitate the discussion between users of the > FieldTrip > > > toolbox, to share experiences and to discuss new ideas for MEG and EEG > analysis. > > > See also http://listserv.surfnet.nl/archives/fieldtrip.html and > > > http://www.ru.nl/neuroimaging/fieldtrip. > > ---------------------------------- > > The aim of this list is to facilitate the discussion between users of the > FieldTrip toolbox, to share experiences and to discuss new ideas for MEG and > EEG analysis. > > http://listserv.surfnet.nl/archives/fieldtrip.html > > http://www.ru.nl/fcdonders/fieldtrip/ > ---------------------------------- The aim of this list is to facilitate the discussion between users of the FieldTrip toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/neuroimaging/fieldtrip. -------------- next part -------------- An HTML attachment was scrubbed... URL: From e.maris at DONDERS.RU.NL Tue Nov 24 23:39:18 2009 From: e.maris at DONDERS.RU.NL (Eric Maris) Date: Tue, 24 Nov 2009 23:39:18 +0100 Subject: Question about permutation testing of an interaction in a two by two design In-Reply-To: Message-ID: Dear Lin, Thanks for your clear answer. I also have a question about the permutation testing of the interactions in the mixed factorial design. Suppose I have three factors, with two levels in each: 2Group(boys,girls)*2A(A1,A2)*2B(B1,B2). Factor Group is a between-subject factor, while factor A and B are within-subject factors. What I want to test is whether factors B influences factor A differently on boys and girls (a three-way interaction). Can I test the interaction between factor B and Group separately in B1 and B2 conditions? That is, first split the data into two parts (B1, B2), and then for each part test the interaction between factor A and Group by subtracting the observations of A1 from A2 and taking it as a new dependent variable. Furthermore, if I have another factor C(C1, C2), and I'm interested in whether the combination of B and C influences factor A differently on boys and girls. Can I first split the data into four parts according to the combination of factor B and C (B1C1, B1C2, B2C1, B2C2) and do the interaction between factor A and Group separately for each part? I do not think it is necessary to split the data and do separate analyses on the different parts. Reformulating an interacting effect null hypothesis as a main effect null hypothesis for a different dependent variable is possible if you have at most a single between-subjects variable in your design. Thus, it also works in the case you describe, with two within-subjects and one between-subjects variable. The dependent variable that must be calculated is the two-way interaction effect contrast for the 2-factorial within-subjects design with the variables A and B: [A1,B1] + [A2,B2] - [A1,B2] - [A2,B1]. You then perform a independent samples T-test on the interaction contrast variable, comparing the two levels of your between-subjects variable. This reformulation is also possible when there are more than two within-subjects variables in the design. The only thing that changes is the interaction effec contrast. Best, Eric dr. Eric Maris Donders Institute for Brain, Cognition and Behavior Center for Cognition and F.C. Donders Center for Cognitive Neuroimaging Radboud University P.O. Box 9104 6500 HE Nijmegen The Netherlands T:+31 24 3612651 Mobile: 06 39584581 F:+31 24 3616066 E: e. maris at donders.ru.nl MSc Cognitive Neuroscience: www.ru.nl/master/cns/ Thank you in advance. Lin 2009/11/24 Eric Maris Dear Stephan, It is sometimes possible to reformulate an interaction effect null hypothesis such that it becomes a main effect null hypothesis (however, for a different dependent variable, obtained be calculating the difference between conditions). Such a reformulation is possible for a two-factorial design in which one independent variable is manipulated within subjects (in your case, this is condition), and the other between subjects (in your case, this is group). You do this by calculating subject-specific difference scores, [condition1 - condition2], and using these as the dependent variable in a between-groups comparison. This is possible by means of the standard independent-samples T-test, but also by means of a permutation test (involving permutation of the difference scores), which allows you to deal with the multiple comparison problem. For a factorial design that only involves between-subject independent variables, such a reformulation is not possible (at least, I am not aware of it). Best, Eric > -----Oorspronkelijk bericht----- > Van: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] Namens > Stephan Moratti > Verzonden: dinsdag 24 november 2009 10:20 > Aan: FIELDTRIP at NIC.SURFNET.NL > Onderwerp: Re: [FIELDTRIP] Question about permutation testing of an interaction > in a two by two design > > Hi all, > > Thanks for the interesing discussion about the interaction with respect to > permutation. I have been also struggling with this question. As we want to > test the interaction (and not the main effect condition), I am not sure if > resampling condition would produce the distribution of our null hypothesis. > Regarding the interaction, we want to check if the mean values across > conditions follow the same pattern in two groups (if we consider a group x > condition interaction). If we make a line plot an interaction would be indicated > by a line crossing if each line represents a group (ideally). No interaction > would be represented by parallel lines for each group. So I wonder if by > resampling the subject values between the groups keeping the condition > structure intact, would create our null distribution for the interaction. If we > resample condition, we would destroy the condition structure. > > What do you think? I would be happy for any input. > > Best, > > Stephan > > ---------------------------------- > The aim of this list is to facilitate the discussion between users of the FieldTrip > toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. > See also http://listserv.surfnet.nl/archives/fieldtrip.html and > http://www.ru.nl/neuroimaging/fieldtrip. ---------------------------------- The aim of this list is to facilitate the discussion between users of the FieldTrip toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. http://listserv.surfnet.nl/archives/fieldtrip.html http://www.ru.nl/fcdonders/fieldtrip/ ---------------------------------- The aim of this list is to facilitate the discussion between users of the FieldTrip toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. http://listserv.surfnet.nl/archives/fieldtrip.html http://www.ru.nl/fcdonders/fieldtrip/ ---------------------------------- The aim of this list is to facilitate the discussion between users of the FieldTrip toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/neuroimaging/fieldtrip. -------------- next part -------------- An HTML attachment was scrubbed... URL: From dahliash at STANFORD.EDU Wed Nov 25 05:43:21 2009 From: dahliash at STANFORD.EDU (Dahlia Sharon) Date: Wed, 25 Nov 2009 05:43:21 +0100 Subject: freqstatistics: direct access to t statistic of observed data Message-ID: Hi, I'm running freqstatistics to test for a difference in coherence between two stimulus conditions (data is time x freq with only 1 channel combination), using the montecarlo and permutation options. Could anyone instruct me how to access the t statistic (NOT the cluster level statistic but that of the raw spectra) of the observed data (for all time-frequency points), and its threshold? Thanks!!! Dahlia. ---------------------------------- The aim of this list is to facilitate the discussion between users of the FieldTrip toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/neuroimaging/fieldtrip. From wanglinsisi at GMAIL.COM Wed Nov 25 09:37:51 2009 From: wanglinsisi at GMAIL.COM (Lin Wang) Date: Wed, 25 Nov 2009 09:37:51 +0100 Subject: Question about permutation testing of an interaction in a two by two design In-Reply-To: <03B30C59D4B24992926172AEE418B8DA@ru42146fac3249> Message-ID: Dear Eric, Thank you very much for you reply. I'm clear about the testing of multiple-way interaction now. I suppose the tests I mentioned in the last email is simple effect test. Am I right? Thanks again. Lin 2009/11/24 Eric Maris > Dear Lin, > > > > > > > > Thanks for your clear answer. I also have a question about the permutation > testing of the interactions in the mixed factorial design. > > Suppose I have three factors, with two levels in each: > 2Group(boys,girls)*2A(A1,A2)*2B(B1,B2). Factor Group is a between-subject > factor, while factor A and B are within-subject factors. What I want to test > is whether factors B influences factor A differently on boys and girls (a > three-way interaction). > > Can I test the interaction between factor B and Group separately in B1 and > B2 conditions? That is, first split the data into two parts (B1, B2), and > then for each part test the interaction between factor A and Group by > subtracting the observations of A1 from A2 and taking it as a new dependent > variable. > > Furthermore, if I have another factor C(C1, C2), and I'm interested in > whether the combination of B and C influences factor A differently on boys > and girls. Can I first split the data into four parts according to the > combination of factor B and C (B1C1, B1C2, B2C1, B2C2) and do the > interaction between factor A and Group separately for each part? > > I do not think it is necessary to split the data and do separate analyses > on the different parts. > > Reformulating an interacting effect null hypothesis as a main effect null > hypothesis for a different dependent variable is possible if you have at > most a single between-subjects variable in your design. Thus, it also works > in the case you describe, with two within-subjects and one between-subjects > variable. The dependent variable that must be calculated is the two-way > interaction effect contrast for the 2-factorial within-subjects design with > the variables A and B: [A1,B1] + [A2,B2] – [A1,B2] – [A2,B1]. You then > perform a independent samples T-test on the interaction contrast variable, > comparing the two levels of your between-subjects variable. > > This reformulation is also possible when there are more than two > within-subjects variables in the design. The only thing that changes is the > interaction effec contrast. > > > > Best, > > Eric > > > > dr. Eric Maris > Donders Institute for Brain, Cognition and Behavior > > Center for Cognition and F.C. Donders Center for Cognitive Neuroimaging > > Radboud University > P.O. Box 9104 > 6500 HE Nijmegen > The Netherlands > T:+31 24 3612651 > Mobile: 06 39584581 > > F:+31 24 3616066 > E: e.maris at donders.ru.nl > > > > MSc Cognitive Neuroscience: www.ru.nl/master/cns/ > > > > > > > Thank you in advance. > > Lin > > > 2009/11/24 Eric Maris > > Dear Stephan, > > > > > > It is sometimes possible to reformulate an interaction effect null > hypothesis such that it becomes a main effect null hypothesis (however, for > a different dependent variable, obtained be calculating the difference > between conditions). Such a reformulation is possible for a two-factorial > design in which one independent variable is manipulated within subjects (in > your case, this is condition), and the other between subjects (in your case, > this is group). You do this by calculating subject-specific difference > scores, [condition1 - condition2], and using these as the dependent variable > in a between-groups comparison. This is possible by means of the standard > independent-samples T-test, but also by means of a permutation test > (involving permutation of the difference scores), which allows you to deal > with the multiple comparison problem. > > > > For a factorial design that only involves between-subject independent > variables, such a reformulation is not possible (at least, I am not aware of > it). > > > > > > Best, > > > > Eric > > > > > > > > > > > -----Oorspronkelijk bericht----- > > > Van: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] Namens > > > Stephan Moratti > > > Verzonden: dinsdag 24 november 2009 10:20 > > > Aan: FIELDTRIP at NIC.SURFNET.NL > > > Onderwerp: Re: [FIELDTRIP] Question about permutation testing of an > interaction > > > in a two by two design > > > > > > Hi all, > > > > > > Thanks for the interesing discussion about the interaction with respect > to > > > permutation. I have been also struggling with this question. As we want > to > > > test the interaction (and not the main effect condition), I am not sure > if > > > resampling condition would produce the distribution of our null > hypothesis. > > > Regarding the interaction, we want to check if the mean values across > > > conditions follow the same pattern in two groups (if we consider a group > x > > > condition interaction). If we make a line plot an interaction would be > indicated > > > by a line crossing if each line represents a group (ideally). No > interaction > > > would be represented by parallel lines for each group. So I wonder if by > > > resampling the subject values between the groups keeping the condition > > > structure intact, would create our null distribution for the interaction. > If we > > > resample condition, we would destroy the condition structure. > > > > > > What do you think? I would be happy for any input. > > > > > > Best, > > > > > > Stephan > > > > > > ---------------------------------- > > > The aim of this list is to facilitate the discussion between users of the > FieldTrip > > > toolbox, to share experiences and to discuss new ideas for MEG and EEG > analysis. > > > See also http://listserv.surfnet.nl/archives/fieldtrip.html and > > > http://www.ru.nl/neuroimaging/fieldtrip. > > ---------------------------------- > > The aim of this list is to facilitate the discussion between users of the > FieldTrip toolbox, to share experiences and to discuss new ideas for MEG and > EEG analysis. > > http://listserv.surfnet.nl/archives/fieldtrip.html > > http://www.ru.nl/fcdonders/fieldtrip/ > > > > ---------------------------------- > > The aim of this list is to facilitate the discussion between users of the > FieldTrip toolbox, to share experiences and to discuss new ideas for MEG and > EEG analysis. > > http://listserv.surfnet.nl/archives/fieldtrip.html > > http://www.ru.nl/fcdonders/fieldtrip/ > > ---------------------------------- > > The aim of this list is to facilitate the discussion between users of the > FieldTrip toolbox, to share experiences and to discuss new ideas for MEG and > EEG analysis. > > http://listserv.surfnet.nl/archives/fieldtrip.html > > http://www.ru.nl/fcdonders/fieldtrip/ > ---------------------------------- The aim of this list is to facilitate the discussion between users of the FieldTrip toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/neuroimaging/fieldtrip. -------------- next part -------------- An HTML attachment was scrubbed... URL: From rajamonis at MAIL.NIH.GOV Thu Nov 26 14:53:36 2009 From: rajamonis at MAIL.NIH.GOV (Rajamoni Nadar, Sreenivasan (NIH/NIMH) [E]) Date: Thu, 26 Nov 2009 08:53:36 -0500 Subject: single trial source signal Message-ID: FieldTrip Users, Is it possible to get single trial source signal using FieldTrip? I would appreciate if anybody could provide code for the same. Thank you, Vasan ---------------------------------- The aim of this list is to facilitate the discussion between users of the FieldTrip toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/neuroimaging/fieldtrip. From Hanneke.vanDijk at MED.UNI-DUESSELDORF.DE Sat Nov 28 22:46:15 2009 From: Hanneke.vanDijk at MED.UNI-DUESSELDORF.DE (Hanneke Van Dijk) Date: Sat, 28 Nov 2009 22:46:15 +0100 Subject: single trial source signal Message-ID: Dear Vasan, You could try doing freqanalysis with cfg.output = 'fourier'; and then sourceanalysis with cfg.method = 'pcc'. If I remember well you should specify cfg.keeptrials = 'yes'; For freqanalysis I used cfg.method = 'mtmfft' ( = without keeping time-information), and cfg.taper = 'hanning'; That should work. If you need more info I should have a look at my scripts so please let me know then! Good luck! Hanneke _______________________ Institute for Clinical Neuroscience and Medical Psychology Heinrich Heine Universitaet, Duesseldorf. -----Oorspronkelijk bericht----- Van: FieldTrip discussion list namens Rajamoni Nadar, Sreenivasan (NIH/NIMH) [E] Verzonden: do 26.11.2009 14:53 Aan: FIELDTRIP at NIC.SURFNET.NL Onderwerp: [FIELDTRIP] single trial source signal FieldTrip Users, Is it possible to get single trial source signal using FieldTrip? I would appreciate if anybody could provide code for the same. Thank you, Vasan ---------------------------------- The aim of this list is to facilitate the discussion between users of the FieldTrip toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/neuroimaging/fieldtrip. ---------------------------------- The aim of this list is to facilitate the discussion between users of the FieldTrip toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/neuroimaging/fieldtrip. From Hanneke.vanDijk at MED.UNI-DUESSELDORF.DE Sun Nov 29 09:38:55 2009 From: Hanneke.vanDijk at MED.UNI-DUESSELDORF.DE (Hanneke Van Dijk) Date: Sun, 29 Nov 2009 09:38:55 +0100 Subject: single trial source signal Message-ID: Dear Vasan, Since I don't know exactly how far you are in doing the analysis, I just send you the basic script that shows the most important parameters. Don't forget to do freqanalysis with cfg.output = 'fourier' and cfg.method = 'mtmfft' for the specific frequency (cfg.foilim) you want to focus on. cfg = []; cfg.grid.pos = location of source coordinate;% [x y z] to fill in cfg.frequency = frequency of interest; cfg.vol = headmodel; %to make yourself see http://fieldtrip.fcdonders.nl/example/make_leadfields_using_different_headmodels cfg.projectnoise = 'yes';%to compute the neural activity index using sourcedescriptives cfg.lambda = '10%';%the amount of noice to estimate estimated cfg.method = 'pcc'; cfg.keeptrials = 'yes'; Virtual_channeldata = sourceanalysis(cfg,freq); You can do sourcedescriptives after that. 'help freqanalysis', 'help sourceanalysis' and 'help sourcedescriptives' should also help you further. Or you could have a look at the fieldtrip website. There are a lot of options to taylor the analysis to your data. Hope this helps! Best, Hanneke van Dijk ------------------------------------------------------------ Institute for Clinical Neuroscience and Medical Psychology Heinrich Heine Universitaet, Duesseldorf, Germany ------------------------------------------------------------ -----Oorspronkelijk bericht----- Van: FieldTrip discussion list namens Rajamoni Nadar, Sreenivasan (NIH/NIMH) [E] Verzonden: do 26.11.2009 14:53 Aan: FIELDTRIP at NIC.SURFNET.NL Onderwerp: [FIELDTRIP] single trial source signal FieldTrip Users, Is it possible to get single trial source signal using FieldTrip? I would appreciate if anybody could provide code for the same. Thank you, Vasan ---------------------------------- The aim of this list is to facilitate the discussion between users of the FieldTrip toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/neuroimaging/fieldtrip. ---------------------------------- The aim of this list is to facilitate the discussion between users of the FieldTrip toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/neuroimaging/fieldtrip. From sreenivasan.r.nadar at GMAIL.COM Mon Nov 30 21:02:13 2009 From: sreenivasan.r.nadar at GMAIL.COM (Sreenivasan Rajamoni Nadar) Date: Mon, 30 Nov 2009 15:02:13 -0500 Subject: single trial source signal In-Reply-To: <72E993C35FB11743B79FF9286E5B6D8B0F3538@Mail2-UKD.VMED.UKD> Message-ID: Dear FieldTrip users, I personally feel that the FieldTrip (latest version) does not seems to having the capability to extract single trial source signals using any of the the time domain beamformers: LCMV, MNE, SAM, LORETA, RV or using the frequency domain beamformer methods like DICS and PCC !! Please let me know if any of you made plugin codes to Fieldtrip to get single trial source data? Robert, Could you let me know if there is any other version which does the above? Thank you, Vasan ---------------------------------- The aim of this list is to facilitate the discussion between users of the FieldTrip toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/neuroimaging/fieldtrip. -------------- next part -------------- An HTML attachment was scrubbed... URL: From s.mohr at PSY.GLA.AC.UK Tue Nov 3 14:30:14 2009 From: s.mohr at PSY.GLA.AC.UK (Sibylle Mohr) Date: Tue, 3 Nov 2009 14:30:14 +0100 Subject: multiplotTFR goes wrong Message-ID: Dear Fieldtrippers, I have a problem concerning multiplotTFR, which I did not have a couple of months ago: I import 4 conditions (lexical match/lexical mismatch and stereotypical match / stereotypical mismatch). After doing a multitaper analysis for different frequencies I do a baseline correction using 'zscore' across the averaged trials for each condition. When I plot the resulting zscore corrected conditions using multiploTFR contrasting 'lexical mismatch' with 'lexical match' and afterwards 'stereotypical mismatch' with 'stereotypical match', it looks like the stereotypical conditions are almost the inverse plot of my lexical conditions. I always clear the cfg before I start a new plot. I also use cfg.interactive = 'yes'. Any ideas why this is happening..? I'll attach the scripts for the multitaper analysis, the baseline correction, and for the plotting. Thanks, Sibylle ----------------------- MULTITAPER ANALYSIS function hifreq_ana % anaphora files: high frequencies % BESA datafiles in one condition filename_ana{1} = { 'An1_sb1_lexmatch-export.dat' 'An1_sb9_lexmatch-export.dat' 'An1_sb13_lexmatch-export.dat' 'An1_sb17_lexmatch-export.dat' 'An1_sb21_lexmatch-export.dat' 'An2_sb2_lexmatch-export.dat' 'An2_sb6_lexmatch-export.dat' 'An2_sb10_lexmatch-export.dat' 'An2_sb18_lexmatch-export.dat' 'An2_sb22_lexmatch-export.dat' 'An3_sb3_lexmatch-export.dat' 'An3_sb7_lexmatch-export.dat' 'An3_sb11_lexmatch-export.dat' 'An3_sb15_lexmatch-export.dat' 'An3_sb23_lexmatch-export.dat' 'An4_sb4_lexmatch-export.dat' 'An4_sb8_lexmatch-export.dat' 'An4_sb12_lexmatch-export.dat' 'An4_sb16_lexmatch-export.dat' 'An4_sb24_lexmatch-export.dat' }; % BESA datafiles in the other condition filename_ana{2} = { 'An1_sb1_lexmis-export.dat' 'An1_sb9_lexmis-export.dat' 'An1_sb13_lexmis-export.dat' 'An1_sb17_lexmis-export.dat' 'An1_sb21_lexmis-export.dat' 'An2_sb2_lexmis-export.dat' 'An2_sb6_lexmis-export.dat' 'An2_sb10_lexmis-export.dat' 'An2_sb18_lexmis-export.dat' 'An2_sb22_lexmis-export.dat' 'An3_sb3_lexmis-export.dat' 'An3_sb7_lexmis-export.dat' 'An3_sb11_lexmis-export.dat' 'An3_sb15_lexmis-export.dat' 'An3_sb23_lexmis-export.dat' 'An4_sb4_lexmis-export.dat' 'An4_sb8_lexmis-export.dat' 'An4_sb12_lexmis-export.dat' 'An4_sb16_lexmis-export.dat' 'An4_sb24_lexmis-export.dat' }; filename_ana{3} = { 'An1_sb1_stermatch-export.dat' 'An1_sb9_stermatch-export.dat' 'An1_sb13_stermatch-export.dat' 'An1_sb17_stermatch-export.dat' 'An1_sb21_stermatch-export.dat' 'An2_sb2_stermatch-export.dat' 'An2_sb6_stermatch-export.dat' 'An2_sb10_stermatch-export.dat' 'An2_sb18_stermatch-export.dat' 'An2_sb22_stermatch-export.dat' 'An3_sb3_stermatch-export.dat' 'An3_sb7_stermatch-export.dat' 'An3_sb11_stermatch-export.dat' 'An3_sb15_stermatch-export.dat' 'An3_sb23_stermatch-export.dat' 'An4_sb4_stermatch-export.dat' 'An4_sb8_stermatch-export.dat' 'An4_sb12_stermatch-export.dat' 'An4_sb16_stermatch-export.dat' 'An4_sb24_stermatch-export.dat' }; % BESA datafiles in the other condition filename_ana{4} = { 'An1_sb1_stermis-export.dat' 'An1_sb9_stermis-export.dat' 'An1_sb13_stermis-export.dat' 'An1_sb17_stermis-export.dat' 'An1_sb21_stermis-export.dat' 'An2_sb2_stermis-export.dat' 'An2_sb6_stermis-export.dat' 'An2_sb10_stermis-export.dat' 'An2_sb18_stermis-export.dat' 'An2_sb22_stermis-export.dat' 'An3_sb3_stermis-export.dat' 'An3_sb7_stermis-export.dat' 'An3_sb11_stermis-export.dat' 'An3_sb15_stermis-export.dat' 'An3_sb23_stermis-export.dat' 'An4_sb4_stermis-export.dat' 'An4_sb8_stermis-export.dat' 'An4_sb12_stermis-export.dat' 'An4_sb16_stermis-export.dat' 'An4_sb24_stermis-export.dat' }; ncond = length(filename_ana); nsubj = length(filename_ana{1}); tmp = importdata('New_elect72.elp'); for j = 1:ncond clear data for i=1:nsubj data = besa2fieldtrip(filename_ana{j}{i}); % % import electrode file and create electrode arrays % % with coordinates in elp file % % match channel and electrode names data.label = tmp.textdata(:,2); clear cfg; cfg.foi = [30:4:130]; numfoi = length(cfg.foi); cfg.t_ftimwin = zeros(1,numfoi); cfg.t_ftimwin(:) = 0.25; cfg.method = 'mtmconvol'; cfg.output = 'pow'; cfg.toi = [-0.5:0.02:1.5]; cfg.taper = 'dpss'; cfg.tapsmofrq = zeros(1,numfoi); cfg.tapsmofrq(:) = 16; cfg.keeptrials = 'yes'; freqhi = freqanalysis(cfg,data); % change from double to single precision to save space on the harddisk single = struct2single(freqhi); save(sprintf('/analyse/12/Project0042/Gender_new/dat- files_multitaper/anaphora/hi_freq_%d_%d.mat',j,i),'single'); clear single end; % subject loop end; % condition loop exit; --------------------------------------- BASELINE CORRECTION SCRIPT function allfreq_zscores name = {'lex','lexmis','ster','stermis'}; ldir = '/analyse/12/Project0042/Gender_new/dat-files_multitaper/'; path = {'anaphora/','cataphora/'}; frq = {'lo','med'}; pathname = {'ana','cat'}; %pathname = {'cat'}; %................. LO AND MEDIUM FREQUENCY ANALYSIS for p = 1:length(path) for f = 1:length(frq) for i = 1:length(name) load(sprintf('%s%s%s_%s.mat',ldir,path{p},frq{f},name{i})); for j = 1:20 if f == 1 if i == 1 freq = freqlo_lexmatch{j}; elseif i == 2 freq = freqlo_lexmis{j}; elseif i == 3 freq = freqlo_stermatch{j}; elseif i == 4 freq = freqlo_stermis{j}; end; elseif f == 2 if i == 1 freq = freqmed_lexmatch{j}; elseif i == 2 freq = freqmed_lexmis{j}; elseif i == 3 freq = freqmed_stermatch{j}; elseif i == 4 freq = freqmed_stermis{j}; end; end; double = struct2double(freq); clear freq; %... check if there is the trial-dimension or not if length(size(double.powspctrm)) == 4 double = freqdescriptives([],double); end; cfg = []; cfg.baseline = [-0.5 0]; cfg.baselinetype = 'zscore'; freq = freqbaseline(cfg,double); clear double freqdes{j} = struct2single(freq); clear freq end; % subject loop save(sprintf('%s%s_%s_z_%s.mat',ldir,pathname{p},frq{f},name{i}),'freqdes'); clear freqdes end; % condition loop end; % frequency loop end; % path loop %.................. HI FREQUENCY ANALYSIS disp('SWITCHING TO HIGH FREQUENCIES') for p = 1:length(path); %two different paths for i = 1:length(name); %four different conditions for j = 1:20 %(length of subjects) tmp=load(sprintf('%s%shi_freq_%d_%d.mat',ldir,path{p},i,j)); % convert to double before starting calculations double = struct2double(tmp.single); clear freq % average across trials using freqdescriptives double = freqdescriptives([],double); % do baseline normalization across the AVERAGED trials (for normalization % over SINGLE trials, switch around freqdescriptives and freqbaseline) clear cfg; cfg.baseline = [-0.5 0]; cfg.baselinetype = 'zscore'; fqhi = freqbaseline(cfg,double); clear double freqdes{j} = struct2single(fqhi); clear fqhi end; % subject loop/ j-loop %save freqdescriptives of 20 subjets (single precision) into one cell-array, and save that %per condition. save(sprintf('%s%s_hi_z_%s.mat',ldir,pathname{p},name{i}),'freqdes'); clear freqdes end; % condition loop / i-loop end; % path loop exit; -------------------------------------- PLOTTING SCRIPT %.................HI FREQUENCY ANALYSIS PLOTS clear all; load(sprintf('cat_hi_z_lex.mat')); hi_lmatch=freqdes; clear freqdes load(sprintf('cat_hi_z_lexmis.mat')); hi_lmis=freqdes; clear freqdes load(sprintf('cat_hi_z_ster.mat')); hi_smatch=freqdes; clear freqdes load(sprintf('cat_hi_z_stermis.mat')); hi_smis=freqdes; clear freqdes clear grandhi1_lexmatch grandhi1_lmis grandhi1_smatch grandhi1_smis; cfg = []; grandhi1_lmatch = freqgrandaverage(cfg, hi_lmatch{:}); grandhi1_lmis = freqgrandaverage(cfg, hi_lmis{:}); grandhi1_smatch = freqgrandaverage(cfg, hi_smatch{:}); grandhi1_smis = freqgrandaverage(cfg, hi_smis{:}); clear avgdif_a; clear avgdif_b; avgdif_a = grandhi1_lmis; avgdif_a.powspctrm = ((grandhi1_lmis.powspctrm - grandhi1_lmatch.powspctrm)./grandhi1_lmatch.powspctrm).*100; avgdif_b = grandhi1_smis; avgdif_b.powspctrm = ((grandhi1_smis.powspctrm - grandhi1_smatch.powspctrm)./grandhi1_smatch.powspctrm).*100; clear cfg; load('elec.mat'); % scale the electrodes to a realistic head size (in cm) elec.pnt = 10*elec.pnt; clear cfg; cfg= []; cfg.elec = elec; cfg.colorbar = 'yes'; cfg.xparam = 'time'; cfg.yparam = 'freq'; cfg.zparam = 'powspctrm'; cfg.showlabels = 'yes'; cfg.layout = 'sibylle.lay'; cfg.interactive = 'yes'; cfg.title = 'lexical_conditions'; cfg.xlim = ([-0.5 1.5]); cfg.ylim = [30 130]; %cfg.zlim = [-50 50]; figure; multiplotTFR(cfg, avgdif_a); title('FreqHi Cata: lexical match vs. mismatch'); clear cfg; cfg= []; cfg.elec = elec; cfg.colorbar = 'yes'; cfg.xparam = 'time'; cfg.yparam = 'freq'; cfg.zparam = 'powspctrm'; cfg.showlabels = 'yes'; cfg.layout = 'sibylle.lay'; cfg.interactive = 'yes'; cfg.title = 'lexical_conditions'; cfg.xlim = ([-0.5 1.5]); cfg.ylim = [30 130]; %cfg.zlim = [-50 50]; figure; multiplotTFR(cfg, avgdif_b); title('FreqHi Cata: stereotypicalmatch vs. mismatch'); -------------------------------- ---------------------------------- The aim of this list is to facilitate the discussion between users of the FieldTrip toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/neuroimaging/fieldtrip. From akiko at NYU.EDU Sun Nov 8 20:30:35 2009 From: akiko at NYU.EDU (Akiko Ikkai) Date: Sun, 8 Nov 2009 14:30:35 -0500 Subject: artifact rejection with limited time period Message-ID: Hello, I'm looking for a way to run rejectvisual on specific time periods without cropping the epochs. We are working on intracranial EEG data, with eye movement parameters (x,y, pupil) added from the eye tracker. Subjects make eye movements to target in the periphery. Our epoch is between [-1.0 2.5] around the onset of the response phase, where subjects are instructed to make eye movements (usually eye movements are detected around .25 to .35 after the onset of the response phase). I'd like to reject trials where subjects made wrong/unnecessary eye movements during the response phase. Currently, I'm running cfg = []; cfg.alim = 6e3; cfg.method = 'channel'; good = rejectvisual(cfg.ft_data); to visualize eye channels, but I'd like to limit the display only to [0 1.5] around the response phase (eye movements during intertrial interval is not much of a problem for now). I don't think it's a good idea to trim data only to this period, considering I'd like to run ERP and TFR on this data. So, is there any commands I can add to limit the display time periods in rejectvisual, but at the end of the day, I can still keep the intact epochs? Thanks in advance! Akiko ---------------------------------- The aim of this list is to facilitate the discussion between users of the FieldTrip toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/neuroimaging/fieldtrip. From rmontefusco at MED.UCHILE.CL Sun Nov 8 22:16:27 2009 From: rmontefusco at MED.UCHILE.CL (Rodrigo A. Montefusco Siegmund) Date: Sun, 8 Nov 2009 18:16:27 -0300 Subject: artifact rejection with limited time period In-Reply-To: <5fe0dcd43968dc.4af6d60b@mail.nyu.edu> Message-ID: Hi try using this command line cfg.latency = [0 1.5]; I hope it helps best regards Rodrigo > Hello, > > I'm looking for a way to run rejectvisual on specific time periods without > cropping the epochs. We are > working on intracranial EEG data, with eye movement parameters (x,y, > pupil) added from the eye > tracker. Subjects make eye movements to target in the periphery. Our epoch > is between [-1.0 2.5] > around the onset of the response phase, where subjects are instructed to > make eye movements > (usually eye movements are detected around .25 to .35 after the onset of > the response phase). > > I'd like to reject trials where subjects made wrong/unnecessary eye > movements during the response > phase. > > Currently, I'm running > cfg = []; > cfg.alim = 6e3; > cfg.method = 'channel'; > good = rejectvisual(cfg.ft_data); > > to visualize eye channels, but I'd like to limit the display only to [0 > 1.5] around the response phase > (eye movements during intertrial interval is not much of a problem for > now). I don't think it's a good > idea to trim data only to this period, considering I'd like to run ERP and > TFR on this data. > > So, is there any commands I can add to limit the display time periods in > rejectvisual, but at the end of > the day, I can still keep the intact epochs? > > Thanks in advance! Akiko > > ---------------------------------- > The aim of this list is to facilitate the discussion between users of the > FieldTrip toolbox, to share experiences and to discuss new ideas for MEG > and EEG analysis. See also > http://listserv.surfnet.nl/archives/fieldtrip.html and > http://www.ru.nl/neuroimaging/fieldtrip. > =================================== Rodrigo A. Montefusco Siegmund Doctorado en Ciencias Biomédicas Programa de Fisiología y Biofí­sica I. C. B. M. Facultad de Medicina Universidad de Chile Fono: 56 09 82793847 email: rmontefusco at med.uchile.cl =================================== ---------------------------------- The aim of this list is to facilitate the discussion between users of the FieldTrip toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/neuroimaging/fieldtrip. From r.oostenveld at FCDONDERS.RU.NL Mon Nov 9 09:22:53 2009 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Mon, 9 Nov 2009 09:22:53 +0100 Subject: multiplotTFR goes wrong In-Reply-To: Message-ID: Dear Sibylle, Your script looks ok, and I don't recall any changes that might relate to the problem that you are describing. Could you try to run the script using an old version of fieldtrip, corresponding to the original date of your analysis? If the old version and new version then indeed produce inconsistent results, you can look at each of the individual steps to pinpoint the step in the analysis where it goes wrong. To help you perform the analysis with an older fieldtrip version, I have copied some old versions onto the ftp server. All versions of fieldtrip-lite-2009??01.zip are now present, i.e. the first day of each month. I hope this goes back enough. best regards, Robert On 3 Nov 2009, at 14:30, Sibylle Mohr wrote: > Dear Fieldtrippers, > > I have a problem concerning multiplotTFR, which I did not have a > couple of months ago: > I import 4 conditions (lexical match/lexical mismatch and > stereotypical match / > stereotypical mismatch). After doing a multitaper analysis for > different frequencies I do a > baseline correction using 'zscore' across the averaged trials for > each condition. When I > plot the resulting zscore corrected conditions using multiploTFR > contrasting 'lexical > mismatch' with 'lexical match' and afterwards 'stereotypical > mismatch' with 'stereotypical > match', it looks like the stereotypical conditions are almost the > inverse plot of my lexical > conditions. I always clear the cfg before I start a new plot. I also > use cfg.interactive = > 'yes'. Any ideas why this is happening..? > > I'll attach the scripts for the multitaper analysis, the baseline > correction, and for the > plotting. > > Thanks, > > Sibylle > > ----------------------- > MULTITAPER ANALYSIS > > function hifreq_ana > > % anaphora files: high frequencies > > % BESA datafiles in one condition > filename_ana{1} = { > 'An1_sb1_lexmatch-export.dat' > 'An1_sb9_lexmatch-export.dat' > 'An1_sb13_lexmatch-export.dat' > 'An1_sb17_lexmatch-export.dat' > 'An1_sb21_lexmatch-export.dat' > 'An2_sb2_lexmatch-export.dat' > 'An2_sb6_lexmatch-export.dat' > 'An2_sb10_lexmatch-export.dat' > 'An2_sb18_lexmatch-export.dat' > 'An2_sb22_lexmatch-export.dat' > 'An3_sb3_lexmatch-export.dat' > 'An3_sb7_lexmatch-export.dat' > 'An3_sb11_lexmatch-export.dat' > 'An3_sb15_lexmatch-export.dat' > 'An3_sb23_lexmatch-export.dat' > 'An4_sb4_lexmatch-export.dat' > 'An4_sb8_lexmatch-export.dat' > 'An4_sb12_lexmatch-export.dat' > 'An4_sb16_lexmatch-export.dat' > 'An4_sb24_lexmatch-export.dat' > }; > > > % BESA datafiles in the other condition > filename_ana{2} = { > 'An1_sb1_lexmis-export.dat' > 'An1_sb9_lexmis-export.dat' > 'An1_sb13_lexmis-export.dat' > 'An1_sb17_lexmis-export.dat' > 'An1_sb21_lexmis-export.dat' > 'An2_sb2_lexmis-export.dat' > 'An2_sb6_lexmis-export.dat' > 'An2_sb10_lexmis-export.dat' > 'An2_sb18_lexmis-export.dat' > 'An2_sb22_lexmis-export.dat' > 'An3_sb3_lexmis-export.dat' > 'An3_sb7_lexmis-export.dat' > 'An3_sb11_lexmis-export.dat' > 'An3_sb15_lexmis-export.dat' > 'An3_sb23_lexmis-export.dat' > 'An4_sb4_lexmis-export.dat' > 'An4_sb8_lexmis-export.dat' > 'An4_sb12_lexmis-export.dat' > 'An4_sb16_lexmis-export.dat' > 'An4_sb24_lexmis-export.dat' > }; > > filename_ana{3} = { > 'An1_sb1_stermatch-export.dat' > 'An1_sb9_stermatch-export.dat' > 'An1_sb13_stermatch-export.dat' > 'An1_sb17_stermatch-export.dat' > 'An1_sb21_stermatch-export.dat' > 'An2_sb2_stermatch-export.dat' > 'An2_sb6_stermatch-export.dat' > 'An2_sb10_stermatch-export.dat' > 'An2_sb18_stermatch-export.dat' > 'An2_sb22_stermatch-export.dat' > 'An3_sb3_stermatch-export.dat' > 'An3_sb7_stermatch-export.dat' > 'An3_sb11_stermatch-export.dat' > 'An3_sb15_stermatch-export.dat' > 'An3_sb23_stermatch-export.dat' > 'An4_sb4_stermatch-export.dat' > 'An4_sb8_stermatch-export.dat' > 'An4_sb12_stermatch-export.dat' > 'An4_sb16_stermatch-export.dat' > 'An4_sb24_stermatch-export.dat' > }; > > > % BESA datafiles in the other condition > filename_ana{4} = { > 'An1_sb1_stermis-export.dat' > 'An1_sb9_stermis-export.dat' > 'An1_sb13_stermis-export.dat' > 'An1_sb17_stermis-export.dat' > 'An1_sb21_stermis-export.dat' > 'An2_sb2_stermis-export.dat' > 'An2_sb6_stermis-export.dat' > 'An2_sb10_stermis-export.dat' > 'An2_sb18_stermis-export.dat' > 'An2_sb22_stermis-export.dat' > 'An3_sb3_stermis-export.dat' > 'An3_sb7_stermis-export.dat' > 'An3_sb11_stermis-export.dat' > 'An3_sb15_stermis-export.dat' > 'An3_sb23_stermis-export.dat' > 'An4_sb4_stermis-export.dat' > 'An4_sb8_stermis-export.dat' > 'An4_sb12_stermis-export.dat' > 'An4_sb16_stermis-export.dat' > 'An4_sb24_stermis-export.dat' > }; > > ncond = length(filename_ana); > nsubj = length(filename_ana{1}); > > > tmp = importdata('New_elect72.elp'); > > for j = 1:ncond > clear data > > for i=1:nsubj > data = besa2fieldtrip(filename_ana{j}{i}); > % % import electrode file and create electrode arrays > % % with coordinates in elp file > % % match channel and electrode names > data.label = tmp.textdata(:,2); > > clear cfg; > cfg.foi = [30:4:130]; > numfoi = length(cfg.foi); > cfg.t_ftimwin = zeros(1,numfoi); > cfg.t_ftimwin(:) = 0.25; > cfg.method = 'mtmconvol'; > cfg.output = 'pow'; > cfg.toi = [-0.5:0.02:1.5]; > cfg.taper = 'dpss'; > cfg.tapsmofrq = zeros(1,numfoi); > cfg.tapsmofrq(:) = 16; > cfg.keeptrials = 'yes'; > > freqhi = freqanalysis(cfg,data); > % change from double to single precision to save space on the harddisk > single = struct2single(freqhi); > save(sprintf('/analyse/12/Project0042/Gender_new/dat- > files_multitaper/anaphora/hi_freq_%d_%d.mat',j,i),'single'); > clear single > > end; % subject loop > end; % condition loop > exit; > --------------------------------------- > > BASELINE CORRECTION SCRIPT > > function allfreq_zscores > > name = {'lex','lexmis','ster','stermis'}; > ldir = '/analyse/12/Project0042/Gender_new/dat-files_multitaper/'; > path = {'anaphora/','cataphora/'}; > > frq = {'lo','med'}; > pathname = {'ana','cat'}; > %pathname = {'cat'}; > %................. LO AND MEDIUM FREQUENCY ANALYSIS > > for p = 1:length(path) > for f = 1:length(frq) > for i = 1:length(name) > load(sprintf('%s%s%s_%s.mat',ldir,path{p},frq{f},name{i})); > for j = 1:20 > if f == 1 > if i == 1 > freq = freqlo_lexmatch{j}; > elseif i == 2 > freq = freqlo_lexmis{j}; > elseif i == 3 > freq = freqlo_stermatch{j}; > elseif i == 4 > freq = freqlo_stermis{j}; > end; > elseif f == 2 > if i == 1 > freq = freqmed_lexmatch{j}; > elseif i == 2 > freq = freqmed_lexmis{j}; > elseif i == 3 > freq = freqmed_stermatch{j}; > elseif i == 4 > freq = freqmed_stermis{j}; > end; > end; > > double = struct2double(freq); > clear freq; > > %... check if there is the trial-dimension or not > if length(size(double.powspctrm)) == 4 > double = freqdescriptives([],double); > end; > > cfg = []; > cfg.baseline = [-0.5 0]; > cfg.baselinetype = 'zscore'; > freq = freqbaseline(cfg,double); > clear double > > freqdes{j} = struct2single(freq); > clear freq > end; % subject loop > save(sprintf('%s%s_%s_z_ > %s.mat',ldir,pathname{p},frq{f},name{i}),'freqdes'); > clear freqdes > end; % condition loop > end; % frequency loop > end; % path loop > > %.................. HI FREQUENCY ANALYSIS > > disp('SWITCHING TO HIGH FREQUENCIES') > > for p = 1:length(path); %two different paths > for i = 1:length(name); %four different conditions > for j = 1:20 %(length of subjects) > tmp=load(sprintf('%s%shi_freq_%d_%d.mat',ldir,path{p},i,j)); > > % convert to double before starting calculations > double = struct2double(tmp.single); > clear freq > > % average across trials using freqdescriptives > double = freqdescriptives([],double); > > % do baseline normalization across the AVERAGED trials (for > normalization > % over SINGLE trials, switch around freqdescriptives and freqbaseline) > clear cfg; > cfg.baseline = [-0.5 0]; > cfg.baselinetype = 'zscore'; > fqhi = freqbaseline(cfg,double); > clear double > > freqdes{j} = struct2single(fqhi); > clear fqhi > end; % subject loop/ j-loop > %save freqdescriptives of 20 subjets (single precision) into one > cell-array, and save that > %per condition. > save(sprintf('%s%s_hi_z_%s.mat',ldir,pathname{p},name{i}),'freqdes'); > clear freqdes > end; % condition loop / i-loop > end; % path loop > exit; > > -------------------------------------- > > PLOTTING SCRIPT > > %.................HI FREQUENCY ANALYSIS PLOTS > > clear all; > load(sprintf('cat_hi_z_lex.mat')); > hi_lmatch=freqdes; > clear freqdes > > load(sprintf('cat_hi_z_lexmis.mat')); > hi_lmis=freqdes; > clear freqdes > > load(sprintf('cat_hi_z_ster.mat')); > hi_smatch=freqdes; > clear freqdes > > load(sprintf('cat_hi_z_stermis.mat')); > hi_smis=freqdes; > clear freqdes > > > clear grandhi1_lexmatch grandhi1_lmis grandhi1_smatch grandhi1_smis; > cfg = []; > grandhi1_lmatch = freqgrandaverage(cfg, hi_lmatch{:}); > grandhi1_lmis = freqgrandaverage(cfg, hi_lmis{:}); > grandhi1_smatch = freqgrandaverage(cfg, hi_smatch{:}); > grandhi1_smis = freqgrandaverage(cfg, hi_smis{:}); > > clear avgdif_a; > clear avgdif_b; > avgdif_a = grandhi1_lmis; > avgdif_a.powspctrm = ((grandhi1_lmis.powspctrm - > grandhi1_lmatch.powspctrm)./grandhi1_lmatch.powspctrm).*100; > > avgdif_b = grandhi1_smis; > avgdif_b.powspctrm = ((grandhi1_smis.powspctrm - > grandhi1_smatch.powspctrm)./grandhi1_smatch.powspctrm).*100; > > clear cfg; > load('elec.mat'); > % scale the electrodes to a realistic head size (in cm) > elec.pnt = 10*elec.pnt; > clear cfg; > cfg= []; > cfg.elec = elec; > cfg.colorbar = 'yes'; > cfg.xparam = 'time'; > cfg.yparam = 'freq'; > cfg.zparam = 'powspctrm'; > cfg.showlabels = 'yes'; > cfg.layout = 'sibylle.lay'; > cfg.interactive = 'yes'; > cfg.title = 'lexical_conditions'; > cfg.xlim = ([-0.5 1.5]); > cfg.ylim = [30 130]; > %cfg.zlim = [-50 50]; > figure; multiplotTFR(cfg, avgdif_a); > title('FreqHi Cata: lexical match vs. mismatch'); > > clear cfg; > cfg= []; > cfg.elec = elec; > cfg.colorbar = 'yes'; > cfg.xparam = 'time'; > cfg.yparam = 'freq'; > cfg.zparam = 'powspctrm'; > cfg.showlabels = 'yes'; > cfg.layout = 'sibylle.lay'; > cfg.interactive = 'yes'; > cfg.title = 'lexical_conditions'; > cfg.xlim = ([-0.5 1.5]); > cfg.ylim = [30 130]; > %cfg.zlim = [-50 50]; > figure; multiplotTFR(cfg, avgdif_b); > title('FreqHi Cata: stereotypicalmatch vs. mismatch'); > -------------------------------- > > ---------------------------------- > The aim of this list is to facilitate the discussion between users > of the FieldTrip toolbox, to share experiences and to discuss new > ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html > and http://www.ru.nl/neuroimaging/fieldtrip. > ---------------------------------- The aim of this list is to facilitate the discussion between users of the FieldTrip toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/neuroimaging/fieldtrip. From s.mohr at PSY.GLA.AC.UK Mon Nov 9 13:37:45 2009 From: s.mohr at PSY.GLA.AC.UK (sibylle) Date: Mon, 9 Nov 2009 12:37:45 +0000 Subject: multiplotTFR goes wrong In-Reply-To: <599BA806-FDC8-4695-AF49-E9028B727CBF@fcdonders.ru.nl> Message-ID: Dear Robert, thanks a lot for your reply! As you suggested, I will give it a try with an old fieldtrip version. Cheers & best wishes, Sibylle On 9 Nov 2009, at 08:22, Robert Oostenveld wrote: > Dear Sibylle, > > Your script looks ok, and I don't recall any changes that might > relate to the problem that you are describing. Could you try to run > the script using an old version of fieldtrip, corresponding to the > original date of your analysis? If the old version and new version > then indeed produce inconsistent results, you can look at each of > the individual steps to pinpoint the step in the analysis where it > goes wrong. > > To help you perform the analysis with an older fieldtrip version, I > have copied some old versions onto the ftp server. All versions of > fieldtrip-lite-2009??01.zip are now present, i.e. the first day of > each month. I hope this goes back enough. > > best regards, > Robert > > > On 3 Nov 2009, at 14:30, Sibylle Mohr wrote: > >> Dear Fieldtrippers, >> >> I have a problem concerning multiplotTFR, which I did not have a >> couple of months ago: >> I import 4 conditions (lexical match/lexical mismatch and >> stereotypical match / >> stereotypical mismatch). After doing a multitaper analysis for >> different frequencies I do a >> baseline correction using 'zscore' across the averaged trials for >> each condition. When I >> plot the resulting zscore corrected conditions using multiploTFR >> contrasting 'lexical >> mismatch' with 'lexical match' and afterwards 'stereotypical >> mismatch' with 'stereotypical >> match', it looks like the stereotypical conditions are almost the >> inverse plot of my lexical >> conditions. I always clear the cfg before I start a new plot. I >> also use cfg.interactive = >> 'yes'. Any ideas why this is happening..? >> >> I'll attach the scripts for the multitaper analysis, the baseline >> correction, and for the >> plotting. >> >> Thanks, >> >> Sibylle >> >> ----------------------- >> MULTITAPER ANALYSIS >> >> function hifreq_ana >> >> % anaphora files: high frequencies >> >> % BESA datafiles in one condition >> filename_ana{1} = { >> 'An1_sb1_lexmatch-export.dat' >> 'An1_sb9_lexmatch-export.dat' >> 'An1_sb13_lexmatch-export.dat' >> 'An1_sb17_lexmatch-export.dat' >> 'An1_sb21_lexmatch-export.dat' >> 'An2_sb2_lexmatch-export.dat' >> 'An2_sb6_lexmatch-export.dat' >> 'An2_sb10_lexmatch-export.dat' >> 'An2_sb18_lexmatch-export.dat' >> 'An2_sb22_lexmatch-export.dat' >> 'An3_sb3_lexmatch-export.dat' >> 'An3_sb7_lexmatch-export.dat' >> 'An3_sb11_lexmatch-export.dat' >> 'An3_sb15_lexmatch-export.dat' >> 'An3_sb23_lexmatch-export.dat' >> 'An4_sb4_lexmatch-export.dat' >> 'An4_sb8_lexmatch-export.dat' >> 'An4_sb12_lexmatch-export.dat' >> 'An4_sb16_lexmatch-export.dat' >> 'An4_sb24_lexmatch-export.dat' >> }; >> >> >> % BESA datafiles in the other condition >> filename_ana{2} = { >> 'An1_sb1_lexmis-export.dat' >> 'An1_sb9_lexmis-export.dat' >> 'An1_sb13_lexmis-export.dat' >> 'An1_sb17_lexmis-export.dat' >> 'An1_sb21_lexmis-export.dat' >> 'An2_sb2_lexmis-export.dat' >> 'An2_sb6_lexmis-export.dat' >> 'An2_sb10_lexmis-export.dat' >> 'An2_sb18_lexmis-export.dat' >> 'An2_sb22_lexmis-export.dat' >> 'An3_sb3_lexmis-export.dat' >> 'An3_sb7_lexmis-export.dat' >> 'An3_sb11_lexmis-export.dat' >> 'An3_sb15_lexmis-export.dat' >> 'An3_sb23_lexmis-export.dat' >> 'An4_sb4_lexmis-export.dat' >> 'An4_sb8_lexmis-export.dat' >> 'An4_sb12_lexmis-export.dat' >> 'An4_sb16_lexmis-export.dat' >> 'An4_sb24_lexmis-export.dat' >> }; >> >> filename_ana{3} = { >> 'An1_sb1_stermatch-export.dat' >> 'An1_sb9_stermatch-export.dat' >> 'An1_sb13_stermatch-export.dat' >> 'An1_sb17_stermatch-export.dat' >> 'An1_sb21_stermatch-export.dat' >> 'An2_sb2_stermatch-export.dat' >> 'An2_sb6_stermatch-export.dat' >> 'An2_sb10_stermatch-export.dat' >> 'An2_sb18_stermatch-export.dat' >> 'An2_sb22_stermatch-export.dat' >> 'An3_sb3_stermatch-export.dat' >> 'An3_sb7_stermatch-export.dat' >> 'An3_sb11_stermatch-export.dat' >> 'An3_sb15_stermatch-export.dat' >> 'An3_sb23_stermatch-export.dat' >> 'An4_sb4_stermatch-export.dat' >> 'An4_sb8_stermatch-export.dat' >> 'An4_sb12_stermatch-export.dat' >> 'An4_sb16_stermatch-export.dat' >> 'An4_sb24_stermatch-export.dat' >> }; >> >> >> % BESA datafiles in the other condition >> filename_ana{4} = { >> 'An1_sb1_stermis-export.dat' >> 'An1_sb9_stermis-export.dat' >> 'An1_sb13_stermis-export.dat' >> 'An1_sb17_stermis-export.dat' >> 'An1_sb21_stermis-export.dat' >> 'An2_sb2_stermis-export.dat' >> 'An2_sb6_stermis-export.dat' >> 'An2_sb10_stermis-export.dat' >> 'An2_sb18_stermis-export.dat' >> 'An2_sb22_stermis-export.dat' >> 'An3_sb3_stermis-export.dat' >> 'An3_sb7_stermis-export.dat' >> 'An3_sb11_stermis-export.dat' >> 'An3_sb15_stermis-export.dat' >> 'An3_sb23_stermis-export.dat' >> 'An4_sb4_stermis-export.dat' >> 'An4_sb8_stermis-export.dat' >> 'An4_sb12_stermis-export.dat' >> 'An4_sb16_stermis-export.dat' >> 'An4_sb24_stermis-export.dat' >> }; >> >> ncond = length(filename_ana); >> nsubj = length(filename_ana{1}); >> >> >> tmp = importdata('New_elect72.elp'); >> >> for j = 1:ncond >> clear data >> >> for i=1:nsubj >> data = besa2fieldtrip(filename_ana{j}{i}); >> % % import electrode file and create electrode arrays >> % % with coordinates in elp file >> % % match channel and electrode names >> data.label = tmp.textdata(:,2); >> >> clear cfg; >> cfg.foi = [30:4:130]; >> numfoi = length(cfg.foi); >> cfg.t_ftimwin = zeros(1,numfoi); >> cfg.t_ftimwin(:) = 0.25; >> cfg.method = 'mtmconvol'; >> cfg.output = 'pow'; >> cfg.toi = [-0.5:0.02:1.5]; >> cfg.taper = 'dpss'; >> cfg.tapsmofrq = zeros(1,numfoi); >> cfg.tapsmofrq(:) = 16; >> cfg.keeptrials = 'yes'; >> >> freqhi = freqanalysis(cfg,data); >> % change from double to single precision to save space on the >> harddisk >> single = struct2single(freqhi); >> save(sprintf('/analyse/12/Project0042/Gender_new/dat- >> files_multitaper/anaphora/hi_freq_%d_%d.mat',j,i),'single'); >> clear single >> >> end; % subject loop >> end; % condition loop >> exit; >> --------------------------------------- >> >> BASELINE CORRECTION SCRIPT >> >> function allfreq_zscores >> >> name = {'lex','lexmis','ster','stermis'}; >> ldir = '/analyse/12/Project0042/Gender_new/dat-files_multitaper/'; >> path = {'anaphora/','cataphora/'}; >> >> frq = {'lo','med'}; >> pathname = {'ana','cat'}; >> %pathname = {'cat'}; >> %................. LO AND MEDIUM FREQUENCY ANALYSIS >> >> for p = 1:length(path) >> for f = 1:length(frq) >> for i = 1:length(name) >> load(sprintf('%s%s%s_%s.mat',ldir,path{p},frq{f},name{i})); >> for j = 1:20 >> if f == 1 >> if i == 1 >> freq = freqlo_lexmatch{j}; >> elseif i == 2 >> freq = freqlo_lexmis{j}; >> elseif i == 3 >> freq = freqlo_stermatch{j}; >> elseif i == 4 >> freq = freqlo_stermis{j}; >> end; >> elseif f == 2 >> if i == 1 >> freq = freqmed_lexmatch{j}; >> elseif i == 2 >> freq = freqmed_lexmis{j}; >> elseif i == 3 >> freq = freqmed_stermatch{j}; >> elseif i == 4 >> freq = freqmed_stermis{j}; >> end; >> end; >> >> double = struct2double(freq); >> clear freq; >> >> %... check if there is the trial-dimension or not >> if length(size(double.powspctrm)) == 4 >> double = freqdescriptives([],double); >> end; >> >> cfg = []; >> cfg.baseline = [-0.5 0]; >> cfg.baselinetype = 'zscore'; >> freq = freqbaseline(cfg,double); >> clear double >> >> freqdes{j} = struct2single(freq); >> clear freq >> end; % subject loop >> save(sprintf('%s%s_%s_z_ >> %s.mat',ldir,pathname{p},frq{f},name{i}),'freqdes'); >> clear freqdes >> end; % condition loop >> end; % frequency loop >> end; % path loop >> >> %.................. HI FREQUENCY ANALYSIS >> >> disp('SWITCHING TO HIGH FREQUENCIES') >> >> for p = 1:length(path); %two different paths >> for i = 1:length(name); %four different conditions >> for j = 1:20 %(length of subjects) >> tmp=load(sprintf('%s%shi_freq_%d_%d.mat',ldir,path{p},i,j)); >> >> % convert to double before starting calculations >> double = struct2double(tmp.single); >> clear freq >> >> % average across trials using freqdescriptives >> double = freqdescriptives([],double); >> >> % do baseline normalization across the AVERAGED trials (for >> normalization >> % over SINGLE trials, switch around freqdescriptives and >> freqbaseline) >> clear cfg; >> cfg.baseline = [-0.5 0]; >> cfg.baselinetype = 'zscore'; >> fqhi = freqbaseline(cfg,double); >> clear double >> >> freqdes{j} = struct2single(fqhi); >> clear fqhi >> end; % subject loop/ j-loop >> %save freqdescriptives of 20 subjets (single precision) into one >> cell-array, and save that >> %per condition. >> save(sprintf('%s%s_hi_z_%s.mat',ldir,pathname{p},name{i}),'freqdes'); >> clear freqdes >> end; % condition loop / i-loop >> end; % path loop >> exit; >> >> -------------------------------------- >> >> PLOTTING SCRIPT >> >> %.................HI FREQUENCY ANALYSIS PLOTS >> >> clear all; >> load(sprintf('cat_hi_z_lex.mat')); >> hi_lmatch=freqdes; >> clear freqdes >> >> load(sprintf('cat_hi_z_lexmis.mat')); >> hi_lmis=freqdes; >> clear freqdes >> >> load(sprintf('cat_hi_z_ster.mat')); >> hi_smatch=freqdes; >> clear freqdes >> >> load(sprintf('cat_hi_z_stermis.mat')); >> hi_smis=freqdes; >> clear freqdes >> >> >> clear grandhi1_lexmatch grandhi1_lmis grandhi1_smatch grandhi1_smis; >> cfg = []; >> grandhi1_lmatch = freqgrandaverage(cfg, hi_lmatch{:}); >> grandhi1_lmis = freqgrandaverage(cfg, hi_lmis{:}); >> grandhi1_smatch = freqgrandaverage(cfg, hi_smatch{:}); >> grandhi1_smis = freqgrandaverage(cfg, hi_smis{:}); >> >> clear avgdif_a; >> clear avgdif_b; >> avgdif_a = grandhi1_lmis; >> avgdif_a.powspctrm = ((grandhi1_lmis.powspctrm - >> grandhi1_lmatch.powspctrm)./grandhi1_lmatch.powspctrm).*100; >> >> avgdif_b = grandhi1_smis; >> avgdif_b.powspctrm = ((grandhi1_smis.powspctrm - >> grandhi1_smatch.powspctrm)./grandhi1_smatch.powspctrm).*100; >> >> clear cfg; >> load('elec.mat'); >> % scale the electrodes to a realistic head size (in cm) >> elec.pnt = 10*elec.pnt; >> clear cfg; >> cfg= []; >> cfg.elec = elec; >> cfg.colorbar = 'yes'; >> cfg.xparam = 'time'; >> cfg.yparam = 'freq'; >> cfg.zparam = 'powspctrm'; >> cfg.showlabels = 'yes'; >> cfg.layout = 'sibylle.lay'; >> cfg.interactive = 'yes'; >> cfg.title = 'lexical_conditions'; >> cfg.xlim = ([-0.5 1.5]); >> cfg.ylim = [30 130]; >> %cfg.zlim = [-50 50]; >> figure; multiplotTFR(cfg, avgdif_a); >> title('FreqHi Cata: lexical match vs. mismatch'); >> >> clear cfg; >> cfg= []; >> cfg.elec = elec; >> cfg.colorbar = 'yes'; >> cfg.xparam = 'time'; >> cfg.yparam = 'freq'; >> cfg.zparam = 'powspctrm'; >> cfg.showlabels = 'yes'; >> cfg.layout = 'sibylle.lay'; >> cfg.interactive = 'yes'; >> cfg.title = 'lexical_conditions'; >> cfg.xlim = ([-0.5 1.5]); >> cfg.ylim = [30 130]; >> %cfg.zlim = [-50 50]; >> figure; multiplotTFR(cfg, avgdif_b); >> title('FreqHi Cata: stereotypicalmatch vs. mismatch'); >> -------------------------------- >> >> ---------------------------------- >> The aim of this list is to facilitate the discussion between users >> of the FieldTrip toolbox, to share experiences and to discuss new >> ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html >> and http://www.ru.nl/neuroimaging/fieldtrip. >> > > ---------------------------------- > The aim of this list is to facilitate the discussion between users > of the FieldTrip toolbox, to share experiences and to discuss new > ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html > and http://www.ru.nl/neuroimaging/fieldtrip. ---------------------------------- The aim of this list is to facilitate the discussion between users of the FieldTrip toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/neuroimaging/fieldtrip. From a.stolk at FCDONDERS.RU.NL Tue Nov 10 17:39:49 2009 From: a.stolk at FCDONDERS.RU.NL (a.stolk@fcdonders.ru.nl) Date: Tue, 10 Nov 2009 17:39:49 +0100 Subject: data.label wrong after componentanalysis? In-Reply-To: <21188527.945751257871085522.JavaMail.root@watertor.uci.ru.nl> Message-ID: Hi Nathan, I managed to simulate your problem. The intersect function does indeed find matching labels (desired) and then orders those alphabetically (undesired). The most practical solution is to use 'match_str' which only matches the channelindices and, thus, does not give back your labelarray in alphabetical order. For example; [ai, bi] = match_str(a, b) with a = [1 2 3 4] (here in numbers, but should be strings) and b = [3 2] gives ai = [2 3] and bi = [2 1] I therefore replaced cfg.channel = intersect(cfg.channel, cfg.topolabel); with tmpchan = match_str(cfg.channel, cfg.topolabel); cfg.channel = cfg.channel(tmpchan); and everything worked fine here: data.cfg.channel = tmpcomp.cfg.channel. You'll find this replacement in tomorrow's version of FT. Thanks for your clear explanation and please let me know if these changes appear to be problematic to your analysis. Friendly regards, Arjen ----- Original Message ----- From: "Nathan Weisz" To: FIELDTRIP at NIC.SURFNET.NL Sent: Monday, October 26, 2009 9:17:31 PM GMT +01:00 Amsterdam / Berlin / Bern / Rome / Stockholm / Vienna Subject: [FIELDTRIP] data.label wrong after componentanalysis? hi everyone, for an analysis of EEG data i'm doing some ICA cleaning. since there are many conditions / epochs, i do the ICA on a subset of trials and then apply the calculated mixing matrix to the individual conditions. i noticed (and i'm quite sure it's no user related error) that after rejecting components and reconstructing the preprocessing data structure, that the sequence in data.label has changed (apparently into alphabetical order). however that rows in the 2-D matrices making up data.trial(xy) have not changed, accordingly. i noticed because the topography of the auditory N1 was a huge mess. changing the labels solved the problem, i.e.: ica_cleaned_data.label = data_before_ica_cleaning.label; for those interested here the original code: load([outdir '/dataB1F1.mat'], 'dataB1F1') %load data for one condition cfg=[]; cfg.topo=comp.topo; cfg.topolabel=comp.topolabel; tmpcomp=componentanalysis(cfg,dataB1F1); %apply precomputed ICA to condition cfg=[]; cfg.component=ncmp; dataB1F1=rejectcomponent(cfg, tmpcomp); %reject components obviously representing artefacts >> [comp.cfg.channel(1:5) tmpcomp.cfg.channel(1:5)] %demonstrate channel label mismatch ans = 'Lm' 'L1' 'LE1' 'L10' 'LE2' 'L11' 'LE3' 'L12' 'LD2' 'L13' the crucial line appears to be in componentanalysis line 220: cfg.channel = intersect(cfg.channel, cfg.topolabel); intersect sorts the outcome: >> a=randperm(10) a = 7 1 9 3 6 2 5 4 10 8 >> b=randperm(10) b = 6 3 5 1 8 2 10 4 9 7 >> intersect(a,b) ans = 1 2 3 4 5 6 7 8 9 10 since i use all channels, simply replacing the label-field with the original label-field works for me. best, nathan ---------------------------------- The aim of this list is to facilitate the discussion between users of the FieldTrip toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/neuroimaging/fieldtrip. ---------------------------------- The aim of this list is to facilitate the discussion between users of the FieldTrip toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/neuroimaging/fieldtrip. From joseph.brooks at UCL.AC.UK Fri Nov 13 22:21:57 2009 From: joseph.brooks at UCL.AC.UK (Joseph Brooks) Date: Fri, 13 Nov 2009 21:21:57 +0000 Subject: BDF file problems Message-ID: I'm new to Fieldtrip. I am working with Biosemi data (BDF file format). I've come across a problem when defining trials. I've come up with a work-around but I'm interested in whether others have encountered this problem and I want to alert the fieldtrip developers of this potential problem. I've tried it on several BDF files. Here is an example of my input and the error... cfgSSVEP = []; cfgSSVEP.dataset = [pathname,filename]; cfgSSVEP.trialdef.eventtype = 'STATUS'; cfgSSVEP.trialdef.eventvalue = {'21' '22'}; cfgSSVEP.trialdef.prestim = 1; cfgSSVEP.trialdef.poststim = 16; cfgSSVEP.dataset = [pathname,filename]; cfgSSVEP = definetrial(cfgSSVEP); cfgSSVEP.padding = 0; cfgSSVEP.continuous = 'yes'; evaluating trialfunction 'trialfun_general' Warning: Out of range value or NaN computed in integer arithmetic. > In read_event at 281 In trialfun_general at 50 In definetrial at 139 ??? Error using ==> cellstr at 34 Input must be a string. Error in ==> cell.intersect at 44 a = cellstr(a); Error in ==> trialfun_general at 104 elseif ~isempty(intersect(event(i).value, cfg.trialdef.eventvalue)) Error in ==> definetrial at 139 [trl, event] = feval(cfg.trialfun, cfg); ************* I've managed to "fix" the problem by changing line 104 in trialfun_general to: elseif ~isempty(intersect(num2str(event(i).value), cfg.trialdef.eventvalue)) Any feedback will be much appreciated... ---------------------------------- The aim of this list is to facilitate the discussion between users of the FieldTrip toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/neuroimaging/fieldtrip. From nelsonmj at CALTECH.EDU Mon Nov 16 22:46:12 2009 From: nelsonmj at CALTECH.EDU (Matthew Nelson) Date: Mon, 16 Nov 2009 22:46:12 +0100 Subject: Question about nonparametric statistical testing of coherence differences Message-ID: My question involves a situation in which one is comparing the coherence between two signals in two different conditions, and the coherence is generally high in both conditions, but we would like to say that the coherence is higher in one condition than the other. After some thought about this issue, I wonder if shuffling trials between the two conditions allows for a fair comparison to be made to the coherence in the raw data? For example, if a pair of signals has different relative phases in the two conditions, the overall coherence that exists in both conditions will be decreased by the trial shuffling. It’s also conceivable, though perhaps less likely, that the condition-shuffled data could have more coherence than either condition alone. In either case, the distribution of the cluster statistics of the coherence differences in the condition-shuffled data would certainly provide some sort of estimate of a null distribution of the coherence difference that does uses the actual data, but since the overall coherence values of the condition-shuffled and raw data could be so different, is it fair to say that this is a null distribution of the difference in coherence between the unshuffled conditions? If you have the time to respond, I’m curious to know what your thoughts are regarding this issue and specifically in a situation in which it is necessary to assess significance on one session. Performing the clustering and shuffling of coherence values across sessions obviously avoids this problem. For a test within a session, I wonder if it would be possible to use a bootstrapping or jackknife method combined with clustering to get a fair estimate of the variability of the cluster level statistics and perform hypothesis tests using that. ---------------------------------- The aim of this list is to facilitate the discussion between users of the FieldTrip toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/neuroimaging/fieldtrip. From adrian.m.bartlett at GMAIL.COM Mon Nov 16 23:44:53 2009 From: adrian.m.bartlett at GMAIL.COM (Adrian Bartlett) Date: Mon, 16 Nov 2009 17:44:53 -0500 Subject: Question about nonparametric statistical testing of coherence differences In-Reply-To: Message-ID: Hi Matthew, While It'll take me a bit to think about the single-condition case, you've definitely got the right idea for the condition contrast. The condition-shuffled surrogate data is in fact the null distribution for the H0: condition 1 = condition 2. Someone please correct me if I'm mistaken. Adrian M. Bartlett Perception & Plasticity Laboratory (http://www.yorku.ca/khoffman) Graduate Program in Psychology Neuroscience Graduate Diploma Program Centre for Vision Research York University Toronto, Ontario, Canada (416)736-2100x20997 adrianmb at yorku.ca On Mon, Nov 16, 2009 at 4:46 PM, Matthew Nelson wrote: > My question involves a situation in which one is comparing the coherence > between two signals in two different conditions, and the coherence is > generally high in both conditions, but we would like to say that the > coherence is higher in one condition than the other. After some > thought about this issue, I wonder if shuffling trials between the two > conditions allows for a fair comparison to be made to the coherence in > the raw data? For example, if a pair of signals has different relative > phases in the two conditions, the overall coherence that exists in > both conditions will be decreased by the trial shuffling. It’s also > conceivable, though perhaps less likely, that the condition-shuffled > data could have more coherence than either condition alone. In either > case, the distribution of the cluster statistics of the coherence > differences in the condition-shuffled data would certainly provide > some sort of estimate of a null distribution of the coherence > difference that does uses the actual data, but since the overall > coherence values of the condition-shuffled and raw data could be so > different, is it fair to say that this is a null distribution of the > difference in coherence between the unshuffled conditions? > > > If you have the time to respond, I’m curious to know what your > thoughts are regarding this issue and specifically in a situation in > which it is necessary to assess significance on one session. > Performing the clustering and shuffling of coherence values across > sessions obviously avoids this problem. For a test within a session, I > wonder if it would be possible to use a bootstrapping or jackknife > method combined with clustering to get a fair estimate of the > variability of the cluster level statistics and perform hypothesis > tests using that. > > ---------------------------------- > The aim of this list is to facilitate the discussion between users of the > FieldTrip toolbox, to share experiences and to discuss new ideas for MEG > and EEG analysis. See also > http://listserv.surfnet.nl/archives/fieldtrip.html and > http://www.ru.nl/neuroimaging/fieldtrip. > ---------------------------------- The aim of this list is to facilitate the discussion between users of the FieldTrip toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/neuroimaging/fieldtrip. -------------- next part -------------- An HTML attachment was scrubbed... URL: From e.maris at DONDERS.RU.NL Tue Nov 17 10:36:03 2009 From: e.maris at DONDERS.RU.NL (Eric Maris) Date: Tue, 17 Nov 2009 10:36:03 +0100 Subject: Question about nonparametric statistical testing of coherence differences In-Reply-To: Message-ID: Dear Matthew, Your questions relate to the core concepts behind statistical inference based on permutation. > My question involves a situation in which one is comparing the coherence > between two signals in two different conditions, and the coherence is > generally high in both conditions, but we would like to say that the > coherence is higher in one condition than the other. After some > thought about this issue, I wonder if shuffling trials between the two > conditions allows for a fair comparison to be made to the coherence in > the raw data? For example, if a pair of signals has different relative > phases in the two conditions, the overall coherence that exists in > both conditions will be decreased by the trial shuffling. It's also > conceivable, though perhaps less likely, that the condition-shuffled > data could have more coherence than either condition alone. In either > case, the distribution of the cluster statistics of the coherence > differences in the condition-shuffled data would certainly provide > some sort of estimate of a null distribution of the coherence > difference that does uses the actual data, but since the overall > coherence values of the condition-shuffled and raw data could be so > different, is it fair to say that this is a null distribution of the > difference in coherence between the unshuffled conditions? It is important to always keep in mind which null hypothesis is tested using permutation inference. This null hypothesis is exchangeability. For the case that you describe, exchangeability involves that the probability distributions of bivariate time series (or, equivalently, their Fourier coefficients) in the two experimental conditions are identical. You describe a situation in which this null hypothesis does not hold, and the reason for this is not a single but two parameters: coherence and relative phase. Both parameters differ across the two conditions that you describe. Now, if you want to test whether coherence differs across the two conditions and you don't want your inference to be affected by a difference in relative phase, then you have to come up with a test statistic that has the appropriate sensitivity. Such a test statistic might be the following: calculate the coherence difference between the two conditions using Fourier coefficients of which the phases were adjusted such that relative phase in the two conditions are both equal to zero. (This is a simple operation, involving a condition-specific phase shift applied to all Fourier coefficients of one of the two channels.) This example shows both the strength and the weakness of permutation inference. The strength is that you can construct your own test statistic such that it is sensitive to the physiological phenomenon in which you are interested. And the weakness is that the null hypothesis (exchangeability) is much more general than this specific physiological phenomenon. This means that a small permutation p-value allows you to infer that the two conditions most likely differ, but that inferring the precise cause of this difference depends on how clever you have been in designing a test statistic with the desired specificity. By the way, I did not understand the following sentence in your email: "It's also conceivable, though perhaps less likely, that the condition-shuffled data could have more coherence than either condition alone." For the situation that you describe, the coherence difference between the conditions (which is the relevant quantity for the phenomen in which you are interested) will on average be less for the permuted data than for the original data. > > If you have the time to respond, I'm curious to know what your > thoughts are regarding this issue and specifically in a situation in > which it is necessary to assess significance on one session. > Performing the clustering and shuffling of coherence values across > sessions obviously avoids this problem. For a test within a session, I > wonder if it would be possible to use a bootstrapping or jackknife > method combined with clustering to get a fair estimate of the > variability of the cluster level statistics and perform hypothesis > tests using that. Here the answer is simple. Permutation inference can only be used for comparing experimental conditions. However, I want to argue that, for investigating coherence, comparing experimental conditions is the only sensible thing one can do. The reason is that, for simple biophysical reasons, the null hypothesis of zero coherence within a single condition, will never be true, at least not in electrophysiological studies. This is because the potentials that are recorded in the two channels will always be affected by the physiological activity of common sources, simply because all potentials are volume conducted. Best, Eric dr. Eric Maris Donders Institute for Brain, Cognition and Behavior Center for Cognition and F.C. Donders Center for Cognitive Neuroimaging Radboud University P.O. Box 9104 6500 HE Nijmegen The Netherlands T:+31 24 3612651 Mobile: 06 39584581 F:+31 24 3616066 E: e.maris at donders.ru.nl MSc Cognitive Neuroscience: www.ru.nl/master/cns/ ---------------------------------- The aim of this list is to facilitate the discussion between users of the FieldTrip toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/neuroimaging/fieldtrip. From nelsonmj at CALTECH.EDU Tue Nov 17 13:33:46 2009 From: nelsonmj at CALTECH.EDU (Matthew Nelson) Date: Tue, 17 Nov 2009 13:33:46 +0100 Subject: Question about nonparametric statistical testing of coherence differences Message-ID: Thanks very much for your response Eric, I found it to be very helpful. On Tue, Nov 17, 2009 at 10:36 AM, Eric Maris wrote: > > It is important to always keep in mind which null hypothesis is tested using > permutation inference. This null hypothesis is exchangeability. For the case > that you describe, exchangeability involves that the probability > distributions of bivariate time series (or, equivalently, their Fourier > coefficients) in the two experimental conditions are identical. You describe > a situation in which this null hypothesis does not hold, and the reason for > this is not a single but two parameters: coherence and relative phase. Both > parameters differ across the two conditions that you describe. Now, if you > want to test whether coherence differs across the two conditions and you > don't want your inference to be affected by a difference in relative phase, > then you have to come up with a test statistic that has the appropriate > sensitivity. Such a test statistic might be the following: calculate the > coherence difference between the two conditions using Fourier coefficients > of which the phases were adjusted such that relative phase in the two > conditions are both equal to zero. (This is a simple operation, involving a > condition-specific phase shift applied to all Fourier coefficients of one of > the two channels.) It seems to me that this indeed is the test that I would be interested in for this situation. To reiterate the suggestion just to be clear that I understand it completely (and please let me know if I am misunderstanding it), this suggestion would be to adjust the phase of one signal in one condition so that the average relative phase between the two signals is the same for the two conditions, not to eliminate the phase information on each and every Fourier component. Thanks again for sharing your thoughts on that. > > By the way, I did not understand the following sentence in your email: "It's > also > conceivable, though perhaps less likely, that the condition-shuffled > data could have more coherence than either condition alone." For the > situation that you describe, the coherence difference between the conditions > (which is the relevant quantity for the phenomen in which you are > interested) will on average be less for the permuted data than for the > original data. Sorry for the confusion. For the situation that I specifically described in my first message, indeed the overall coherence in the permuted data would be less. What I was referring to in that sentence though was that in other situations, which I did not describe, it could be possible to have an increase in overall coherence in the shuffled data. For an example of such a situation, it seems to me that this could occur if the relative phases of the two signals are the same in both conditions but the overall spectral power differed between the two conditions for both signals such both signals had more power in condition one than in condition two. I haven’t tested this with simulations, but it seems that in the case the coherence could be higher in the trial shuffled case because of the induced correlation in spectral power between the signals resulting from mixing the two conditions. So following the line of thought from your suggestion above, in such a situation in order to prevent the magnitude differences from affecting the inference regarding the coherence difference between the two conditions, would you say that it would be appropriate to also adjust the overall magnitude of the pair of Fourier components in one condition to match the overall magnitude of the components in the other conditions when doing the permutation? > >> sessions obviously avoids this problem. For a test within a session, I >> wonder if it would be possible to use a bootstrapping or jackknife >> method combined with clustering to get a fair estimate of the >> variability of the cluster level statistics and perform hypothesis >> tests using that. > > Here the answer is simple. Permutation inference can only be used for > comparing experimental conditions. However, I want to argue that, for > investigating coherence, comparing experimental conditions is the only > sensible thing one can do. The reason is that, for simple biophysical > reasons, the null hypothesis of zero coherence within a single condition, > will never be true, at least not in electrophysiological studies. This is > because the potentials that are recorded in the two channels will always be > affected by the physiological activity of common sources, simply because all > potentials are volume conducted. > I agree completely. Just to clarify, I was suggesting using bootstrapping or jackknifing to estimate the variance of the coherence of each measure independently, and then use that to test the null hypothesis of no coherence difference between the two conditions rather than the null hypothesis of zero coherence. ---------------------------------- The aim of this list is to facilitate the discussion between users of the FieldTrip toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/neuroimaging/fieldtrip. From akiko at NYU.EDU Tue Nov 17 19:14:23 2009 From: akiko at NYU.EDU (Akiko Ikkai) Date: Tue, 17 Nov 2009 13:14:23 -0500 Subject: MEG rejectvisual summary Message-ID: Hi, I'm working on MEG data, and I have a very basic question on rejectvisual, with cfg.method = 'summary'; I understand that on channel number and trial number graphs, x- and y- axis (respectively) are variance across trials and channels. My question is what the acceptable range of these values are. SQUID jumps would be very obvious, but how about slow drifts (due to movement)? I suspect this depends on data, but if anyone could suggest some starting point (maybe based on experience?), I'd very appreciate it. Thanks! Akiko ---------------------------------- The aim of this list is to facilitate the discussion between users of the FieldTrip toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/neuroimaging/fieldtrip. From e.maris at DONDERS.RU.NL Tue Nov 17 21:04:00 2009 From: e.maris at DONDERS.RU.NL (Eric Maris) Date: Tue, 17 Nov 2009 21:04:00 +0100 Subject: Question about nonparametric statistical testing of coherence differences In-Reply-To: Message-ID: Dear Matthew, > > It is important to always keep in mind which null hypothesis is tested using > > permutation inference. This null hypothesis is exchangeability. For the case > > that you describe, exchangeability involves that the probability > > distributions of bivariate time series (or, equivalently, their Fourier > > coefficients) in the two experimental conditions are identical. You describe > > a situation in which this null hypothesis does not hold, and the reason for > > this is not a single but two parameters: coherence and relative phase. Both > > parameters differ across the two conditions that you describe. Now, if you > > want to test whether coherence differs across the two conditions and you > > don't want your inference to be affected by a difference in relative phase, > > then you have to come up with a test statistic that has the appropriate > > sensitivity. Such a test statistic might be the following: calculate the > > coherence difference between the two conditions using Fourier coefficients > > of which the phases were adjusted such that relative phase in the two > > conditions are both equal to zero. (This is a simple operation, involving a > > condition-specific phase shift applied to all Fourier coefficients of one of > > the two channels.) > > It seems to me that this indeed is the test that I would be interested in > for this situation. To reiterate the suggestion just to be clear that I > understand it completely (and please let me know if I am misunderstanding > it), this suggestion would be to adjust the phase of one signal in one > condition so that the average relative phase between the two signals is the > same for the two conditions, not to eliminate the phase information on each > and every Fourier component. Thanks again for sharing your thoughts on that. This is correct. Don't forget to apply this phase shift for every permutation, such that it becomes part of your test statistic. > > > > > By the way, I did not understand the following sentence in your email: "It's > > also > > conceivable, though perhaps less likely, that the condition-shuffled > > data could have more coherence than either condition alone." For the > > situation that you describe, the coherence difference between the conditions > > (which is the relevant quantity for the phenomen in which you are > > interested) will on average be less for the permuted data than for the > > original data. > > Sorry for the confusion. For the situation that I specifically described in > my first message, indeed the overall coherence in the permuted data would be > less. What I was referring to in that sentence though was that in other > situations, which I did not describe, it could be possible to have an > increase in overall coherence in the shuffled data. For an example of such a > situation, it seems to me that this could occur if the relative phases of > the two signals are the same in both conditions but the overall spectral > power differed between the two conditions for both signals such both signals > had more power in condition one than in condition two. I haven't tested this > with simulations, but it seems that in the case the coherence could be > higher in the trial shuffled case because of the induced correlation in > spectral power between the signals resulting from mixing the two conditions. In case you decide to run such a simulation, you may also include the phase-locking factor (Lachaux et al, 1999) in your calculation. The PLF does not depend on amplitude correlation over trials. > > So following the line of thought from your suggestion above, in such a > situation in order to prevent the magnitude differences from affecting the > inference regarding the coherence difference between the two conditions, > would you say that it would be appropriate to also adjust the overall > magnitude of the pair of Fourier components in one condition to match the > overall magnitude of the components in the other conditions when doing the > permutation? This may help. You can include this test statistic in your simulation, together with the PLF. > > > > >> sessions obviously avoids this problem. For a test within a session, I > >> wonder if it would be possible to use a bootstrapping or jackknife > >> method combined with clustering to get a fair estimate of the > >> variability of the cluster level statistics and perform hypothesis > >> tests using that. > > > > Here the answer is simple. Permutation inference can only be used for > > comparing experimental conditions. However, I want to argue that, for > > investigating coherence, comparing experimental conditions is the only > > sensible thing one can do. The reason is that, for simple biophysical > > reasons, the null hypothesis of zero coherence within a single condition, > > will never be true, at least not in electrophysiological studies. This is > > because the potentials that are recorded in the two channels will always be > > affected by the physiological activity of common sources, simply because all > > potentials are volume conducted. > > > > I agree completely. Just to clarify, I was suggesting using bootstrapping or > jackknifing to estimate the variance of the coherence of each measure > independently, and then use that to test the null hypothesis of no coherence > difference between the two conditions rather than the null hypothesis of > zero coherence. I would not advise this. The permutation test is to be preferred over bootstrap- and jacknife-based statistical test, because we can prove that the permutation test controls the false alarm rate. We cannot prove this for bootstrap- and jacknife-based tests. Best, Eric > > ---------------------------------- > The aim of this list is to facilitate the discussion between users of the FieldTrip > toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. > See also http://listserv.surfnet.nl/archives/fieldtrip.html and > http://www.ru.nl/neuroimaging/fieldtrip. ---------------------------------- The aim of this list is to facilitate the discussion between users of the FieldTrip toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/neuroimaging/fieldtrip. From nelsonmj at CALTECH.EDU Tue Nov 17 22:35:59 2009 From: nelsonmj at CALTECH.EDU (Matthew Nelson) Date: Tue, 17 Nov 2009 22:35:59 +0100 Subject: Question about nonparametric statistical testing of coherence differences Message-ID: Thanks again for your helpful response. ---------------------------------- The aim of this list is to facilitate the discussion between users of the FieldTrip toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/neuroimaging/fieldtrip. From Hanneke.vanDijk at MED.UNI-DUESSELDORF.DE Wed Nov 18 13:38:58 2009 From: Hanneke.vanDijk at MED.UNI-DUESSELDORF.DE (Hanneke Van Dijk) Date: Wed, 18 Nov 2009 13:38:58 +0100 Subject: using coil/isotrack information for sourceanalysis (neuromag data) Message-ID: Dear all, In my group we have a question regarding the use of the coil locations and/ or isotrack data to do source analysis. We are doing data analysis using FT and the MNE toolbox, on a dataset recorded with a Neuromag122 system. The four coils were placed in different locations then in the CTF system, which uses the anatomical landmarks (left ear, right ear and nasion). Here we placed the coils on the scalp; two approximately above the eyes and two behind the ears. We digitized the locations of the coils using the polhemus, togheter with the anatomical landmarks and some more points. We would very much like to know HOW and WHERE fieldtrip uses the coil-location information and if it is possible to use the polhemus data as well, to place the head at the correct location within the helmet and to do sourceanalysis. I noticed allready that when reading the fiff file with 'fiff_read_meas_info' (MNE) there is a field called .dig which seems to contain the coordinates of digitized locations. I have no idea though how to integrate this information into the data so fieldtrip can use it. Thanks in advance for any information, Hanneke van Dijk Institute for Clinical Neuroscience and Medical Psychology, Heinrich Heine Universitaet, Duesseldorf. ---------------------------------- The aim of this list is to facilitate the discussion between users of the FieldTrip toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/neuroimaging/fieldtrip. -------------- next part -------------- An HTML attachment was scrubbed... URL: From lhunt at FMRIB.OX.AC.UK Wed Nov 18 14:40:14 2009 From: lhunt at FMRIB.OX.AC.UK (Laurence Hunt) Date: Wed, 18 Nov 2009 13:40:14 +0000 Subject: using coil/isotrack information for sourceanalysis (neuromag data) In-Reply-To: <72E993C35FB11743B79FF9286E5B6D8B0F351C@Mail2-UKD.VMED.UKD> Message-ID: Dear Hanneke, The information stored in dig can indeed be read into fieldtrip; this is done by read_headshape, which reads in all the points and classifies them as fiducial (i.e. nasion/LPA/RPA), stored in shape.fid, or other, stored in shape.pnt. shape.pnt would therefore include your HPI coils and additional digitised points (and any digitised EEG sensor locations if you collected EEG also). As you're probably aware, there are two registrations that need to take place - the first is the registration of coil locations to sensor locations, and the second is the registration of the subject's MR scan to the coil locations/fiducials. The first is done at the time of recording (i.e. it is HPI); the sensors are by default read into fieldtrip using the same co-ordinates as the coils/digitised points (i.e. head coordinates rather than sensor coordinates, done by mne2grad in read_header). The second is done by fieldtrip, and is the registration of coil locations to the MR scan. This means that you wouldn't be able to improve the registration of coils etc. to the sensors (this registration has been done already by the HPI), but what you might be able to do is to use the additional points to improve the registration of the coil locations to the subject's MR scan. Typically they should be located on the scalp, and by minimising the mean squared error of the distance between coil locations/other digitised points and scalp you should be able to get a good registration. Unfortunately I'm not quite sure how or whether fieldtrip does this; I'm afraid I use fieldtrip mainly to read the data into SPM (which does allow you to use these additional points to aid registration to the subject's scalp surface). But I imagine fieldtrip is able to do this also, and perhaps someone who knows more about fieldtrip could explain how to use the information in read_headshape to achieve this? Hope this helps, Laurence =========================================== Laurence Hunt, DPhil Student Centre for Functional MRI of the Brain (FMRIB), University of Oxford lhunt at fmrib.ox.ac.uk Phone: (+44)1865-(2)22738 =========================================== On 18 Nov 2009, at 12:38, Hanneke Van Dijk wrote: > Dear all, > > In my group we have a question regarding the use of the coil > locations and/ or isotrack data to do source analysis. We are doing > data analysis using FT and the MNE toolbox, on a dataset recorded > with a Neuromag122 system. > > The four coils were placed in different locations then in the CTF > system, which uses the anatomical landmarks (left ear, right ear and > nasion). Here we placed the coils on the scalp; two approximately > above the eyes and two behind the ears. We digitized the locations > of the coils using the polhemus, togheter with the anatomical > landmarks and some more points. We would very much like to know HOW > and WHERE fieldtrip uses the coil-location information and if it is > possible to use the polhemus data as well, to place the head at the > correct location within the helmet and to do sourceanalysis. > > I noticed allready that when reading the fiff file with > 'fiff_read_meas_info' (MNE) there is a field called .dig which seems > to contain the coordinates of digitized locations. I have no idea > though how to integrate this information into the data so fieldtrip > can use it. > > Thanks in advance for any information, > > Hanneke van Dijk > > Institute for Clinical Neuroscience and Medical Psychology, > Heinrich Heine Universitaet, Duesseldorf. > > > > ---------------------------------- > > The aim of this list is to facilitate the discussion between users > of the FieldTrip toolbox, to share experiences and to discuss new > ideas for MEG and EEG analysis. > > http://listserv.surfnet.nl/archives/fieldtrip.html > > http://www.ru.nl/fcdonders/fieldtrip/ > ---------------------------------- The aim of this list is to facilitate the discussion between users of the FieldTrip toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/neuroimaging/fieldtrip. -------------- next part -------------- An HTML attachment was scrubbed... URL: From brian.roach at YALE.EDU Wed Nov 18 21:25:30 2009 From: brian.roach at YALE.EDU (Brian Roach) Date: Wed, 18 Nov 2009 12:25:30 -0800 Subject: research position in San Francisco, CA Message-ID: Fieldtrip Users, We are looking for new and experienced brain imagers with a background in signal processing to work in our UCSF-affiliated research lab. Please apply at the following link if interested: http://jobs-ncire.icims.com/jobs/1448/job thank you, Brian ---------------------------------- The aim of this list is to facilitate the discussion between users of the FieldTrip toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/neuroimaging/fieldtrip. -------------- next part -------------- An HTML attachment was scrubbed... URL: From nelsonmj at CALTECH.EDU Thu Nov 19 16:10:07 2009 From: nelsonmj at CALTECH.EDU (Matthew Nelson) Date: Thu, 19 Nov 2009 16:10:07 +0100 Subject: Question about permutation testing of an interaction in a two by two design Message-ID: After the terrific help I received following the last question, I thought I would post an additional question I am currently pondering. I’m also interested in comparing the coherence of a pair of signals in a 2x2 design. I am specifically interested in testing the interaction in this design and would like to do so using the cluster-based permutation tests to do so across time and frequency. I’m curious to receive feedback and input about the proper way to go about this. Performing the tests across sessions seems to me to be a bit easier to conceive and to write code for. In this case the design would be a within-sessions design, as all of the four trial types occur in each session. My impression is that the proper test could then be to calculate for each session the difference along one factor for each condition of the other factor, and then performing a permutation test of that difference among the conditions of the other factor with the test statistic merely being the mean difference of eth differences. It struck me that a 4-way permutation of the four trial types, but this would instead be more appropriate if the test statistic I was interested in was an omnibus anova test, not to test strictly the interaction which is my interest here. I am less sure how to perform the test if one wanted to do it within a single session where there may be different numbers of trials in each condition. I know this question relates more to permutation tests than to frequency analysis. If someone could even just point me towards a good reference where I can learn more about these more detailed aspects of permutation tests, I would appreciate it. Thanks. ---------------------------------- The aim of this list is to facilitate the discussion between users of the FieldTrip toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/neuroimaging/fieldtrip. From e.maris at DONDERS.RU.NL Thu Nov 19 22:06:04 2009 From: e.maris at DONDERS.RU.NL (Eric Maris) Date: Thu, 19 Nov 2009 22:06:04 +0100 Subject: Question about permutation testing of an interaction in a two by two design In-Reply-To: Message-ID: Dear Matthew, I agree with your proposal for an interaction test in a within-sessions design. (I have called this a within-units-of-observation design in the Maris & Oostenveld paper.) I know of no permutation test for an interaction effect in a between-units-of-observation design. The reason is that I do not see how such a test can be rephrased as a test of the exchangeability null hypothesis. This is a recurrent question on this discussion list. You may be good to browse through the archive of the discussion list. Best, Eric dr. Eric Maris Donders Institute for Brain, Cognition and Behavior Center for Cognition and F.C. Donders Center for Cognitive Neuroimaging Radboud University P.O. Box 9104 6500 HE Nijmegen The Netherlands T:+31 24 3612651 Mobile: 06 39584581 F:+31 24 3616066 E: e.maris at donders.ru.nl MSc Cognitive Neuroscience: www.ru.nl/master/cns/ > -----Oorspronkelijk bericht----- > Van: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] Namens > Matthew Nelson > Verzonden: donderdag 19 november 2009 16:10 > Aan: FIELDTRIP at NIC.SURFNET.NL > Onderwerp: [FIELDTRIP] Question about permutation testing of an interaction in a > two by two design > > After the terrific help I received following the last question, I thought I > would post an additional question I am currently pondering. > > I'm also interested in comparing the coherence of a pair of signals in a 2x2 > design. I am specifically interested in testing the interaction in this > design and would like to do so using the cluster-based permutation tests to > do so across time and frequency. I'm curious to receive feedback and input > about the proper way to go about this. > > Performing the tests across sessions seems to me to be a bit easier to > conceive and to write code for. In this case the design would be a > within-sessions design, as all of the four trial types occur in each > session. My impression is that the proper test could then be to calculate > for each session the difference along one factor for each condition of the > other factor, and then performing a permutation test of that difference > among the conditions of the other factor with the test statistic merely > being the mean difference of eth differences. It struck me that a 4-way > permutation of the four trial types, but this would instead be more > appropriate if the test statistic I was interested in was an omnibus anova > test, not to test strictly the interaction which is my interest here. > > I am less sure how to perform the test if one wanted to do it within a > single session where there may be different numbers of trials in each > condition. > > I know this question relates more to permutation tests than to frequency > analysis. If someone could even just point me towards a good reference where > I can learn more about these more detailed aspects of permutation tests, I > would appreciate it. Thanks. > > ---------------------------------- > The aim of this list is to facilitate the discussion between users of the FieldTrip > toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. > See also http://listserv.surfnet.nl/archives/fieldtrip.html and > http://www.ru.nl/neuroimaging/fieldtrip. ---------------------------------- The aim of this list is to facilitate the discussion between users of the FieldTrip toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/neuroimaging/fieldtrip. From nelsonmj at CALTECH.EDU Fri Nov 20 17:19:48 2009 From: nelsonmj at CALTECH.EDU (Matthew Nelson) Date: Fri, 20 Nov 2009 17:19:48 +0100 Subject: Question about permutation testing of an interaction in a two by two design Message-ID: Thanks very much for your response. I will browse through the archive here to see if I can find anything. One source I found elsewhere on the web can be found in this book on page 126-127: http://www.amazon.com/reader/038720279X?_encoding=UTF8&query=126#reader_038720279X If I'm understanding his description properly, this can be tested simply by using the ANOVA sum of squares test statistic for an interaction while permuting amongst all the conditions. I would suppose that an interaction contrast could be tested similarly using the sum of squares for the contrast as the test statistic while permuting amongst the combinations of conditions that factor into the particular contrast. But if you don't think that that permutation would provide the proper null hypothesis for either test (the omnibus interaction or an interaction contrast), I'd be curious to know. Thanks again very much, Matthew On Thu, 19 Nov 2009 22:06:04 +0100, Eric Maris wrote: >Dear Matthew, > >I agree with your proposal for an interaction test in a within-sessions >design. (I have called this a within-units-of-observation design in the >Maris & Oostenveld paper.) > >I know of no permutation test for an interaction effect in a >between-units-of-observation design. The reason is that I do not see how >such a test can be rephrased as a test of the exchangeability null >hypothesis. > >This is a recurrent question on this discussion list. You may be good to >browse through the archive of the discussion list. > >Best, > >Eric > > > >dr. Eric Maris >Donders Institute for Brain, Cognition and Behavior >Center for Cognition and F.C. Donders Center for Cognitive Neuroimaging >Radboud University >P.O. Box 9104 >6500 HE Nijmegen >The Netherlands >T:+31 24 3612651 >Mobile: 06 39584581 >F:+31 24 3616066 >E: e.maris at donders.ru.nl > >MSc Cognitive Neuroscience: www.ru.nl/master/cns/ > ---------------------------------- The aim of this list is to facilitate the discussion between users of the FieldTrip toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/neuroimaging/fieldtrip. From g.rousselet at PSY.GLA.AC.UK Fri Nov 20 18:17:46 2009 From: g.rousselet at PSY.GLA.AC.UK (Guillaume Rousselet) Date: Fri, 20 Nov 2009 17:17:46 +0000 Subject: Question about permutation testing of an interaction in a two by two design In-Reply-To: Message-ID: Matthew, based on the attached paper and Wilcox 2005 (Wilcox, R.R., Introduction to Robust Estimation and Hypothesis Testing. 2nd Ed. ed. 2005: Academic Press), the null F distributions for the main effects and the interaction are obtained by sampling with replacement independently from centred distributions. This is an extension of the bootstrap percentile-t technique. I'm not aware of robust ANOVA techniques employing permutation. On 20 Nov 2009, at 16:19, Matthew Nelson wrote: > Thanks very much for your response. I will browse through the > archive here > to see if I can find anything. > > One source I found elsewhere on the web can be found in this book on > page > 126-127: > > http://www.amazon.com/reader/038720279X?_encoding=UTF8&query=126#reader_038720279X > > If I'm understanding his description properly, this can be tested > simply by > using the ANOVA sum of squares test statistic for an interaction while > permuting amongst all the conditions. I would suppose that an > interaction > contrast could be tested similarly using the sum of squares for the > contrast > as the test statistic while permuting amongst the combinations of > conditions > that factor into the particular contrast. > > But if you don't think that that permutation would provide the > proper null > hypothesis for either test (the omnibus interaction or an interaction > contrast), I'd be curious to know. > > Thanks again very much, > > Matthew > > On Thu, 19 Nov 2009 22:06:04 +0100, Eric Maris > wrote: > >> Dear Matthew, >> >> I agree with your proposal for an interaction test in a within- >> sessions >> design. (I have called this a within-units-of-observation design in >> the >> Maris & Oostenveld paper.) >> >> I know of no permutation test for an interaction effect in a >> between-units-of-observation design. The reason is that I do not >> see how >> such a test can be rephrased as a test of the exchangeability null >> hypothesis. >> >> This is a recurrent question on this discussion list. You may be >> good to >> browse through the archive of the discussion list. >> >> Best, >> >> Eric >> >> >> >> dr. Eric Maris >> Donders Institute for Brain, Cognition and Behavior >> Center for Cognition and F.C. Donders Center for Cognitive >> Neuroimaging >> Radboud University >> P.O. Box 9104 >> 6500 HE Nijmegen >> The Netherlands >> T:+31 24 3612651 >> Mobile: 06 39584581 >> F:+31 24 3616066 >> E: e.maris at donders.ru.nl >> >> MSc Cognitive Neuroscience: www.ru.nl/master/cns/ >> > > ---------------------------------- > The aim of this list is to facilitate the discussion between users > of the FieldTrip toolbox, to share experiences and to discuss new > ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html > and http://www.ru.nl/neuroimaging/fieldtrip. ************************************************************************************ Guillaume A. Rousselet, Ph.D. Lecturer Centre for Cognitive Neuroimaging (CCNi) Department of Psychology Faculty of Information & Mathematical Sciences (FIMS) University of Glasgow 58 Hillhead Street Glasgow, UK G12 8QB The University of Glasgow, charity number SC004401 http://web.me.com/rousseg/GARs_website/ Email: g.rousselet at psy.gla.ac.uk Fax. +44 (0)141 330 4606 Tel. +44 (0)141 330 6652 Cell +44 (0)791 779 7833 "no test based upon a theory of probability can by itself provide any valuable evidence of the truth or falsehood of a hypothesis. But we may look at the purpose of tests from another viewpoint. Without hoping to know whether each separate hypothesis is true or false, we may search for rules to govern our behaviour with regard to them, in following which we insure that, in the long run of experience, we shall not often be wrong." Neyman J & Pearson E, 1933 ************************************************************************************ ---------------------------------- The aim of this list is to facilitate the discussion between users of the FieldTrip toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/neuroimaging/fieldtrip. -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: Berkovits_00_bootstrap.pdf Type: application/pdf Size: 82267 bytes Desc: not available URL: -------------- next part -------------- An HTML attachment was scrubbed... URL: From r.oostenveld at FCDONDERS.RU.NL Mon Nov 23 09:00:05 2009 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Mon, 23 Nov 2009 08:00:05 +0000 Subject: using coil/isotrack information for sourceanalysis (neuromag data) In-Reply-To: <60D7F31F-C6E0-4A3A-AB89-BCA9AEA185D6@fcdonders.ru.nl> Message-ID: Hi Hanneke, On 18 Nov 2009, at 14:40, Laurence Hunt wrote: > ... > Unfortunately I'm not quite sure how or whether fieldtrip does this; I'm afraid I use fieldtrip mainly to read the data into SPM (which does allow you to use these additional points to aid registration to the subject's scalp surface). But I imagine fieldtrip is able to do this also, and perhaps someone who knows more about fieldtrip could explain how to use the information in read_headshape to achieve this? Laurences description of the two steps are correct. First the position of the MEG sensors is expressed in a coordinate system relative to the fiducials, subseuqnelty the posiiton of the MRI has to be expressed in the same coordinate system. For the MEG gradiometer coils fieldtripFT relies on the low-level reader (in this case in combination with mne2grad.m) to contain the position in the correct coordinate system. In the CTF case (as an example), the res4 file contains the coil posiitons both in head coorindates, but also in dewar coordinates. FieldTrip reads the coil positions in head coordinates and stores them in grad.pnt and grad.ori (orientation is also relevant here). The usual procedure for the MRI in the CTF case is to use MRIViewer to click on the fiducials and then store the mri file with the coordinate system re-defined according to the fiducials. The volumerealign.m function allows to do the same in fieldtrip in case you don't have vendor-specific software to assign the coordinate system. What I'm not sure about is whether you want to represent the MEG coils and MRI relative to the localizer coils, or relative to the Nose/Ear fiducials. The first case is quite simple, because that only requires you to identify the localizer coils in the MRI. The second case is more tricky, because you then first have to specify the MEG coils and MRI in the localizer-coil coordinate system, compute the transformation from localizer coil coordinate system to fiducial coordinate system, and then apply that transform to both MEG coil positions+orientations and to the MRI. FT functions that pertain to this (but are normally low-level and not used by the end user) are headcoordinates, which allows you to compute the coordinate transformation matrix from A to B given three new points that describe coordinate system B, expressed in coordinate system A. The function forwinv/transform_sens can be used to apply the transformation to the sensors, The function warp_apply is used, and applying the transformation to the MRI is as simple as multiplying h, the output of headcoordinates with mri.tra, such that mri.tra = h*mri.tra. Important is that you carefully check the alignment of the MRI with the sensors by plotting them combined in 3D. The functions plot_slice and plot_sens (both in plotting) can be used for that. Hope this helps. Robert ----------------------------------------------------------- Robert Oostenveld, PhD Senior Researcher Donders Institute for Brain, Cognition and Behaviour Centre for Cognitive Neuroimaging Radboud University Nijmegen tel.: +31 (0)24 3619695 e-mail: r.oostenveld at donders.ru.nl web: http://www.ru.nl/neuroimaging skype: r.oostenveld ----------------------------------------------------------- ---------------------------------- The aim of this list is to facilitate the discussion between users of the FieldTrip toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/neuroimaging/fieldtrip. -------------- next part -------------- An HTML attachment was scrubbed... URL: From yiwen.li at MED.UNI-TUEBINGEN.DE Mon Nov 23 19:11:41 2009 From: yiwen.li at MED.UNI-TUEBINGEN.DE (Yiwen Li) Date: Mon, 23 Nov 2009 19:11:41 +0100 Subject: common spatial filter in lcmv beamforming Message-ID: Dear Fieldtrip Users, I have a question on computing common spatial filter for the time domain data (ERP) using lcmv beamforming. My experiment is a bilateral tactile discrimination task measured with the 275-channel CTF system. There are two experimental conditions that I want to compare within subjects on the source level. As the baseline between the two conditions might not be homogeneous, I would like to compute two common spatial filters based on the pooled data of both conditions for baseline and for the ERP during the tactile stimulation respectively. According to the example matlab script of computing common spatial filters on frequency data posted on the Fieldtrip website, I adapted it to the lcmv beamforming on the time domain data. The script is attach at the end. As my original trial length is 5.5s (-1.5 to 4s, -1s is visual instruction onset, 0s to 0.6s is tactile stimulation), the projection of each single trial through the common filter became extremely computationally demanding. Then I redefined the trials according to the time window of interest (as was suggested in the frequency domain source analysis), I got different source results as the beamformer_lcmv seem to take the average of the whole given data length and the covariance of the specified window to calculate the spatial filter. Now I realized that it was not correct to define such short time period for the averaged data and that I probably should have taken a longer time window, such as [-1.4 0.6]s that covers both baseline and tactile stimulation. But I am not clear about what kind of time window would be appropriate in my case? I have tried a couple of different time windows but so far I haven't got clear bilateral primary somatosensory sources yet, actually not even close to it, so I know I must have done something wrong. Any suggestions would be very much appreciated. Best regards, Yiwen cfg = []; cfg.channel = {'MEG'}; cfg.blc = 'no'; cfg.keeptrials = 'yes'; tlckavg = timelockanalysis(cfg, data); cfg = []; cfg.channel = {'MEG'}; cfg.blc = 'no'; cfg.removemean = 'no'; cfg.covariance = 'yes'; cfg.keeptrials = 'yes'; cfg.covariancewindow = [0.05 0.07]; % cfg.latency = [0.05 0.07]; tlckavg_toi = timelockanalysis(cfg, tlckavg); cfg.covariancewindow = [-1.37 -1.35]; % cfg.latency = [-1.37 -1.35]; tlckavg_blc = timelockanalysis(cfg, tlckavg); cfg = []; cfg.method = 'lcmv'; cfg.grid = grid; cfg.vol = vol; cfg.lambda = '5%'; cfg.keepfilter = 'yes'; source = sourceanalysis(cfg, tlckavg); cfg = []; cfg.method = 'lcmv'; cfg.grid = grid; % previously computed grid cfg.vol = vol; % previously computed volume conduction model cfg.grid.filter = source.avg.filter; % use the common filter computed in the previous step! cfg.lambda = '5%'; cfg.rawtrial = 'yes'; % project each single trial through the filter source = sourceanalysis(cfg, tlckavg); --------------------------------------------------------------------------------- Yiwen Li Hegner , PhD MEG-Center Institute of Medical Psychology and Behavioral Neurobiology University of Tübingen Germany ---------------------------------- The aim of this list is to facilitate the discussion between users of the FieldTrip toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/neuroimaging/fieldtrip. From rajamonis at MAIL.NIH.GOV Mon Nov 23 21:34:41 2009 From: rajamonis at MAIL.NIH.GOV (Rajamoni Nadar, Sreenivasan (NIH/NIMH) [E]) Date: Mon, 23 Nov 2009 15:34:41 -0500 Subject: FW: Fieldtrip to extract source signal Message-ID: Dr. Oostenveld, Attached is the code that I used to extract single trial source time series from MEG dataset (CTF). It is giving the following error while calling the routine prepare_leadfield. Could you please let me know the way to fix it? Thanks, Vasan %~~~~~~~~~~~~~~~ see the error message~~~~~~~~~~~~~~~ the input is timelock data with 273 channels and 300 timebins reading headmodel from file '/gs1/users/rajamoni/MEG_ds/AEDTPJOU_nback_20050422_01-f.ds/default.hdm' using gradiometers specified in the data precomputing leadfields for efficient handling of multiple trials reading headmodel from file '/gs1/users/rajamoni/MEG_ds/AEDTPJOU_nback_20050422_01-f.ds/default.hdm' using gradiometers specified in the data creating dipole grid based on user specified dipole positions 0 dipoles inside, 1 dipoles outside brain computing leadfield ??? Reference to non-existent field 'type'. Error in ==> prepare_leadfield at 133 if strcmp(vol.type, 'openmeeg') Error in ==> sourceanalysis at 322 [grid, cfg] = prepare_leadfield(cfg, data); ---------------------------------- The aim of this list is to facilitate the discussion between users of the FieldTrip toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/neuroimaging/fieldtrip. -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: single_trial_source_from_fieldtrip.m Type: application/octet-stream Size: 1486 bytes Desc: single_trial_source_from_fieldtrip.m URL: From moratti at MED.UCM.ES Tue Nov 24 10:19:43 2009 From: moratti at MED.UCM.ES (Stephan Moratti) Date: Tue, 24 Nov 2009 10:19:43 +0100 Subject: Question about permutation testing of an interaction in a two by two design Message-ID: Hi all, Thanks for the interesing discussion about the interaction with respect to permutation. I have been also struggling with this question. As we want to test the interaction (and not the main effect condition), I am not sure if resampling condition would produce the distribution of our null hypothesis. Regarding the interaction, we want to check if the mean values across conditions follow the same pattern in two groups (if we consider a group x condition interaction). If we make a line plot an interaction would be indicated by a line crossing if each line represents a group (ideally). No interaction would be represented by parallel lines for each group. So I wonder if by resampling the subject values between the groups keeping the condition structure intact, would create our null distribution for the interaction. If we resample condition, we would destroy the condition structure. What do you think? I would be happy for any input. Best, Stephan ---------------------------------- The aim of this list is to facilitate the discussion between users of the FieldTrip toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/neuroimaging/fieldtrip. From g.rousselet at PSY.GLA.AC.UK Tue Nov 24 11:18:02 2009 From: g.rousselet at PSY.GLA.AC.UK (Guillaume Rousselet) Date: Tue, 24 Nov 2009 10:18:02 +0000 Subject: Question about permutation testing of an interaction in a two by two design In-Reply-To: Message-ID: Dear Stephan, to build an appropriate null distribution, the resampling procedure must stick to the structure of your experimental design. In the case of a group x condition (repeated measure) interaction, the groups are independent but the conditions are not. To take that constraint into account, I think you need to resample from each group independently. However, for each group, because of the paired nature of the design, when you sample 1 subject, you have to sample both conditions from that subject (and all the time points and sensors), i.e. you sample subjects with replacement independently from each group, but keeping paired data points together. The strategy described here relies on a sampling with replacement under H0. In that case H0 is created by centering the data independently in each of the 4 cells of your design. So you start with a true null hypothesis and through resampling you can derive a table of F values for the interaction under H0. Hope this help, GAR On 24 Nov 2009, at 09:19, Stephan Moratti wrote: > Hi all, > > Thanks for the interesing discussion about the interaction with > respect to > permutation. I have been also struggling with this question. As we > want to > test the interaction (and not the main effect condition), I am not > sure if > resampling condition would produce the distribution of our null > hypothesis. > Regarding the interaction, we want to check if the mean values across > conditions follow the same pattern in two groups (if we consider a > group x > condition interaction). If we make a line plot an interaction would > be indicated > by a line crossing if each line represents a group (ideally). No > interaction > would be represented by parallel lines for each group. So I wonder > if by > resampling the subject values between the groups keeping the condition > structure intact, would create our null distribution for the > interaction. If we > resample condition, we would destroy the condition structure. > > What do you think? I would be happy for any input. > > Best, > > Stephan > > ---------------------------------- > The aim of this list is to facilitate the discussion between users > of the FieldTrip toolbox, to share experiences and to discuss new > ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html > and http://www.ru.nl/neuroimaging/fieldtrip. ************************************************************************************ Guillaume A. Rousselet, Ph.D. Lecturer Centre for Cognitive Neuroimaging (CCNi) Department of Psychology Faculty of Information & Mathematical Sciences (FIMS) University of Glasgow 58 Hillhead Street Glasgow, UK G12 8QB The University of Glasgow, charity number SC004401 http://web.me.com/rousseg/GARs_website/ Email: g.rousselet at psy.gla.ac.uk Fax. +44 (0)141 330 4606 Tel. +44 (0)141 330 6652 Cell +44 (0)791 779 7833 "YOU ARE NOT NORMAL. [...] you probably belong to the minority of the world's population that has a steady job, adequate access to social security, and enjoys substantial political freedoms. Moreover, you live on more than $2 a day, and, unlike 860 million others, you can read. The percentage of humanity that combines all of these attributes is minuscule. [...] Statistically, a "normal" human being in today's world is poor, lives in oppressive physical, social, and political conditions, and is ruled by unresponsive and corrupt government." Moises Naim - 2005 - Editor in chief of Foreign Policy ************************************************************************************ ---------------------------------- The aim of this list is to facilitate the discussion between users of the FieldTrip toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/neuroimaging/fieldtrip. -------------- next part -------------- An HTML attachment was scrubbed... URL: From sklein at BERKELEY.EDU Tue Nov 24 11:18:23 2009 From: sklein at BERKELEY.EDU (Stanley Klein) Date: Tue, 24 Nov 2009 02:18:23 -0800 Subject: How does one do simulations for statistics? Message-ID: I too have lots of questions on how to do statistics on EEG and MEG. Right now for example we are getting very similar EEG and MEG waveforms (following SVD) and are trying out various statistical ways of comparing them. In addition to using Fieldtrip's wonderful (but complicated) cluster permutation test for dealing with multiple comparisons and correlated noise issues we are trying other ideas. The only way that we can figure out whether we are on the right track is to do simulations where we know the correct answer. Does anyone have good advice on how to do good simulations? We are using the CTF machine for our EEG and MEG (and Biosemi for EEG alone). Every sample is about 2 msec. For a single trace  we are using something like the following Matlab code that gives a flat amplitude spectrum out to 15 Hz and then close to 1/f^2 beyond that. x(1:2)=[0 1]; for i=3:10000; x(i) = 1.81*x(i-1) -.85*x(i-2)+randn; %AR model for time series end The AR coefficients were obtained by trial and error and have a lot of flexibility. The question again is whether anyone has good suggestions for how to simulate EEG or MEG noise in the time domain? Even better would be something good to read. I'd like the noise to be manufactured in the time domain since I'll be doing other things for the signal in the time domain including multiplicative noise. Without good simulations how do people test all their statistics, especially when there is a bunch of preprocessing like SVD (or complicated, nonlinear interaction terms)? thanks, Stan Klein ---------------------------------- The aim of this list is to facilitate the discussion between users of the FieldTrip toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/neuroimaging/fieldtrip. From e.maris at DONDERS.RU.NL Tue Nov 24 12:11:18 2009 From: e.maris at DONDERS.RU.NL (Eric Maris) Date: Tue, 24 Nov 2009 12:11:18 +0100 Subject: Question about permutation testing of an interaction in a two by two design In-Reply-To: Message-ID: Dear Stephan, It is sometimes possible to reformulate an interaction effect null hypothesis such that it becomes a main effect null hypothesis (however, for a different dependent variable, obtained be calculating the difference between conditions). Such a reformulation is possible for a two-factorial design in which one independent variable is manipulated within subjects (in your case, this is condition), and the other between subjects (in your case, this is group). You do this by calculating subject-specific difference scores, [condition1 - condition2], and using these as the dependent variable in a between-groups comparison. This is possible by means of the standard independent-samples T-test, but also by means of a permutation test (involving permutation of the difference scores), which allows you to deal with the multiple comparison problem. For a factorial design that only involves between-subject independent variables, such a reformulation is not possible (at least, I am not aware of it). Best, Eric > -----Oorspronkelijk bericht----- > Van: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] Namens > Stephan Moratti > Verzonden: dinsdag 24 november 2009 10:20 > Aan: FIELDTRIP at NIC.SURFNET.NL > Onderwerp: Re: [FIELDTRIP] Question about permutation testing of an interaction > in a two by two design > > Hi all, > > Thanks for the interesing discussion about the interaction with respect to > permutation. I have been also struggling with this question. As we want to > test the interaction (and not the main effect condition), I am not sure if > resampling condition would produce the distribution of our null hypothesis. > Regarding the interaction, we want to check if the mean values across > conditions follow the same pattern in two groups (if we consider a group x > condition interaction). If we make a line plot an interaction would be indicated > by a line crossing if each line represents a group (ideally). No interaction > would be represented by parallel lines for each group. So I wonder if by > resampling the subject values between the groups keeping the condition > structure intact, would create our null distribution for the interaction. If we > resample condition, we would destroy the condition structure. > > What do you think? I would be happy for any input. > > Best, > > Stephan > > ---------------------------------- > The aim of this list is to facilitate the discussion between users of the FieldTrip > toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. > See also http://listserv.surfnet.nl/archives/fieldtrip.html and > http://www.ru.nl/neuroimaging/fieldtrip. ---------------------------------- The aim of this list is to facilitate the discussion between users of the FieldTrip toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/neuroimaging/fieldtrip. -------------- next part -------------- An HTML attachment was scrubbed... URL: From sklein at BERKELEY.EDU Tue Nov 24 12:43:39 2009 From: sklein at BERKELEY.EDU (Stanley Klein) Date: Tue, 24 Nov 2009 03:43:39 -0800 Subject: How does one do simulations for statistics? In-Reply-To: <9016c9f10911240218s3f8ebbf9r867a274fd3ad821@mail.gmail.com> Message-ID: Hi again, I have had a suggestion to try the freqsimulation function of Fieldtrip. But I would like to have something in the time domain so that I can play with autoregressive coefficients between sources and so that I can put in nonlinearities like multiplicative noise if I'd like. . Incidentally the AR coefficients that I had given corresponded to a filter that looks like: t=0:2:199; %t is in msec x=exp(-t/25).*sin(2*pi*t/60); %this gives about one damped cycle with 60 msec period XX=[x(3:100); x(2:99); x(1:98)]; coef=XX(1,:)/XX(2:3,:) %linear regression to get AR coefficients where coef = [1.806 -.852] from this linear regression, which is similar to what I had sent in my previous email for generating the noisy filtered time series. Again, my question is how to generate noise that looks like EEG or MEG. Can I do an adequate job simply by getting nice AR coefficients (what would some good coefficients be?) or do I need to do fancier things? For example, should I worry about sparse bursts of alpha? What do people commonly do to simulate data. I like to use simulated time series in addition to real data so that I am confident about what is going on underneath. Stan On Tue, Nov 24, 2009 at 2:18 AM, Stanley Klein wrote: > I too have lots of questions on how to do statistics on EEG and MEG. > Right now for example we are getting very similar EEG and MEG > waveforms (following SVD) and are trying out various statistical ways > of comparing them. In addition to using Fieldtrip's wonderful (but > complicated) cluster permutation test for dealing with multiple > comparisons and correlated noise issues we are trying other ideas. The > only way that we can figure out whether we are on the right track is > to do simulations where we know the correct answer. Does anyone have > good advice on how to do good simulations? We are using the CTF > machine for our EEG and MEG (and Biosemi for EEG alone). Every sample > is about 2 msec. For a single trace  we are using something like the > following Matlab code that gives a flat amplitude spectrum out to 15 > Hz and then close to 1/f^2 beyond that. > > x(1:2)=[0 1]; > for i=3:10000; >   x(i) = 1.81*x(i-1) -.85*x(i-2)+randn;  %AR model for time series > end > > The AR coefficients were obtained by trial and error and have a lot of > flexibility. > > The question again is whether anyone has good suggestions for how to > simulate EEG or MEG noise in the time domain?  Even better would be > something good to read.   I'd like the noise to be manufactured in the > time domain since I'll be doing other things for the signal in the > time domain including multiplicative noise. Without good simulations > how do people test all their statistics, especially when there is a > bunch of preprocessing like SVD (or complicated, nonlinear interaction > terms)? > thanks, > Stan Klein > ---------------------------------- The aim of this list is to facilitate the discussion between users of the FieldTrip toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/neuroimaging/fieldtrip. From moratti at MED.UCM.ES Tue Nov 24 14:51:52 2009 From: moratti at MED.UCM.ES (Stephan Moratti) Date: Tue, 24 Nov 2009 14:51:52 +0100 Subject: Question about permutation testing of an interaction in a two by two design Message-ID: Eric, Thanks a lot for your reply ! Best, Stephan ---------------------------------- The aim of this list is to facilitate the discussion between users of the FieldTrip toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/neuroimaging/fieldtrip. From moratti at MED.UCM.ES Tue Nov 24 15:04:49 2009 From: moratti at MED.UCM.ES (Stephan Moratti) Date: Tue, 24 Nov 2009 15:04:49 +0100 Subject: Question about permutation testing of an interaction in a two by two design Message-ID: Dear Guillaume, Thanks for the reply. I think what I meant with "keeping the condition structure", refelcts what you have described in your awnser (but in a far better way I gave to admit !). What I did is doing so in "R" (a statistical package) and then use fieldtrip to do the cluster statistic. Best and many thanks, Stephan ---------------------------------- The aim of this list is to facilitate the discussion between users of the FieldTrip toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/neuroimaging/fieldtrip. From wanglinsisi at GMAIL.COM Tue Nov 24 20:48:54 2009 From: wanglinsisi at GMAIL.COM (Lin Wang) Date: Tue, 24 Nov 2009 20:48:54 +0100 Subject: Question about permutation testing of an interaction in a two by two design In-Reply-To: Message-ID: Dear Eric, Thanks for your clear answer. I also have a question about the permutation testing of the interactions in the mixed factorial design. Suppose I have three factors, with two levels in each: 2Group(boys,girls)*2A(A1,A2)*2B(B1,B2). Factor Group is a between-subject factor, while factor A and B are within-subject factors. What I want to test is whether factors B influences factor A differently on boys and girls (a three-way interaction). Can I test the interaction between factor B and Group separately in B1 and B2 conditions? That is, first split the data into two parts (B1, B2), and then for each part test the interaction between factor A and Group by subtracting the observations of A1 from A2 and taking it as a new dependent variable. Furthermore, if I have another factor C(C1, C2), and I'm interested in whether the combination of B and C influences factor A differently on boys and girls. Can I first split the data into four parts according to the combination of factor B and C (B1C1, B1C2, B2C1, B2C2) and do the interaction between factor A and Group separately for each part? Thank you in advance. Lin 2009/11/24 Eric Maris > Dear Stephan, > > > > > > It is sometimes possible to reformulate an interaction effect null > hypothesis such that it becomes a main effect null hypothesis (however, for > a different dependent variable, obtained be calculating the difference > between conditions). Such a reformulation is possible for a two-factorial > design in which one independent variable is manipulated within subjects (in > your case, this is condition), and the other between subjects (in your case, > this is group). You do this by calculating subject-specific difference > scores, [condition1 - condition2], and using these as the dependent variable > in a between-groups comparison. This is possible by means of the standard > independent-samples T-test, but also by means of a permutation test > (involving permutation of the difference scores), which allows you to deal > with the multiple comparison problem. > > > > For a factorial design that only involves between-subject independent > variables, such a reformulation is not possible (at least, I am not aware of > it). > > > > > > Best, > > > > Eric > > > > > > > > > > > -----Oorspronkelijk bericht----- > > > Van: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] Namens > > > Stephan Moratti > > > Verzonden: dinsdag 24 november 2009 10:20 > > > Aan: FIELDTRIP at NIC.SURFNET.NL > > > Onderwerp: Re: [FIELDTRIP] Question about permutation testing of an > interaction > > > in a two by two design > > > > > > Hi all, > > > > > > Thanks for the interesing discussion about the interaction with respect > to > > > permutation. I have been also struggling with this question. As we want > to > > > test the interaction (and not the main effect condition), I am not sure > if > > > resampling condition would produce the distribution of our null > hypothesis. > > > Regarding the interaction, we want to check if the mean values across > > > conditions follow the same pattern in two groups (if we consider a group > x > > > condition interaction). If we make a line plot an interaction would be > indicated > > > by a line crossing if each line represents a group (ideally). No > interaction > > > would be represented by parallel lines for each group. So I wonder if by > > > resampling the subject values between the groups keeping the condition > > > structure intact, would create our null distribution for the interaction. > If we > > > resample condition, we would destroy the condition structure. > > > > > > What do you think? I would be happy for any input. > > > > > > Best, > > > > > > Stephan > > > > > > ---------------------------------- > > > The aim of this list is to facilitate the discussion between users of the > FieldTrip > > > toolbox, to share experiences and to discuss new ideas for MEG and EEG > analysis. > > > See also http://listserv.surfnet.nl/archives/fieldtrip.html and > > > http://www.ru.nl/neuroimaging/fieldtrip. > > ---------------------------------- > > The aim of this list is to facilitate the discussion between users of the > FieldTrip toolbox, to share experiences and to discuss new ideas for MEG and > EEG analysis. > > http://listserv.surfnet.nl/archives/fieldtrip.html > > http://www.ru.nl/fcdonders/fieldtrip/ > ---------------------------------- The aim of this list is to facilitate the discussion between users of the FieldTrip toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/neuroimaging/fieldtrip. -------------- next part -------------- An HTML attachment was scrubbed... URL: From e.maris at DONDERS.RU.NL Tue Nov 24 23:39:18 2009 From: e.maris at DONDERS.RU.NL (Eric Maris) Date: Tue, 24 Nov 2009 23:39:18 +0100 Subject: Question about permutation testing of an interaction in a two by two design In-Reply-To: Message-ID: Dear Lin, Thanks for your clear answer. I also have a question about the permutation testing of the interactions in the mixed factorial design. Suppose I have three factors, with two levels in each: 2Group(boys,girls)*2A(A1,A2)*2B(B1,B2). Factor Group is a between-subject factor, while factor A and B are within-subject factors. What I want to test is whether factors B influences factor A differently on boys and girls (a three-way interaction). Can I test the interaction between factor B and Group separately in B1 and B2 conditions? That is, first split the data into two parts (B1, B2), and then for each part test the interaction between factor A and Group by subtracting the observations of A1 from A2 and taking it as a new dependent variable. Furthermore, if I have another factor C(C1, C2), and I'm interested in whether the combination of B and C influences factor A differently on boys and girls. Can I first split the data into four parts according to the combination of factor B and C (B1C1, B1C2, B2C1, B2C2) and do the interaction between factor A and Group separately for each part? I do not think it is necessary to split the data and do separate analyses on the different parts. Reformulating an interacting effect null hypothesis as a main effect null hypothesis for a different dependent variable is possible if you have at most a single between-subjects variable in your design. Thus, it also works in the case you describe, with two within-subjects and one between-subjects variable. The dependent variable that must be calculated is the two-way interaction effect contrast for the 2-factorial within-subjects design with the variables A and B: [A1,B1] + [A2,B2] - [A1,B2] - [A2,B1]. You then perform a independent samples T-test on the interaction contrast variable, comparing the two levels of your between-subjects variable. This reformulation is also possible when there are more than two within-subjects variables in the design. The only thing that changes is the interaction effec contrast. Best, Eric dr. Eric Maris Donders Institute for Brain, Cognition and Behavior Center for Cognition and F.C. Donders Center for Cognitive Neuroimaging Radboud University P.O. Box 9104 6500 HE Nijmegen The Netherlands T:+31 24 3612651 Mobile: 06 39584581 F:+31 24 3616066 E: e. maris at donders.ru.nl MSc Cognitive Neuroscience: www.ru.nl/master/cns/ Thank you in advance. Lin 2009/11/24 Eric Maris Dear Stephan, It is sometimes possible to reformulate an interaction effect null hypothesis such that it becomes a main effect null hypothesis (however, for a different dependent variable, obtained be calculating the difference between conditions). Such a reformulation is possible for a two-factorial design in which one independent variable is manipulated within subjects (in your case, this is condition), and the other between subjects (in your case, this is group). You do this by calculating subject-specific difference scores, [condition1 - condition2], and using these as the dependent variable in a between-groups comparison. This is possible by means of the standard independent-samples T-test, but also by means of a permutation test (involving permutation of the difference scores), which allows you to deal with the multiple comparison problem. For a factorial design that only involves between-subject independent variables, such a reformulation is not possible (at least, I am not aware of it). Best, Eric > -----Oorspronkelijk bericht----- > Van: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] Namens > Stephan Moratti > Verzonden: dinsdag 24 november 2009 10:20 > Aan: FIELDTRIP at NIC.SURFNET.NL > Onderwerp: Re: [FIELDTRIP] Question about permutation testing of an interaction > in a two by two design > > Hi all, > > Thanks for the interesing discussion about the interaction with respect to > permutation. I have been also struggling with this question. As we want to > test the interaction (and not the main effect condition), I am not sure if > resampling condition would produce the distribution of our null hypothesis. > Regarding the interaction, we want to check if the mean values across > conditions follow the same pattern in two groups (if we consider a group x > condition interaction). If we make a line plot an interaction would be indicated > by a line crossing if each line represents a group (ideally). No interaction > would be represented by parallel lines for each group. So I wonder if by > resampling the subject values between the groups keeping the condition > structure intact, would create our null distribution for the interaction. If we > resample condition, we would destroy the condition structure. > > What do you think? I would be happy for any input. > > Best, > > Stephan > > ---------------------------------- > The aim of this list is to facilitate the discussion between users of the FieldTrip > toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. > See also http://listserv.surfnet.nl/archives/fieldtrip.html and > http://www.ru.nl/neuroimaging/fieldtrip. ---------------------------------- The aim of this list is to facilitate the discussion between users of the FieldTrip toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. http://listserv.surfnet.nl/archives/fieldtrip.html http://www.ru.nl/fcdonders/fieldtrip/ ---------------------------------- The aim of this list is to facilitate the discussion between users of the FieldTrip toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. http://listserv.surfnet.nl/archives/fieldtrip.html http://www.ru.nl/fcdonders/fieldtrip/ ---------------------------------- The aim of this list is to facilitate the discussion between users of the FieldTrip toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/neuroimaging/fieldtrip. -------------- next part -------------- An HTML attachment was scrubbed... URL: From dahliash at STANFORD.EDU Wed Nov 25 05:43:21 2009 From: dahliash at STANFORD.EDU (Dahlia Sharon) Date: Wed, 25 Nov 2009 05:43:21 +0100 Subject: freqstatistics: direct access to t statistic of observed data Message-ID: Hi, I'm running freqstatistics to test for a difference in coherence between two stimulus conditions (data is time x freq with only 1 channel combination), using the montecarlo and permutation options. Could anyone instruct me how to access the t statistic (NOT the cluster level statistic but that of the raw spectra) of the observed data (for all time-frequency points), and its threshold? Thanks!!! Dahlia. ---------------------------------- The aim of this list is to facilitate the discussion between users of the FieldTrip toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/neuroimaging/fieldtrip. From wanglinsisi at GMAIL.COM Wed Nov 25 09:37:51 2009 From: wanglinsisi at GMAIL.COM (Lin Wang) Date: Wed, 25 Nov 2009 09:37:51 +0100 Subject: Question about permutation testing of an interaction in a two by two design In-Reply-To: <03B30C59D4B24992926172AEE418B8DA@ru42146fac3249> Message-ID: Dear Eric, Thank you very much for you reply. I'm clear about the testing of multiple-way interaction now. I suppose the tests I mentioned in the last email is simple effect test. Am I right? Thanks again. Lin 2009/11/24 Eric Maris > Dear Lin, > > > > > > > > Thanks for your clear answer. I also have a question about the permutation > testing of the interactions in the mixed factorial design. > > Suppose I have three factors, with two levels in each: > 2Group(boys,girls)*2A(A1,A2)*2B(B1,B2). Factor Group is a between-subject > factor, while factor A and B are within-subject factors. What I want to test > is whether factors B influences factor A differently on boys and girls (a > three-way interaction). > > Can I test the interaction between factor B and Group separately in B1 and > B2 conditions? That is, first split the data into two parts (B1, B2), and > then for each part test the interaction between factor A and Group by > subtracting the observations of A1 from A2 and taking it as a new dependent > variable. > > Furthermore, if I have another factor C(C1, C2), and I'm interested in > whether the combination of B and C influences factor A differently on boys > and girls. Can I first split the data into four parts according to the > combination of factor B and C (B1C1, B1C2, B2C1, B2C2) and do the > interaction between factor A and Group separately for each part? > > I do not think it is necessary to split the data and do separate analyses > on the different parts. > > Reformulating an interacting effect null hypothesis as a main effect null > hypothesis for a different dependent variable is possible if you have at > most a single between-subjects variable in your design. Thus, it also works > in the case you describe, with two within-subjects and one between-subjects > variable. The dependent variable that must be calculated is the two-way > interaction effect contrast for the 2-factorial within-subjects design with > the variables A and B: [A1,B1] + [A2,B2] – [A1,B2] – [A2,B1]. You then > perform a independent samples T-test on the interaction contrast variable, > comparing the two levels of your between-subjects variable. > > This reformulation is also possible when there are more than two > within-subjects variables in the design. The only thing that changes is the > interaction effec contrast. > > > > Best, > > Eric > > > > dr. Eric Maris > Donders Institute for Brain, Cognition and Behavior > > Center for Cognition and F.C. Donders Center for Cognitive Neuroimaging > > Radboud University > P.O. Box 9104 > 6500 HE Nijmegen > The Netherlands > T:+31 24 3612651 > Mobile: 06 39584581 > > F:+31 24 3616066 > E: e.maris at donders.ru.nl > > > > MSc Cognitive Neuroscience: www.ru.nl/master/cns/ > > > > > > > Thank you in advance. > > Lin > > > 2009/11/24 Eric Maris > > Dear Stephan, > > > > > > It is sometimes possible to reformulate an interaction effect null > hypothesis such that it becomes a main effect null hypothesis (however, for > a different dependent variable, obtained be calculating the difference > between conditions). Such a reformulation is possible for a two-factorial > design in which one independent variable is manipulated within subjects (in > your case, this is condition), and the other between subjects (in your case, > this is group). You do this by calculating subject-specific difference > scores, [condition1 - condition2], and using these as the dependent variable > in a between-groups comparison. This is possible by means of the standard > independent-samples T-test, but also by means of a permutation test > (involving permutation of the difference scores), which allows you to deal > with the multiple comparison problem. > > > > For a factorial design that only involves between-subject independent > variables, such a reformulation is not possible (at least, I am not aware of > it). > > > > > > Best, > > > > Eric > > > > > > > > > > > -----Oorspronkelijk bericht----- > > > Van: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] Namens > > > Stephan Moratti > > > Verzonden: dinsdag 24 november 2009 10:20 > > > Aan: FIELDTRIP at NIC.SURFNET.NL > > > Onderwerp: Re: [FIELDTRIP] Question about permutation testing of an > interaction > > > in a two by two design > > > > > > Hi all, > > > > > > Thanks for the interesing discussion about the interaction with respect > to > > > permutation. I have been also struggling with this question. As we want > to > > > test the interaction (and not the main effect condition), I am not sure > if > > > resampling condition would produce the distribution of our null > hypothesis. > > > Regarding the interaction, we want to check if the mean values across > > > conditions follow the same pattern in two groups (if we consider a group > x > > > condition interaction). If we make a line plot an interaction would be > indicated > > > by a line crossing if each line represents a group (ideally). No > interaction > > > would be represented by parallel lines for each group. So I wonder if by > > > resampling the subject values between the groups keeping the condition > > > structure intact, would create our null distribution for the interaction. > If we > > > resample condition, we would destroy the condition structure. > > > > > > What do you think? I would be happy for any input. > > > > > > Best, > > > > > > Stephan > > > > > > ---------------------------------- > > > The aim of this list is to facilitate the discussion between users of the > FieldTrip > > > toolbox, to share experiences and to discuss new ideas for MEG and EEG > analysis. > > > See also http://listserv.surfnet.nl/archives/fieldtrip.html and > > > http://www.ru.nl/neuroimaging/fieldtrip. > > ---------------------------------- > > The aim of this list is to facilitate the discussion between users of the > FieldTrip toolbox, to share experiences and to discuss new ideas for MEG and > EEG analysis. > > http://listserv.surfnet.nl/archives/fieldtrip.html > > http://www.ru.nl/fcdonders/fieldtrip/ > > > > ---------------------------------- > > The aim of this list is to facilitate the discussion between users of the > FieldTrip toolbox, to share experiences and to discuss new ideas for MEG and > EEG analysis. > > http://listserv.surfnet.nl/archives/fieldtrip.html > > http://www.ru.nl/fcdonders/fieldtrip/ > > ---------------------------------- > > The aim of this list is to facilitate the discussion between users of the > FieldTrip toolbox, to share experiences and to discuss new ideas for MEG and > EEG analysis. > > http://listserv.surfnet.nl/archives/fieldtrip.html > > http://www.ru.nl/fcdonders/fieldtrip/ > ---------------------------------- The aim of this list is to facilitate the discussion between users of the FieldTrip toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/neuroimaging/fieldtrip. -------------- next part -------------- An HTML attachment was scrubbed... URL: From rajamonis at MAIL.NIH.GOV Thu Nov 26 14:53:36 2009 From: rajamonis at MAIL.NIH.GOV (Rajamoni Nadar, Sreenivasan (NIH/NIMH) [E]) Date: Thu, 26 Nov 2009 08:53:36 -0500 Subject: single trial source signal Message-ID: FieldTrip Users, Is it possible to get single trial source signal using FieldTrip? I would appreciate if anybody could provide code for the same. Thank you, Vasan ---------------------------------- The aim of this list is to facilitate the discussion between users of the FieldTrip toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/neuroimaging/fieldtrip. From Hanneke.vanDijk at MED.UNI-DUESSELDORF.DE Sat Nov 28 22:46:15 2009 From: Hanneke.vanDijk at MED.UNI-DUESSELDORF.DE (Hanneke Van Dijk) Date: Sat, 28 Nov 2009 22:46:15 +0100 Subject: single trial source signal Message-ID: Dear Vasan, You could try doing freqanalysis with cfg.output = 'fourier'; and then sourceanalysis with cfg.method = 'pcc'. If I remember well you should specify cfg.keeptrials = 'yes'; For freqanalysis I used cfg.method = 'mtmfft' ( = without keeping time-information), and cfg.taper = 'hanning'; That should work. If you need more info I should have a look at my scripts so please let me know then! Good luck! Hanneke _______________________ Institute for Clinical Neuroscience and Medical Psychology Heinrich Heine Universitaet, Duesseldorf. -----Oorspronkelijk bericht----- Van: FieldTrip discussion list namens Rajamoni Nadar, Sreenivasan (NIH/NIMH) [E] Verzonden: do 26.11.2009 14:53 Aan: FIELDTRIP at NIC.SURFNET.NL Onderwerp: [FIELDTRIP] single trial source signal FieldTrip Users, Is it possible to get single trial source signal using FieldTrip? I would appreciate if anybody could provide code for the same. Thank you, Vasan ---------------------------------- The aim of this list is to facilitate the discussion between users of the FieldTrip toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/neuroimaging/fieldtrip. ---------------------------------- The aim of this list is to facilitate the discussion between users of the FieldTrip toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/neuroimaging/fieldtrip. From Hanneke.vanDijk at MED.UNI-DUESSELDORF.DE Sun Nov 29 09:38:55 2009 From: Hanneke.vanDijk at MED.UNI-DUESSELDORF.DE (Hanneke Van Dijk) Date: Sun, 29 Nov 2009 09:38:55 +0100 Subject: single trial source signal Message-ID: Dear Vasan, Since I don't know exactly how far you are in doing the analysis, I just send you the basic script that shows the most important parameters. Don't forget to do freqanalysis with cfg.output = 'fourier' and cfg.method = 'mtmfft' for the specific frequency (cfg.foilim) you want to focus on. cfg = []; cfg.grid.pos = location of source coordinate;% [x y z] to fill in cfg.frequency = frequency of interest; cfg.vol = headmodel; %to make yourself see http://fieldtrip.fcdonders.nl/example/make_leadfields_using_different_headmodels cfg.projectnoise = 'yes';%to compute the neural activity index using sourcedescriptives cfg.lambda = '10%';%the amount of noice to estimate estimated cfg.method = 'pcc'; cfg.keeptrials = 'yes'; Virtual_channeldata = sourceanalysis(cfg,freq); You can do sourcedescriptives after that. 'help freqanalysis', 'help sourceanalysis' and 'help sourcedescriptives' should also help you further. Or you could have a look at the fieldtrip website. There are a lot of options to taylor the analysis to your data. Hope this helps! Best, Hanneke van Dijk ------------------------------------------------------------ Institute for Clinical Neuroscience and Medical Psychology Heinrich Heine Universitaet, Duesseldorf, Germany ------------------------------------------------------------ -----Oorspronkelijk bericht----- Van: FieldTrip discussion list namens Rajamoni Nadar, Sreenivasan (NIH/NIMH) [E] Verzonden: do 26.11.2009 14:53 Aan: FIELDTRIP at NIC.SURFNET.NL Onderwerp: [FIELDTRIP] single trial source signal FieldTrip Users, Is it possible to get single trial source signal using FieldTrip? I would appreciate if anybody could provide code for the same. Thank you, Vasan ---------------------------------- The aim of this list is to facilitate the discussion between users of the FieldTrip toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/neuroimaging/fieldtrip. ---------------------------------- The aim of this list is to facilitate the discussion between users of the FieldTrip toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/neuroimaging/fieldtrip. From sreenivasan.r.nadar at GMAIL.COM Mon Nov 30 21:02:13 2009 From: sreenivasan.r.nadar at GMAIL.COM (Sreenivasan Rajamoni Nadar) Date: Mon, 30 Nov 2009 15:02:13 -0500 Subject: single trial source signal In-Reply-To: <72E993C35FB11743B79FF9286E5B6D8B0F3538@Mail2-UKD.VMED.UKD> Message-ID: Dear FieldTrip users, I personally feel that the FieldTrip (latest version) does not seems to having the capability to extract single trial source signals using any of the the time domain beamformers: LCMV, MNE, SAM, LORETA, RV or using the frequency domain beamformer methods like DICS and PCC !! Please let me know if any of you made plugin codes to Fieldtrip to get single trial source data? Robert, Could you let me know if there is any other version which does the above? Thank you, Vasan ---------------------------------- The aim of this list is to facilitate the discussion between users of the FieldTrip toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/neuroimaging/fieldtrip. -------------- next part -------------- An HTML attachment was scrubbed... URL: