From hanneke.vandijk at FCDONDERS.RU.NL Wed Nov 1 09:54:15 2006 From: hanneke.vandijk at FCDONDERS.RU.NL (Hanneke van Dijk) Date: Wed, 1 Nov 2006 09:54:15 +0100 Subject: Clusterrandanalysis In-Reply-To: <7.0.0.16.0.20061031180808.019e58a8@tiscali.it> Message-ID: Dear all, I have been working with clusterrandanalysis a while ago and started the same scripts this week, but I don't seem to be able to replicate my previous results. Has something been changed in the function? If yes, how can I solve that? Best, Hanneke _________________________________________________ Hanneke van Dijk-van de Geijn Ph. D. Student Measuring and Modeling Magnetic Brain Activity F.C. Donders Centre for Cognitive Neuroimaging. e-mail: hanneke.vandijk at fcdonders.ru.nl tel: 024-3610985 From maris at NICI.RU.NL Wed Nov 1 10:19:24 2006 From: maris at NICI.RU.NL (Eric Maris) Date: Wed, 1 Nov 2006 10:19:24 +0100 Subject: Clusterrandanalysis In-Reply-To: <000601c6fd93$4f2f5640$302dae83@fcdonders.nl> Message-ID: Dear Hanneke, > -----Original Message----- > From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf Of > Hanneke van Dijk > Sent: Wednesday, November 01, 2006 9:54 AM > To: FIELDTRIP at NIC.SURFNET.NL > Subject: [FIELDTRIP] Clusterrandanalysis > > Dear all, > > I have been working with clusterrandanalysis a while ago and started the > same scripts this week, but I don't seem to be able to replicate my previous > results. Has something been changed in the function? If yes, how can I solve > that? I have discussed this with Vladimir Litvak in a non-discussion-list-correspondence. The non-reproducibility is due to an error in the old code (not serious, however). Here is an excerpt from an email to Vladimir that may clarify things: BEGIN EXCERPT With respect to the non-reproducibility of your old result, the cause of the problem lies in the private subfunction findcluster.m. In the old version of findcluster.m (the one you used for your first analyses), the pruning of significant (sensor, frequency)-pairs, as controlled by cfg.minnbchan, was performed incorrectly. This has no consequence for false alarm rate control, because the pruning is part of the procedure for calculating the overall test statistic (i.e., the maximum cluster-level statistic), and the nonparametric test controls the false alarm rat for all test statistics. You will get your old result with the latest FT version if you replace cfg.minnbchan=2 by cfg.minnbchan=1. The error in the old version of findcluster.m was that the number of neighboring significant (sensor, frequency)-pairs was calculated incorrectly for symmetric neighbourhood structures. So, when reporting about your results, you have to change nothing, except that you may mention that the option cfg.minnbchan=1 was used. END EXCERPT Good luck, Eric From r.oostenveld at FCDONDERS.RU.NL Wed Nov 1 14:20:52 2006 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Wed, 1 Nov 2006 14:20:52 +0100 Subject: SPM integration In-Reply-To: <007b01c6fcf5$e06e7440$f0463ec1@sobell.ion.ucl.ac.uk> Message-ID: Hi Vladimir, On 31 Oct 2006, at 15:06, Vladimir Litvak wrote: > I'm starting to work on a project where I will analyze data > preprocessed in FT with SPM5 (www.fil.ion.ucl.ac.uk/spm/). For this > purpose I'd like to develop FT/SPM integration routines. It would be really nice if you could work on that. > I'll probably start with my immediate needs but I think I'm > motivated enough at the moment to eventually turn it into something > of general usefulness. If anyone has already worked in this > direction and has some code or would like to collaborate please let > me know. I am not aware of anything substantial in this direction, except that James Kilner and I have been exchanging emails about CTF dataformats (it could be that he is using snippets of our code). Furthermore, I know that Stefan Kiebel has integrated the EEG forward modelling code from FieldTrip into SPM. I have CCd this mail to them. > I'm affiliated to the methods group at FIL so I can get help from > SPM developers if necessary. Right now I'd like to be able to use > FT to read any FT supported format to SPM. I have split off the import routines (the "fileio" part) that we use in FieldTrip into a seperate package, already with the idea that other projects (SPM, EEGLAB) can reuse and contribute to the reading functions. So you can use the reading functions seperately from FieldTrip. That means that you will not be using the cfg-structure interface to the high-level FT functions, but that you will use the lower level read_header/read_data/read_event functions. See http://www2.ru.nl/fcdonders/fieldtrip/doku.php? id=fieldtrip:development:read_fcdc_xxx The download for the fileio functions is available from ftp:// ftp.fcdonders.nl/pub/fieldtrip/modules. I am considering moving the FT version control system (esp. for the fileio and forwinv module) to an external server (e.g. sourceforge) so that other people can contribute. Sofar I did not find that neccessary, and all external contributions go through email. > Additional question: how does one create low-level routines for a > new (rare) data format to be used by FT preprocessing? Is there a > template or some interface they should adhere to? I suggest that you look into read_header/read_data/read_event (in fieldtrip/private), and that you pick one of the already supported formats that you are familiar with as template. There is also some (sparse) documentation on http://www2.ru.nl/fcdonders/fieldtrip/doku.php? id=fieldtrip:documentation:dataformats#how_can_i_import_my_own_dataforma t. Furthermore, I could dig up some old emails with additional explanation (you are not the first to contribute data format specific code), but I think that the info sofar should already get you started. I will try to update the documentation on the FT wiki as well. best regards, Robert From r.oostenveld at FCDONDERS.RU.NL Wed Nov 1 15:01:17 2006 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Wed, 1 Nov 2006 15:01:17 +0100 Subject: lcmv localization In-Reply-To: <7.0.0.16.0.20061031180808.019e58a8@tiscali.it> Message-ID: Dear Luca, On 31 Oct 2006, at 18:28, Luca Ciancetta wrote: > I'm trying to localize a source with the lcmv method. I understand that you want to use simulated and SEF data. What kind of MEG system do you have? In the code below, you seem to be putting effort into construcing some details that I would not expect to be neccessary (but I might be wrong). > Following, it's the configuration I use: > > time_step = 1/h.smpfq; % the time step depends by sampling frequency > time = 0:time_step:(500*time_step); % I want to see 500 points of data this will give you 501 samples, the first sample is "0", the second is "1" etc. > data.trial{1} = data_raw(gch,0:500); % gch: list of good channels > data.time{1} = time; I suggest that you construct the "grad" seperately, and that you store it in the data (i.e. data.grad = your structure). That also helps for plotting the data. > cfg = []; > cfg.method = 'lcmv'; > cfg.grid.pos = model; % model is a matrix [number_of_sources X 3]. > This represent position of dipoles in the reference of the sphere > which contains them. > > cfg.grad.tra = zeros(nch,nch); % number of good sensors ( size of > 'gch' list ) > for i=1:nch > cfg.grad.pnt(i,: ) = h.ch(gch(i)+offset).pos(1).r_s.comp'; % > positions of MEG sensors in the reference of the spherical model > cfg.grad.ori(i,: ) = h.ch(gch(i)+offset).pos(1).u_s.comp'; % > orientations of MEG sensors in the reference of the spherical model > cfg.grad.tra(i,i) = 1; > cfg.grad.label{i} = sprintf('MZ_%d\n',gch(i)-1); > end Note that all orientation vectors should have length 1, i.e. norm (grad.ori(i,:))=1. The MEG sensors are usually given in head coordinates (i.e. related to the nose and ears in most MEG systems), and the (spherical) volume conduction model can also be defined in head coordinates. SO you don't have to express the positions of MEG sensors in the reference of the spherical model. If you do that, you should also express your dipoles in the same spherical model. All geometrical objects (sensors, dipoles, geometry of the head model) should be expressed in the same coordinates and the same units. > cfg.vol = []; > cfg.vol.r = 65; I presume that you use "mm" as units? You should also add the center of the sphere, i.e. cfg.vol.o = [0 0 0]; The center of the sphere is by default in the origin, but it is good to be explicit about it. > cfg.bpfilter = 'yes'; > cfg.bpfreq = [1 100]; These settings are _not_ used in SOURCEANALYSIS. > data.avg = squeeze(data.trial{1}); > > source = sourceanalysis(cfg,data); Probably you want to use a protocol like this preprocessing -> timelockanalysis -> sourceanalysis where the preprocessing is done manually (i.e. not in FT). You can do timelockanalysis manually as well, but it is more convenient to use FTs timelockanalysis anyway. The filter options above relate to timelockanalysis. Furthermore, you should use cfg.covariance='yes' in timelockanalysis, and you can specify a covariance latency window. > In this case I used only one trial and the result is a localization > in the center of the sphere ( the source is a dipole simulation, it > was placed on the surface of my spherical model). > Also analyzing over more trials or using different data set, for > example a median nerve stimulation, the result was the same. To me it is not clear where your data comes from (since you include only parts of your script), and therefore it is not clear where your problem stems from. See my suggestions above. Your problem may also be related to plotting the power, and not the neural activity index (source.avg.nai, obtained after SOURCEDESCRIPTIVES), the beamformer power is biuassed to deep locations, the NAI corrects that. See http://www2.ru.nl/fcdonders/fieldtrip/doku.php? id=fieldtrip:documentation:tutorial:beamformer#plot_the_result and further on that page. best regards, Robert From marie at PSY.GLA.AC.UK Tue Nov 7 18:59:48 2006 From: marie at PSY.GLA.AC.UK (Marie Smith) Date: Tue, 7 Nov 2006 17:59:48 +0000 Subject: Meg realign In-Reply-To: Message-ID: Hi, I am trying to use the megrealign function in fieldtrip and get an error from the headsurface function that it cannot find the function retriangulate. I have searched through the Fieldtrip toolbox and this does not appear to be a function that is provided. Can you tell me how to get hold of this function or how to perform the realignment without calling it. Thanks, Marie From r.oostenveld at FCDONDERS.RU.NL Tue Nov 7 20:07:13 2006 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Tue, 7 Nov 2006 20:07:13 +0100 Subject: Meg realign In-Reply-To: <7AF45CEA-EBDB-4C89-BD52-B7B613FE4618@psy.gla.ac.uk> Message-ID: Hi Marie I just checked, retriangulate is at least in the latest version of fieldtrip (in the fieldtrip/private directory, where it also should be). It may be missing from your copy if your copy is old. Please get the latest fieldtrip version from the ftp server. best regards, Robert On 7 Nov 2006, at 18:59, Marie Smith wrote: > Hi, > > I am trying to use the megrealign function in fieldtrip and get an > error from the headsurface function that it cannot find the > function retriangulate. > I have searched through the Fieldtrip toolbox and this does not > appear to be a function that is provided. > > Can you tell me how to get hold of this function or how to perform > the realignment without calling it. > > Thanks, > > Marie From p.cornelissen at PSYCH.YORK.AC.UK Wed Nov 8 15:19:00 2006 From: p.cornelissen at PSYCH.YORK.AC.UK (Piers Cornelissen) Date: Wed, 8 Nov 2006 15:19:00 +0100 Subject: Statistical comparisons in virtual electrode spectrograms Message-ID: Dear all Can anyone advise on the following: I have 6 sets of virtual electrode data (from CTF based MEG recordings) from a total of 9 subjects, each of whom carried out 4 conditions of interest. So far, for each virtual electrode I have succeeded (I hope) in computing group level spectrograms for each condition, where each spectrogram reflects either evoked or evoked+induced power changes. What I would like to do is to a) compare spectrograms, and also b)compute statistics for each group level spectrogram to ask the question whether the power changes in the active window (0 - 700ms) are significantly different from the those in the passive/baseline window (-250 - 0 ms). So far I have had alot of help from Jan, and, on his suggestion, I have copied out my query below, plus provided the matlab scripts which cause the problem: The attached script E_versus_EI.m shows the code for analysing one condition from one particular virtual electrode. This gives the evoked as well as the evoked+induced spectrograms (as far as I understand it). To carry out the comaprison between the evoked versus evoked+Induced test, I thought I should be able to modify the freqgrandaverage step for generating both iefgranfavg and efgrandavg by setting cfg.keepindividual to 'yes'. In doing so, I was hoping that this would retain the 9 separate powerspectra in each case, which it seems to have done. I was then hoping that this would be sufficient input to the second script test_clusrand.m (which is just a minor modification of E_versus_EL.m). Certainly the powspctrm field for each dataset appears as: [4-D double] which I think is correct. However, when I ran clusterrandanalysis on iefgranfavg and efgrandavg, I got the following errors: >> cfg15 = statistic: 'depsamplesT' alphathresh: 0.0500 makeclusters: 'yes' minnbchan: 2 clusterteststat: 'maxsum' onetwo: 'twosided' alpha: 0.0500 nranddraws: 100 channel: {'V0'} >> %cfg15.latency = [0 0.5] % increases sensitivity if prior temporal information is knowm >> cfg15.frequency = [5 40]; >> >> %frange = 'all_freqs'; % file addition for saving >> >> [clusrand] = clusterrandanalysis (cfg15, ind_efgrandavg, ind_iefgrandavg); Selecting and formatting the data. selected 1 channels selected 191 time bins selected 176 frequency bins Calculating the neighbourhood structure of the channels. ??? Error using ==> clusterrandanalysis (getneighbgeometry) Did not find gradiometer or electrode information. Error in ==> /home/willis/plc/matlab/clusterrandanalysis.m On line 473 ==> [cfg,data] = getneighbgeometry(cfg,data,varargin{1}); >> I noticed also that the way I used freqgrandaverage in order to compile the two datasets appeared to throw out the gradiometer information. At least there was a warning to this effect. So, I am guessing that using freqgrandaverage in this way is incorrect. Therefore please could anyone suggest how I compile my 2 sets of nine spectrograms in such a way that they provide appropriate input to clusterrandanalysis. Or, if as Jan seems to suggest, that clusterrandanalysis can't cope with virtual electrode data, does anyone have any other clever solutions. Please! Thanks in anticipation Piers C -------------- next part -------------- A non-text attachment was scrubbed... Name: test_clusrand.m Type: application/octet-stream Size: 4665 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: E_versus_EI.m Type: application/octet-stream Size: 4809 bytes Desc: not available URL: From maris at NICI.RU.NL Wed Nov 8 16:05:53 2006 From: maris at NICI.RU.NL (Eric Maris) Date: Wed, 8 Nov 2006 16:05:53 +0100 Subject: Statistical comparisons in virtual electrode spectrograms In-Reply-To: Message-ID: Hi Piers, I think this is an easy problem to solve. In fact, you are not the first person to stumble over it. The cause of the problem is that freqgrandaverage throws away the gradiometer configurations (the .grad-fields) that are present in each of the subject-specific data structures produced by freqanalysis. The solution is simple: Copy a .grad-field from one subjects (it does not matter which one) to ind_efgrandavg and rerun clusterrandanalysis. In the analysis, this .grad-field is only used to calculate the neighbourhood-structure. Good luck, Eric Maris > -----Original Message----- > From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf Of > Piers Cornelissen > Sent: Wednesday, November 08, 2006 3:19 PM > To: FIELDTRIP at NIC.SURFNET.NL > Subject: [FIELDTRIP] Statistical comparisons in virtual electrode spectrograms > > Dear all > > Can anyone advise on the following: > > I have 6 sets of virtual electrode data (from CTF based MEG recordings) > from a total of 9 subjects, each of whom carried out 4 conditions of > interest. > > So far, for each virtual electrode I have succeeded (I hope) in computing > group level spectrograms for each condition, where each spectrogram > reflects either evoked or evoked+induced power changes. > > What I would like to do is to a) compare spectrograms, and also b)compute > statistics for each group level spectrogram to ask the question whether > the power changes in the active window (0 - 700ms) are significantly > different from the those in the passive/baseline window (-250 - 0 ms). > > So far I have had alot of help from Jan, and, on his suggestion, I have > copied out my query below, plus provided the matlab scripts which cause > the problem: > > The attached script E_versus_EI.m shows the code for > analysing one condition from one particular virtual electrode. This gives > the evoked as well as the evoked+induced spectrograms (as far as I > understand it). > > To carry out the comaprison between the evoked versus evoked+Induced test, > I thought I should be able to modify the freqgrandaverage step for > generating both iefgranfavg and efgrandavg by setting cfg.keepindividual > to 'yes'. In doing so, I was hoping that this would retain the 9 separate > powerspectra in each case, which it seems to have done. I was then hoping > that this would be sufficient input to the second script test_clusrand.m > (which is just a minor modification of E_versus_EL.m). Certainly the > powspctrm field for each dataset appears as: [4-D double] which I think is > correct. > > However, when I ran clusterrandanalysis on iefgranfavg and efgrandavg, I > got the following errors: > > >> > cfg15 = > > statistic: 'depsamplesT' > alphathresh: 0.0500 > makeclusters: 'yes' > minnbchan: 2 > clusterteststat: 'maxsum' > onetwo: 'twosided' > alpha: 0.0500 > nranddraws: 100 > channel: {'V0'} > > >> %cfg15.latency = [0 0.5] % increases sensitivity if prior temporal > information is knowm > >> cfg15.frequency = [5 40]; > >> > >> %frange = 'all_freqs'; % file addition for saving > >> > >> [clusrand] = clusterrandanalysis (cfg15, ind_efgrandavg, > ind_iefgrandavg); > Selecting and formatting the data. > selected 1 channels > selected 191 time bins > selected 176 frequency bins > Calculating the neighbourhood structure of the channels. > ??? Error using ==> clusterrandanalysis (getneighbgeometry) > Did not find gradiometer or electrode information. > > Error in ==> /home/willis/plc/matlab/clusterrandanalysis.m > On line 473 ==> [cfg,data] = getneighbgeometry(cfg,data,varargin{1}); > > >> > > I noticed also that the way I used freqgrandaverage in order to compile > the two datasets appeared to throw out the gradiometer information. At > least there was a warning to this effect. So, I am guessing that using > freqgrandaverage in this way is incorrect. Therefore please could anyone > suggest how I compile my 2 sets of nine spectrograms in such a way that > they provide appropriate input to clusterrandanalysis. Or, if as Jan seems > to suggest, that clusterrandanalysis can't cope with virtual electrode > data, does anyone have any other clever solutions. > > Please! > > Thanks in anticipation > > Piers C > > > > > > From Jan.Schoffelen at FCDONDERS.RU.NL Wed Nov 8 16:15:34 2006 From: Jan.Schoffelen at FCDONDERS.RU.NL (Jan Mathijs Schoffelen) Date: Wed, 8 Nov 2006 16:15:34 +0100 Subject: Statistical comparisons in virtual electrode spectrograms In-Reply-To: <014c01c70347$62b18170$6401a8c0@fcdonders.nl> Message-ID: Hi Piers and Eric, Eric, you're absolutely right in the case one would analyze sensor-data. However, Piers is working on virtual channel data, so the actual neighbourhood structure does not exist at all, and should be defined such that none of the channels actually has a neighbour. Yours, Jan-Mathijs -----Original Message----- From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf Of Eric Maris Sent: Wednesday, November 08, 2006 4:06 PM To: FIELDTRIP at NIC.SURFNET.NL Subject: Re: [FIELDTRIP] Statistical comparisons in virtual electrode spectrograms Hi Piers, I think this is an easy problem to solve. In fact, you are not the first person to stumble over it. The cause of the problem is that freqgrandaverage throws away the gradiometer configurations (the .grad-fields) that are present in each of the subject-specific data structures produced by freqanalysis. The solution is simple: Copy a .grad-field from one subjects (it does not matter which one) to ind_efgrandavg and rerun clusterrandanalysis. In the analysis, this .grad-field is only used to calculate the neighbourhood-structure. Good luck, Eric Maris > -----Original Message----- > From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf Of > Piers Cornelissen > Sent: Wednesday, November 08, 2006 3:19 PM > To: FIELDTRIP at NIC.SURFNET.NL > Subject: [FIELDTRIP] Statistical comparisons in virtual electrode spectrograms > > Dear all > > Can anyone advise on the following: > > I have 6 sets of virtual electrode data (from CTF based MEG recordings) > from a total of 9 subjects, each of whom carried out 4 conditions of > interest. > > So far, for each virtual electrode I have succeeded (I hope) in computing > group level spectrograms for each condition, where each spectrogram > reflects either evoked or evoked+induced power changes. > > What I would like to do is to a) compare spectrograms, and also b)compute > statistics for each group level spectrogram to ask the question whether > the power changes in the active window (0 - 700ms) are significantly > different from the those in the passive/baseline window (-250 - 0 ms). > > So far I have had alot of help from Jan, and, on his suggestion, I have > copied out my query below, plus provided the matlab scripts which cause > the problem: > > The attached script E_versus_EI.m shows the code for > analysing one condition from one particular virtual electrode. This gives > the evoked as well as the evoked+induced spectrograms (as far as I > understand it). > > To carry out the comaprison between the evoked versus evoked+Induced test, > I thought I should be able to modify the freqgrandaverage step for > generating both iefgranfavg and efgrandavg by setting cfg.keepindividual > to 'yes'. In doing so, I was hoping that this would retain the 9 separate > powerspectra in each case, which it seems to have done. I was then hoping > that this would be sufficient input to the second script test_clusrand.m > (which is just a minor modification of E_versus_EL.m). Certainly the > powspctrm field for each dataset appears as: [4-D double] which I think is > correct. > > However, when I ran clusterrandanalysis on iefgranfavg and efgrandavg, I > got the following errors: > > >> > cfg15 = > > statistic: 'depsamplesT' > alphathresh: 0.0500 > makeclusters: 'yes' > minnbchan: 2 > clusterteststat: 'maxsum' > onetwo: 'twosided' > alpha: 0.0500 > nranddraws: 100 > channel: {'V0'} > > >> %cfg15.latency = [0 0.5] % increases sensitivity if prior temporal > information is knowm > >> cfg15.frequency = [5 40]; > >> > >> %frange = 'all_freqs'; % file addition for saving > >> > >> [clusrand] = clusterrandanalysis (cfg15, ind_efgrandavg, > ind_iefgrandavg); > Selecting and formatting the data. > selected 1 channels > selected 191 time bins > selected 176 frequency bins > Calculating the neighbourhood structure of the channels. > ??? Error using ==> clusterrandanalysis (getneighbgeometry) > Did not find gradiometer or electrode information. > > Error in ==> /home/willis/plc/matlab/clusterrandanalysis.m > On line 473 ==> [cfg,data] = getneighbgeometry(cfg,data,varargin{1}); > > >> > > I noticed also that the way I used freqgrandaverage in order to compile > the two datasets appeared to throw out the gradiometer information. At > least there was a warning to this effect. So, I am guessing that using > freqgrandaverage in this way is incorrect. Therefore please could anyone > suggest how I compile my 2 sets of nine spectrograms in such a way that > they provide appropriate input to clusterrandanalysis. Or, if as Jan seems > to suggest, that clusterrandanalysis can't cope with virtual electrode > data, does anyone have any other clever solutions. > > Please! > > Thanks in anticipation > > Piers C > > > > > > From maris at NICI.RU.NL Wed Nov 8 16:26:28 2006 From: maris at NICI.RU.NL (Eric Maris) Date: Wed, 8 Nov 2006 16:26:28 +0100 Subject: Statistical comparisons in virtual electrode spectrograms In-Reply-To: Message-ID: Hi Piers, In my first reply to your email, I didn't notice that you were analyzing virtual channels. In that case, the suggestion in my previous email will not work. As I see it now, you have only a single virtual channel. In other words, you do not have a spatial dimension in your data. Nevertheless, clusterrandanalysis wants a spatial neighbourhood structure. In the case of virtual channels, you have to construct this neighbourhood structure by hand. Read the help info of clusterrandanalysis, and you will find out how to specify a neighbourhood structure as a cell array (in your case, of length 1) of structs. I also read that you want to compare evoked and (evoked + induced) power spectra. Are these power spectra calculated on the same raw data? If this is the case, does it make sense to test the null hypothesis that they come from the same probability distribution (which is what clusterrandanalysis tests)? This null hypothesis would imply that the pure induced power spectra are zero. Do I see this correctly? Greetings, Eric > -----Original Message----- > From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf Of > Piers Cornelissen > Sent: Wednesday, November 08, 2006 3:19 PM > To: FIELDTRIP at NIC.SURFNET.NL > Subject: [FIELDTRIP] Statistical comparisons in virtual electrode spectrograms > > Dear all > > Can anyone advise on the following: > > I have 6 sets of virtual electrode data (from CTF based MEG recordings) > from a total of 9 subjects, each of whom carried out 4 conditions of > interest. > > So far, for each virtual electrode I have succeeded (I hope) in computing > group level spectrograms for each condition, where each spectrogram > reflects either evoked or evoked+induced power changes. > > What I would like to do is to a) compare spectrograms, and also b)compute > statistics for each group level spectrogram to ask the question whether > the power changes in the active window (0 - 700ms) are significantly > different from the those in the passive/baseline window (-250 - 0 ms). > > So far I have had alot of help from Jan, and, on his suggestion, I have > copied out my query below, plus provided the matlab scripts which cause > the problem: > > The attached script E_versus_EI.m shows the code for > analysing one condition from one particular virtual electrode. This gives > the evoked as well as the evoked+induced spectrograms (as far as I > understand it). > > To carry out the comaprison between the evoked versus evoked+Induced test, > I thought I should be able to modify the freqgrandaverage step for > generating both iefgranfavg and efgrandavg by setting cfg.keepindividual > to 'yes'. In doing so, I was hoping that this would retain the 9 separate > powerspectra in each case, which it seems to have done. I was then hoping > that this would be sufficient input to the second script test_clusrand.m > (which is just a minor modification of E_versus_EL.m). Certainly the > powspctrm field for each dataset appears as: [4-D double] which I think is > correct. > > However, when I ran clusterrandanalysis on iefgranfavg and efgrandavg, I > got the following errors: > > >> > cfg15 = > > statistic: 'depsamplesT' > alphathresh: 0.0500 > makeclusters: 'yes' > minnbchan: 2 > clusterteststat: 'maxsum' > onetwo: 'twosided' > alpha: 0.0500 > nranddraws: 100 > channel: {'V0'} > > >> %cfg15.latency = [0 0.5] % increases sensitivity if prior temporal > information is knowm > >> cfg15.frequency = [5 40]; > >> > >> %frange = 'all_freqs'; % file addition for saving > >> > >> [clusrand] = clusterrandanalysis (cfg15, ind_efgrandavg, > ind_iefgrandavg); > Selecting and formatting the data. > selected 1 channels > selected 191 time bins > selected 176 frequency bins > Calculating the neighbourhood structure of the channels. > ??? Error using ==> clusterrandanalysis (getneighbgeometry) > Did not find gradiometer or electrode information. > > Error in ==> /home/willis/plc/matlab/clusterrandanalysis.m > On line 473 ==> [cfg,data] = getneighbgeometry(cfg,data,varargin{1}); > > >> > > I noticed also that the way I used freqgrandaverage in order to compile > the two datasets appeared to throw out the gradiometer information. At > least there was a warning to this effect. So, I am guessing that using > freqgrandaverage in this way is incorrect. Therefore please could anyone > suggest how I compile my 2 sets of nine spectrograms in such a way that > they provide appropriate input to clusterrandanalysis. Or, if as Jan seems > to suggest, that clusterrandanalysis can't cope with virtual electrode > data, does anyone have any other clever solutions. > > Please! > > Thanks in anticipation > > Piers C > > > > > > From p.cornelissen at PSYCH.YORK.AC.UK Wed Nov 8 16:42:51 2006 From: p.cornelissen at PSYCH.YORK.AC.UK (Piers Cornelissen) Date: Wed, 8 Nov 2006 15:42:51 +0000 Subject: Statistical comparisons in virtual electrode spectrograms In-Reply-To: <015001c7034a$42919990$6401a8c0@fcdonders.nl> Message-ID: Dear Eric thanks for your thoughts. I would like to try: "a neighbourhood structure as a cell array (in your case, of length 1) of structs". But could you clarify a little more what the syntax would be for this cfg? Re- the hypothesis tests, when I put the script together I hadn't really thought through the hypothesis testing carefully. I was just trying to get something to work at all. But you are quite right, it doesn't make sense to statistically compare E versus E+I However, I do want to apply a test, separately, for E baseline v E active, *and* E+I baseline versus E+I active. Might it make sense, do you think, to compare ([E+I]-E) baseline versus ([E+I]-E) active, to try to work out whether there is indeed any significant induced activity? Best regards Piers > Hi Piers, > > > > In my first reply to your email, I didn't notice that you were analyzing > virtual channels. In that case, the suggestion in my previous email will not > work. As I see it now, you have only a single virtual channel. In other > words, you do not have a spatial dimension in your data. Nevertheless, > clusterrandanalysis wants a spatial neighbourhood structure. In the case of > virtual channels, you have to construct this neighbourhood structure by > hand. Read the help info of clusterrandanalysis, and you will find out how > to specify a neighbourhood structure as a cell array (in your case, of > length 1) of structs. > > I also read that you want to compare evoked and (evoked + induced) power > spectra. Are these power spectra calculated on the same raw data? If this is > the case, does it make sense to test the null hypothesis that they come from > the same probability distribution (which is what clusterrandanalysis tests)? > This null hypothesis would imply that the pure induced power spectra are > zero. Do I see this correctly? > > > Greetings, > > Eric > > > > >> -----Original Message----- >> From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On >> > Behalf Of > >> Piers Cornelissen >> Sent: Wednesday, November 08, 2006 3:19 PM >> To: FIELDTRIP at NIC.SURFNET.NL >> Subject: [FIELDTRIP] Statistical comparisons in virtual electrode >> > spectrograms > >> Dear all >> >> Can anyone advise on the following: >> >> I have 6 sets of virtual electrode data (from CTF based MEG recordings) >> from a total of 9 subjects, each of whom carried out 4 conditions of >> interest. >> >> So far, for each virtual electrode I have succeeded (I hope) in computing >> group level spectrograms for each condition, where each spectrogram >> reflects either evoked or evoked+induced power changes. >> >> What I would like to do is to a) compare spectrograms, and also b)compute >> statistics for each group level spectrogram to ask the question whether >> the power changes in the active window (0 - 700ms) are significantly >> different from the those in the passive/baseline window (-250 - 0 ms). >> >> So far I have had alot of help from Jan, and, on his suggestion, I have >> copied out my query below, plus provided the matlab scripts which cause >> the problem: >> >> The attached script E_versus_EI.m shows the code for >> analysing one condition from one particular virtual electrode. This gives >> the evoked as well as the evoked+induced spectrograms (as far as I >> understand it). >> >> To carry out the comaprison between the evoked versus evoked+Induced test, >> I thought I should be able to modify the freqgrandaverage step for >> generating both iefgranfavg and efgrandavg by setting cfg.keepindividual >> to 'yes'. In doing so, I was hoping that this would retain the 9 separate >> powerspectra in each case, which it seems to have done. I was then hoping >> that this would be sufficient input to the second script test_clusrand.m >> (which is just a minor modification of E_versus_EL.m). Certainly the >> powspctrm field for each dataset appears as: [4-D double] which I think is >> correct. >> >> However, when I ran clusterrandanalysis on iefgranfavg and efgrandavg, I >> got the following errors: >> >> >> cfg15 = >> >> statistic: 'depsamplesT' >> alphathresh: 0.0500 >> makeclusters: 'yes' >> minnbchan: 2 >> clusterteststat: 'maxsum' >> onetwo: 'twosided' >> alpha: 0.0500 >> nranddraws: 100 >> channel: {'V0'} >> >> >>>> %cfg15.latency = [0 0.5] % increases sensitivity if prior temporal >>>> >> information is knowm >> >>>> cfg15.frequency = [5 40]; >>>> >>>> %frange = 'all_freqs'; % file addition for saving >>>> >>>> [clusrand] = clusterrandanalysis (cfg15, ind_efgrandavg, >>>> >> ind_iefgrandavg); >> Selecting and formatting the data. >> selected 1 channels >> selected 191 time bins >> selected 176 frequency bins >> Calculating the neighbourhood structure of the channels. >> ??? Error using ==> clusterrandanalysis (getneighbgeometry) >> Did not find gradiometer or electrode information. >> >> Error in ==> /home/willis/plc/matlab/clusterrandanalysis.m >> On line 473 ==> [cfg,data] = getneighbgeometry(cfg,data,varargin{1}); >> >> >> I noticed also that the way I used freqgrandaverage in order to compile >> the two datasets appeared to throw out the gradiometer information. At >> least there was a warning to this effect. So, I am guessing that using >> freqgrandaverage in this way is incorrect. Therefore please could anyone >> suggest how I compile my 2 sets of nine spectrograms in such a way that >> they provide appropriate input to clusterrandanalysis. Or, if as Jan seems >> to suggest, that clusterrandanalysis can't cope with virtual electrode >> data, does anyone have any other clever solutions. >> >> Please! >> >> Thanks in anticipation >> >> Piers C >> >> >> >> >> >> >> > > > > From maris at NICI.RU.NL Wed Nov 8 16:54:58 2006 From: maris at NICI.RU.NL (Eric Maris) Date: Wed, 8 Nov 2006 16:54:58 +0100 Subject: Statistical comparisons in virtual electrode spectrograms In-Reply-To: <4551FAFB.5070801@psych.york.ac.uk> Message-ID: Hi Piers, > I would like to try: "a neighbourhood structure as a cell array (in your > case, of length 1) of structs". But could you clarify a little more what > the syntax would be for this cfg? Type "Help clusterrandanalysis" on the Matlab command line. > Re- the hypothesis tests, when I put the script together I hadn't really > thought through the hypothesis testing carefully. I was just trying to > get something to work at all. > > But you are quite right, it doesn't make sense to statistically compare > E versus E+I > > However, I do want to apply a test, separately, for E baseline v E > active, *and* E+I baseline versus E+I active. > > Might it make sense, do you think, to compare ([E+I]-E) baseline versus > ([E+I]-E) active, to try to work out whether there is indeed any > significant induced activity? I think this makes sense. For activation-versus-baseline testing, you better use the activation-versus-baseline t-statistic instead of the dependent-samples t-statistic. Greetings, Eric > > Best regards > > Piers > > Hi Piers, > > > > > > > > In my first reply to your email, I didn't notice that you were analyzing > > virtual channels. In that case, the suggestion in my previous email will not > > work. As I see it now, you have only a single virtual channel. In other > > words, you do not have a spatial dimension in your data. Nevertheless, > > clusterrandanalysis wants a spatial neighbourhood structure. In the case of > > virtual channels, you have to construct this neighbourhood structure by > > hand. Read the help info of clusterrandanalysis, and you will find out how > > to specify a neighbourhood structure as a cell array (in your case, of > > length 1) of structs. > > > > I also read that you want to compare evoked and (evoked + induced) power > > spectra. Are these power spectra calculated on the same raw data? If this is > > the case, does it make sense to test the null hypothesis that they come from > > the same probability distribution (which is what clusterrandanalysis tests)? > > This null hypothesis would imply that the pure induced power spectra are > > zero. Do I see this correctly? > > > > > > Greetings, > > > > Eric > > > > > > > > > >> -----Original Message----- > >> From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On > >> > > Behalf Of > > > >> Piers Cornelissen > >> Sent: Wednesday, November 08, 2006 3:19 PM > >> To: FIELDTRIP at NIC.SURFNET.NL > >> Subject: [FIELDTRIP] Statistical comparisons in virtual electrode > >> > > spectrograms > > > >> Dear all > >> > >> Can anyone advise on the following: > >> > >> I have 6 sets of virtual electrode data (from CTF based MEG recordings) > >> from a total of 9 subjects, each of whom carried out 4 conditions of > >> interest. > >> > >> So far, for each virtual electrode I have succeeded (I hope) in computing > >> group level spectrograms for each condition, where each spectrogram > >> reflects either evoked or evoked+induced power changes. > >> > >> What I would like to do is to a) compare spectrograms, and also b)compute > >> statistics for each group level spectrogram to ask the question whether > >> the power changes in the active window (0 - 700ms) are significantly > >> different from the those in the passive/baseline window (-250 - 0 ms). > >> > >> So far I have had alot of help from Jan, and, on his suggestion, I have > >> copied out my query below, plus provided the matlab scripts which cause > >> the problem: > >> > >> The attached script E_versus_EI.m shows the code for > >> analysing one condition from one particular virtual electrode. This gives > >> the evoked as well as the evoked+induced spectrograms (as far as I > >> understand it). > >> > >> To carry out the comaprison between the evoked versus evoked+Induced test, > >> I thought I should be able to modify the freqgrandaverage step for > >> generating both iefgranfavg and efgrandavg by setting cfg.keepindividual > >> to 'yes'. In doing so, I was hoping that this would retain the 9 separate > >> powerspectra in each case, which it seems to have done. I was then hoping > >> that this would be sufficient input to the second script test_clusrand.m > >> (which is just a minor modification of E_versus_EL.m). Certainly the > >> powspctrm field for each dataset appears as: [4-D double] which I think is > >> correct. > >> > >> However, when I ran clusterrandanalysis on iefgranfavg and efgrandavg, I > >> got the following errors: > >> > >> > >> cfg15 = > >> > >> statistic: 'depsamplesT' > >> alphathresh: 0.0500 > >> makeclusters: 'yes' > >> minnbchan: 2 > >> clusterteststat: 'maxsum' > >> onetwo: 'twosided' > >> alpha: 0.0500 > >> nranddraws: 100 > >> channel: {'V0'} > >> > >> > >>>> %cfg15.latency = [0 0.5] % increases sensitivity if prior temporal > >>>> > >> information is knowm > >> > >>>> cfg15.frequency = [5 40]; > >>>> > >>>> %frange = 'all_freqs'; % file addition for saving > >>>> > >>>> [clusrand] = clusterrandanalysis (cfg15, ind_efgrandavg, > >>>> > >> ind_iefgrandavg); > >> Selecting and formatting the data. > >> selected 1 channels > >> selected 191 time bins > >> selected 176 frequency bins > >> Calculating the neighbourhood structure of the channels. > >> ??? Error using ==> clusterrandanalysis (getneighbgeometry) > >> Did not find gradiometer or electrode information. > >> > >> Error in ==> /home/willis/plc/matlab/clusterrandanalysis.m > >> On line 473 ==> [cfg,data] = getneighbgeometry(cfg,data,varargin{1}); > >> > >> > >> I noticed also that the way I used freqgrandaverage in order to compile > >> the two datasets appeared to throw out the gradiometer information. At > >> least there was a warning to this effect. So, I am guessing that using > >> freqgrandaverage in this way is incorrect. Therefore please could anyone > >> suggest how I compile my 2 sets of nine spectrograms in such a way that > >> they provide appropriate input to clusterrandanalysis. Or, if as Jan seems > >> to suggest, that clusterrandanalysis can't cope with virtual electrode > >> data, does anyone have any other clever solutions. > >> > >> Please! > >> > >> Thanks in anticipation > >> > >> Piers C > >> > >> > >> > >> > >> > >> > >> > > > > > > > > From lorina_naci at YAHOO.CO.UK Wed Nov 8 20:00:27 2006 From: lorina_naci at YAHOO.CO.UK (Lorina Naci) Date: Wed, 8 Nov 2006 19:00:27 +0000 Subject: Within-subject coherence statististics for virtual sources In-Reply-To: <004601c6f770$c7297aa0$902dae83@fcdonders.nl> Message-ID: Dear Jan-Mathijs, Thank you for the detailed help in your previous message. >For the time being, I assume that you have your data imported into a fieldtrip-like >format, using besa2fieldtrip. I am not familiar with this function, but when I read the >help of besa2fieldtrip I guess that your besa file was a .tfc file. So probably your >data-object looks like what fieldtrip considers to be a frequency-structure, containing >a TFR for each ROI. I guess you have two data-objects for each subject. One clarification: yes, i do have two data-object (or .tfc files) for each subject, one for each condition, but there are two types of .tfc files that I could use: either the raw time-frequency data for each condition, or the statistically analysed time-frequency data for that condition. BESA saves both of these as .tfc files. At the moment I am using the raw TFR data. I tried to run the script as you suggested but it did not work. The error message I get is to do with [stat] = statistics_wrapper(cfg, varargin{:}). It just gives me an error message pointing to this line,saying: error using fieldtrip-20061003/private/statistics_wrapper, could not determine the type of input data. Also, the function 'cfg.numrandomization' requires a number, but I am not sure what the choice of the number depends on? I've inputed 500 as in the documentation example. Finally, at risk making my ignorance of how Fieldtrip works entirely transparent, I am not quite sure how the function you send me 'statfun_diff.m' links with the 'freqstatistics.m,' and whether I do need to use it? I would greatly appreciate any help with this, Many thanks, Lorina Jan Mathijs Schoffelen wrote: v\:* {behavior:url(#default#VML);} o\:* {behavior:url(#default#VML);} w\:* {behavior:url(#default#VML);} .shape {behavior:url(#default#VML);} st1\:*{behavior:url(#default#ieooui) } Dear Lorina, For the time being, I assume that you have your data imported into a fieldtrip-like format, using besa2fieldtrip. I am not familiar with this function, but when I read the help of besa2fieldtrip I guess that your besa file was a .tfc file. So probably your data-object looks like what fieldtrip considers to be a frequency-structure, containing a TFR for each ROI. I guess you have two data-objects for each subject. What you would like to do is possible within fieldtrip, but I would advise you not to use clusterrandanalysis to get there. Quite some correspondence has been devoted to the new statistical interface, you can read about it on the discussion list’s website (follow the appropriate links on the fieldtrip website), concerning Re: clusterrandanalysis on scalar values + problem with topoplotER during the past month, but which started in August. In a nutshell: instead of using clusterrandanalysis you could use freqstatistics (under the above assumption that your data resembles a fieldtrip-frequency structure) with the appropriate settings to get your statistics done. Freqstatistics relies on statistics_montecarlo, when you specify cfg.method = ‘montecarlo’. Please have a try following the thread on the discussion list, and the following configuration settings, as well as the information in statistics_montecarlo and other dependent functions. You’ll probably need the attached function as well, which computes your statistic of interest. Cfg = []; Cfg.method = ‘montecarlo’; Cfg.statistic = ‘diff’; Cfg.parameter = ‘cohspctrm’; %This is at least what I expect your data objects to contain! Cfg.numrandomization = a number; Cfg.design = [1 1 2 2 3 3 with all the numbers in between 14 14; 1 2 1 2 1 2 with all the numbers in between 1 2]; %this specifies how the data has to be interpreted Cfg.ivar = 2; %row-index of independent variable, which is the condition in your case Cfg.uvar = 1; %row-index of the ‘unit’-variable, your unit of observation, which are your individual subjects. %the design-matrix will be shuffled, by swapping the 1 and 2’s in the ivar-row, while keeping the uvar-doublets together. Cfg.correctm = ‘yes’; %keep it at this for the time being, we have to develop a cunning strategy to incorporate something about the neighbourhood structure of your ROIs %as soon as you get your script running, you can try to incorporate fancy multiple-comparison correction strategies, such as clustering in time and frequency. Stat = freqstatistics(cfg, subj1cond1, subj1cond2, subj2cond1, subj2cond2 .); %take care that this corresponds with how you specified your design. Subjxconx should then be the data-structure containing your TFRs in a field called cohspctrm. I hope this puts you on track, Yours, Jan-Mathijs --------------------------------- From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf Of Lorina Naci Sent: Monday, October 23, 2006 7:18 PM To: FIELDTRIP at NIC.SURFNET.NL Subject: [FIELDTRIP] Within-subject coherence statististics for virtual sources Dear FIELDTRIP members, I have used BESA to perform source coherence calculations for a multiple-subject/multiple-condition experiment. I have 14 subjects, and 2 conditions for which I’d like to compare coherence values. I have calculated coherence values in the Time-Frequency domain for each person. Given that BESA cannot calculate statistics in a multiple-subject study, their support personnel directed me towards FieldTrip. I would like to use your existing script ‘clusterrandanalysis on TFRs of power that were computed with BESA,’ but I cannot relate this to my data as the coherence values have been calculated for ROI sources, (8 per hemisphere - 16 sources total), and not for electrodes (I had 128). Do you have any advice regarding how I may adopt the script to for source coherence as opposed to electrode coherence? How do I import the source locations? Many thanks is advance for your help, Lorina Send instant messages to your online friends http://uk.messenger.yahoo.com --------------------------------- The all-new Yahoo! Mail goes wherever you go - free your email address from your Internet provider. -------------- next part -------------- An HTML attachment was scrubbed... URL: From r.oostenveld at FCDONDERS.RU.NL Wed Nov 8 21:17:53 2006 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Wed, 8 Nov 2006 21:17:53 +0100 Subject: Within-subject coherence statististics for virtual sources In-Reply-To: <20061108190027.45562.qmail@web28110.mail.ukl.yahoo.com> Message-ID: Hi Lorina On 8 Nov 2006, at 20:00, Lorina Naci wrote: > I tried to run the script as you suggested but it did not work. The > error message I get is to do with > [stat] = statistics_wrapper(cfg, varargin{:}). It just gives me an > error message pointing to this line,saying: error using > fieldtrip-20061003/private/statistics_wrapper, could not determine > the type of input data. Then it means that the data structure that you have obtained from besa2fieldtrip is not recognized. It is also not clear to me how your data looks like (i.e. as a Matlab structure). It is virtual channel data, time-frequency analyzed, and then single trial coherences computed? Could you show the output that you get on screen after dataA = besa2fieldtrip('filenameA.tfc') % i.e. without semicolon, to show the output on screen dataB = besa2fieldtrip('filenameB.tfc') % i.e. without semicolon, to show the output on screen > Also, the function 'cfg.numrandomization' requires a number, but I > am not sure what the choice of the number depends on? I've inputed > 500 as in the documentation example. That is the number of resamplings that is used to construct the reference distribution, 500 should be fine. > Finally, at risk making my ignorance of how Fieldtrip works > entirely transparent, I am not quite sure how the function you send > me 'statfun_diff.m' links with the 'freqstatistics.m,' and whether > I do need to use it? You just have to put it on your Matlab path somewhere, and you specify cfg.statistic ='diff' in freqstatistics. In general by specifying cfg.statistic='xxx', the function statfun_xxx will be called. Please look in the function statfun_diff.m to see how the statistic for each sample (=time- frequency-channel point) is computed. best regards, Robert From Brian.Roach at YALE.EDU Wed Nov 8 21:20:10 2006 From: Brian.Roach at YALE.EDU (Brian Roach) Date: Wed, 8 Nov 2006 15:20:10 -0500 Subject: freqanalysis_wltconvol.m question Message-ID: Hi, In the freqanalysis_wltconvol.m function, the FFT of zero-padded eeg or MEG data and the FFT of the wavelets at various frequencies of interest are convolved and the inverse FFT of that result is used to calculate power in this manner on line 283: powdum = (2.* abs(autspctrmacttap) ./ data.fsample) .^ 2; here, autspctrmacttap corresponds to the complex output from the call to ifft. In previous e-mail Jan-Mathijs has mentioned that the abs of the complex data gets you amplitude, so I am wondering why it gets multiplied by 2 and divided by the sampling rate before being squared since power = amplitude^2. I am wondering how important it is to multiply by 2 and divide by the AD rate because I would like to take this complex output and use it to calculate phase-locking factor, but I am not sure what parts of the power transformation need to be removed - just the abs() and the squaring? Clarification of this line of code would be extremely helpful to me. Thanks, Brian -------------- next part -------------- An HTML attachment was scrubbed... URL: From r.oostenveld at FCDONDERS.RU.NL Wed Nov 8 22:56:46 2006 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Wed, 8 Nov 2006 22:56:46 +0100 Subject: freqanalysis_wltconvol.m question In-Reply-To: <6.1.2.0.2.20061108143858.05b15ec0@email.med.yale.edu> Message-ID: Hi Brian On 8 Nov 2006, at 21:20, Brian Roach wrote: > eI would like to take this complex output and use it to calculate > phase-locking factor, but I am not sure what parts of the power > transformation need to be removed - just the abs() and the > squaring? Clarification of this line of code would be extremely > helpful to me. You can use the existing code for that: For computing the phase-locking value I suggest that you use either cfg.output='fourier' cfg.keeptrials='yes' cfg.keeptapers='yes' or cfg.output='fourier' cfg.keeptrials='yes' cfg.keeptapers='no' (not needed now) cfg.channelcmb = something, see the help in freqanalysis. Subsequently, use the option cfg.cohmethod='plv' in freqdescriptives. In case of fourier output in freqanalysis, you should specify the channel combinations here. ... Looking back at your previous mail, I see that you mean ITC and not PLV. The stuff above then does not apply. You can do output=fourier in freqanalysis and work manually on the output freq structure. I think that this should work magnitude = abs(freq.fourierspctrm); scaled = freq.fourierspctrm ./ magnitude; freq.itcspctrm = mean(scaled, 1); freq = rmfield(freq, 'fourierspctrm'); % remove the single fourierspectrum, to avoid confusion freq.dimord = 'chan_freq_time'; % remove the rpt or rpttap dimension best regards, Robert From Brian.Roach at YALE.EDU Wed Nov 8 23:12:49 2006 From: Brian.Roach at YALE.EDU (Brian Roach) Date: Wed, 8 Nov 2006 17:12:49 -0500 Subject: freqanalysis_wltconvol.m question In-Reply-To: <48D89F70-A97D-48F6-800A-2FE2A854C0D9@fcdonders.ru.nl> Message-ID: Robert, Thanks for your quick reply. I did not realize that freqanalysis_wltconvol.m allowed for 'fourier' output, but maybe I need to download the latest version. Or, do you mean I should use freqanalysis_mtm instead? Also, how does ITC differ from phase-locking value? I thought they were the same measure. At 04:56 PM 11/8/2006, you wrote: >Hi Brian > >On 8 Nov 2006, at 21:20, Brian Roach wrote: >>eI would like to take this complex output and use it to calculate >>phase-locking factor, but I am not sure what parts of the power >>transformation need to be removed - just the abs() and the >>squaring? Clarification of this line of code would be extremely >>helpful to me. > >You can use the existing code for that: > >For computing the phase-locking value I suggest that you use either > cfg.output='fourier' > cfg.keeptrials='yes' > cfg.keeptapers='yes' >or > cfg.output='fourier' > cfg.keeptrials='yes' > cfg.keeptapers='no' (not needed now) > cfg.channelcmb = something, see the help >in freqanalysis. > >Subsequently, use the option > cfg.cohmethod='plv' >in freqdescriptives. In case of fourier output in freqanalysis, you >should specify the channel combinations here. > >... >Looking back at your previous mail, I see that you mean ITC and not >PLV. The stuff above then does not apply. You can do output=fourier >in freqanalysis and work manually on the output freq structure. I >think that this should work > >magnitude = abs(freq.fourierspctrm); >scaled = freq.fourierspctrm ./ magnitude; >freq.itcspctrm = mean(scaled, 1); >freq = rmfield(freq, 'fourierspctrm'); % remove the single >fourierspectrum, to avoid confusion >freq.dimord = 'chan_freq_time'; % remove the rpt or rpttap >dimension > >best regards, >Robert > From abastos at BERKELEY.EDU Wed Nov 8 23:11:04 2006 From: abastos at BERKELEY.EDU (Andre Bastos) Date: Wed, 8 Nov 2006 14:11:04 -0800 Subject: another coherence question In-Reply-To: <006a01c70348$bd278180$902dae83@fcdonders.nl> Message-ID: Hello Everyone, So I am trying to do a simple coherence measure between a single electrode pair, PO3 and Cz. It seems like the computations are running, fine, the problem is in trying to use singleplotER to visualize the results, which always fails with the following error: Error using ==> plot, Vectors must be the same lengths. Error in ==> singleplotER at 287 plot(varargin{k-1}.(cfg.xparam), P, style); My cfg structure looks like this: cfg = zparam = 'plvspctrm'; xlim = [5 100]; cohrefchannel = 'Cz'; channel = 'PO3'; The data were first run through the scalpcurrentdensity function using the 'finite' method, then time frequency analysis was compute in frequencies 1-100 using the 'mtmconvol' method with 'powandcsd' output, using the channel = {'PO3' 'PO4' 'Cz'}, with channelcmb set to {'PO3' 'Cz'; 'PO4' 'Cz'}. Then I called freqdescriptives using cohmethod = 'plv'. The returned data structure definetly has coherence data in it, and has a .plvspctrm field which is 2x100x61, channelcmb x freqs x time. Ive looked at the data and it seems to make sense, it has numbers that range from 0 to 0.5, so it seems like the plot function is really whats giving me trouble. Any words of wisdom? Thank You in advance, Andre Bastos Robertson Lab, UC Berkeley From Jan.Schoffelen at FCDONDERS.RU.NL Thu Nov 9 10:10:53 2006 From: Jan.Schoffelen at FCDONDERS.RU.NL (Jan Mathijs Schoffelen) Date: Thu, 9 Nov 2006 10:10:53 +0100 Subject: freqanalysis_wltconvol.m question In-Reply-To: <6.1.2.0.2.20061108143858.05b15ec0@email.med.yale.edu> Message-ID: Hi Brian, The multiplication with 2 and the division by the sampling rate achieves a proper normalization and should be included. The factor 2 is coming from the fact that the power at a specific frequency is estimated at both the frequency itself and its negative counterpart. The division by the number of samples ensures that the total power (summed across all computable frequencies, so between 0 and Nyquist) will be equal to the total variance of the time-domain signal. Yours, Jan-Mathijs _____ From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf Of Brian Roach Sent: Wednesday, November 08, 2006 9:20 PM To: FIELDTRIP at NIC.SURFNET.NL Subject: [FIELDTRIP] freqanalysis_wltconvol.m question Hi, In the freqanalysis_wltconvol.m function, the FFT of zero-padded eeg or MEG data and the FFT of the wavelets at various frequencies of interest are convolved and the inverse FFT of that result is used to calculate power in this manner on line 283: powdum = (2.* abs(autspctrmacttap) ./ data.fsample) .^ 2; here, autspctrmacttap corresponds to the complex output from the call to ifft. In previous e-mail Jan-Mathijs has mentioned that the abs of the complex data gets you amplitude, so I am wondering why it gets multiplied by 2 and divided by the sampling rate before being squared since power = amplitude^2. I am wondering how important it is to multiply by 2 and divide by the AD rate because I would like to take this complex output and use it to calculate phase-locking factor, but I am not sure what parts of the power transformation need to be removed - just the abs() and the squaring? Clarification of this line of code would be extremely helpful to me. Thanks, Brian -------------- next part -------------- An HTML attachment was scrubbed... URL: From Jan.Schoffelen at FCDONDERS.RU.NL Thu Nov 9 10:37:50 2006 From: Jan.Schoffelen at FCDONDERS.RU.NL (Jan Mathijs Schoffelen) Date: Thu, 9 Nov 2006 10:37:50 +0100 Subject: freqanalysis_wltconvol.m question In-Reply-To: <6.1.2.0.2.20061108170420.05a7e2d8@email.med.yale.edu> Message-ID: Dear Brian, Freqanalysis_wltconvol does not support fourier as an output. However, since wavelet-analysis and fft's in the end are about the same thingy, you could use freqanalysis_mtmconvol to achieve your goal. There is a tutorial on the fieldtrip-website which deals with this function, and uses it in a way that it resembles a wavelet-analysis, in which the time-frequency resolution is treated in the same way as with standard wavelet-analysis. Phase-locking-value is defined in fieldtrip as a bivariate-measure, so that means that it quantifies how consistent the phase-relation between two channels is across trials. Inter-trial coherence is a bit an odd thingy, because the term coherence suggests something bivariate, but the way you would like to use it, is essentially univariate. You want to estimate how consistent the phase of the oscillations at a particular channel is across trials. However, both measures use similar math. In fact, when you create a dummy-fourier-channel you can use the plv-option to obtain your 'itc'. This is because in this situation, the mathematics become identical. I would advise it like this: Do your freqanalysis as Robert suggested in one of his previous mails (see below (cfg.keeptapers = 'yes')). Then create a dummy channel: dim = size(freq.fourierspctrm; freq.fourierspctrm(:,end+1,:,:) = ones(dim([1 3 4])); freq.label = 'dummy'; cfg = []; cfg.cohmethod = 'plv'; cfg.channelcmb = channelcombination({'dummy' 'all'}, freq.label); %should work itc = freqdescriptives(cfg, freq); Your 'itc' now is contained in the field itc.cohspctrm; The check whether this is correctly done is done outside fieldtrip: itc2 = abs(mean(freq.fourierspctrm./abs(freq.fourierspctrm),1)); Yours, Jan-Mathijs -----Original Message----- From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf Of Brian Roach Sent: Wednesday, November 08, 2006 11:13 PM To: FIELDTRIP at NIC.SURFNET.NL Subject: Re: [FIELDTRIP] freqanalysis_wltconvol.m question Robert, Thanks for your quick reply. I did not realize that freqanalysis_wltconvol.m allowed for 'fourier' output, but maybe I need to download the latest version. Or, do you mean I should use freqanalysis_mtm instead? Also, how does ITC differ from phase-locking value? I thought they were the same measure. At 04:56 PM 11/8/2006, you wrote: >Hi Brian > >On 8 Nov 2006, at 21:20, Brian Roach wrote: >>eI would like to take this complex output and use it to calculate >>phase-locking factor, but I am not sure what parts of the power >>transformation need to be removed - just the abs() and the >>squaring? Clarification of this line of code would be extremely >>helpful to me. > >You can use the existing code for that: > >For computing the phase-locking value I suggest that you use either > cfg.output='fourier' > cfg.keeptrials='yes' > cfg.keeptapers='yes' >or > cfg.output='fourier' > cfg.keeptrials='yes' > cfg.keeptapers='no' (not needed now) > cfg.channelcmb = something, see the help >in freqanalysis. > >Subsequently, use the option > cfg.cohmethod='plv' >in freqdescriptives. In case of fourier output in freqanalysis, you >should specify the channel combinations here. > >... >Looking back at your previous mail, I see that you mean ITC and not >PLV. The stuff above then does not apply. You can do output=fourier >in freqanalysis and work manually on the output freq structure. I >think that this should work > >magnitude = abs(freq.fourierspctrm); >scaled = freq.fourierspctrm ./ magnitude; >freq.itcspctrm = mean(scaled, 1); >freq = rmfield(freq, 'fourierspctrm'); % remove the single >fourierspectrum, to avoid confusion >freq.dimord = 'chan_freq_time'; % remove the rpt or rpttap >dimension > >best regards, >Robert > From Jan.Schoffelen at FCDONDERS.RU.NL Thu Nov 9 10:41:53 2006 From: Jan.Schoffelen at FCDONDERS.RU.NL (Jan Mathijs Schoffelen) Date: Thu, 9 Nov 2006 10:41:53 +0100 Subject: another coherence question In-Reply-To: <38381.128.32.103.8.1163023864.squirrel@calmail.berkeley.edu> Message-ID: Dear Andre, The xparam, yparam end zparam should be: time, freq, plvspctrm. I guess the time and freq part are taken care of by the default settings. However, your xlim seems to refer to frequencies, true? Try cfg.ylim = [5 100] instead. Yours, Jan-Mathijs -----Original Message----- From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf Of Andre Bastos Sent: Wednesday, November 08, 2006 11:11 PM To: FIELDTRIP at NIC.SURFNET.NL Subject: [FIELDTRIP] another coherence question Hello Everyone, So I am trying to do a simple coherence measure between a single electrode pair, PO3 and Cz. It seems like the computations are running, fine, the problem is in trying to use singleplotER to visualize the results, which always fails with the following error: Error using ==> plot, Vectors must be the same lengths. Error in ==> singleplotER at 287 plot(varargin{k-1}.(cfg.xparam), P, style); My cfg structure looks like this: cfg = zparam = 'plvspctrm'; xlim = [5 100]; cohrefchannel = 'Cz'; channel = 'PO3'; The data were first run through the scalpcurrentdensity function using the 'finite' method, then time frequency analysis was compute in frequencies 1-100 using the 'mtmconvol' method with 'powandcsd' output, using the channel = {'PO3' 'PO4' 'Cz'}, with channelcmb set to {'PO3' 'Cz'; 'PO4' 'Cz'}. Then I called freqdescriptives using cohmethod = 'plv'. The returned data structure definetly has coherence data in it, and has a .plvspctrm field which is 2x100x61, channelcmb x freqs x time. Ive looked at the data and it seems to make sense, it has numbers that range from 0 to 0.5, so it seems like the plot function is really whats giving me trouble. Any words of wisdom? Thank You in advance, Andre Bastos Robertson Lab, UC Berkeley From lorina_naci at YAHOO.CO.UK Fri Nov 10 18:41:24 2006 From: lorina_naci at YAHOO.CO.UK (Lorina Naci) Date: Fri, 10 Nov 2006 17:41:24 +0000 Subject: Within-subject coherence statististics for virtual sources In-Reply-To: Message-ID: Hi Robert, Thank you very much for your help, I was wondering whether I could trouble you with a couple more questions. I converted my besa data to fieldtrip format and this seemed to work fine. I got no error messages and the data structures look like they contain all my data in them (I am attaching an example mat file with the output structures from a few subjects). However, I am still having problems with running freqstatistics. The cfg options are defined OK but the matlab script crushes when it comes to calling statistics_wrapper. The error message I get is as follows: "Could not determine type of input data" which leads me to believe there is a problem with the converted data. I am also attaching my script for freqstatistics in case you need to see this file. Very many thanks for your help, Lorina Robert Oostenveld wrote: Hi Lorina On 8 Nov 2006, at 20:00, Lorina Naci wrote: > I tried to run the script as you suggested but it did not work. The > error message I get is to do with > [stat] = statistics_wrapper(cfg, varargin{:}). It just gives me an > error message pointing to this line,saying: error using > fieldtrip-20061003/private/statistics_wrapper, could not determine > the type of input data. Then it means that the data structure that you have obtained from besa2fieldtrip is not recognized. It is also not clear to me how your data looks like (i.e. as a Matlab structure). It is virtual channel data, time-frequency analyzed, and then single trial coherences computed? Could you show the output that you get on screen after dataA = besa2fieldtrip('filenameA.tfc') % i.e. without semicolon, to show the output on screen dataB = besa2fieldtrip('filenameB.tfc') % i.e. without semicolon, to show the output on screen > Also, the function 'cfg.numrandomization' requires a number, but I > am not sure what the choice of the number depends on? I've inputed > 500 as in the documentation example. That is the number of resamplings that is used to construct the reference distribution, 500 should be fine. > Finally, at risk making my ignorance of how Fieldtrip works > entirely transparent, I am not quite sure how the function you send > me 'statfun_diff.m' links with the 'freqstatistics.m,' and whether > I do need to use it? You just have to put it on your Matlab path somewhere, and you specify cfg.statistic ='diff' in freqstatistics. In general by specifying cfg.statistic='xxx', the function statfun_xxx will be called. Please look in the function statfun_diff.m to see how the statistic for each sample (=time- frequency-channel point) is computed. best regards, Robert Send instant messages to your online friends http://uk.messenger.yahoo.com -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: allsubjects.mat Type: application/octet-stream Size: 769060 bytes Desc: 2990736193-allsubjects.mat URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: freqstatistics_test.m Type: application/octet-stream Size: 3768 bytes Desc: 669505844-freqstatistics_test.m URL: From Jan.Schoffelen at FCDONDERS.RU.NL Fri Nov 10 21:56:21 2006 From: Jan.Schoffelen at FCDONDERS.RU.NL (Jan Mathijs Schoffelen) Date: Fri, 10 Nov 2006 21:56:21 +0100 Subject: Within-subject coherence statististics for virtual sources In-Reply-To: <20061110174125.16585.qmail@web28113.mail.ukl.yahoo.com> Message-ID: Dear Lorina, Even though my name is not Robert, I hope that is OK. I do not really understand why you use freqstatistics_test function the way you do, but this is the way I get it going in your case (so not using the function you sent along: and I think what went wrong is how you configured your input-data): Cfg.method = 'montecarlo'; Cfg.statistic = 'diff'; Cfg.parameter = 'powerspctrm'; %these contain coherences in reality, right? Cfg.numrandomization = something; Cfg.design = dependent on your input data; Cfg.ivar = 1; %put condition in the first row of your desing-matrix Cfg.uvar = 2; %put the subject-index on the second row And now comes the trick, and I guess that's why you tried it the way you did, at least so that you would not run into problems with neighbourselection anymore. For j = 1:length(dataBlabla.label) Cfg.neighbours{j}.label = dataBlabla.label{j}; Cfg.neighbours{j}.neighblabel = {}; End You have virtual channel data, so the neighbourhood-structure is irrelevant for clustering (you don't want to cluster in space, but only in time and frequency perhaps) At least it should run through if you call: Stat = freqstatistics(cfg, dataS1C1, dataS1C2, dataS2C1 etc) Yours, Jan-Mathijs _____ From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf Of Lorina Naci Sent: Friday, November 10, 2006 6:41 PM To: FIELDTRIP at NIC.SURFNET.NL Subject: Re: [FIELDTRIP] Within-subject coherence statististics for virtual sources Hi Robert, Thank you very much for your help, I was wondering whether I could trouble you with a couple more questions. I converted my besa data to fieldtrip format and this seemed to work fine. I got no error messages and the data structures look like they contain all my data in them (I am attaching an example mat file with the output structures from a few subjects). However, I am still having problems with running freqstatistics. The cfg options are defined OK but the matlab script crushes when it comes to calling statistics_wrapper. The error message I get is as follows: "Could not determine type of input data" which leads me to believe there is a problem with the converted data. I am also attaching my script for freqstatistics in case you need to see this file. Very many thanks for your help, Lorina Robert Oostenveld wrote: Hi Lorina On 8 Nov 2006, at 20:00, Lorina Naci wrote: > I tried to run the script as you suggested but it did not work. The > error message I get is to do with > [stat] = statistics_wrapper(cfg, varargin{:}). It just gives me an > error message pointing to this line,saying: error using > fieldtrip-20061003/private/statistics_wrapper, could not determine > the type of input data. Then it means that the data structure that you have obtained from besa2fieldtrip is not recognized. It is also not clear to me how your data looks like (i.e. as a Matlab structure). It is virtual channel data, time-frequency analyzed, and then single trial coherences computed? Could you show the output that you get on screen after dataA = besa2fieldtrip('filenameA.tfc') % i.e. without semicolon, to show the output on screen dataB = besa2fieldtrip('filenameB.tfc') % i.e. without semicolon, to show the output on screen > Also, the function 'cfg.numrandomization' requires a number, but I > am not sure what the choice of the number depends on? I've inputed > 500 as in the documentation example. That is the number of resamplings that is used to construct the reference distribution, 500 should be fine. > Finally, at risk making my ignorance of how Fieldtrip works > entirely transparent, I am not quite sure how the function you send > me 'statfun_diff.m' links with the 'freqstatistics.m,' and whether > I do need to use it? You just have to put it on your Matlab path somewhere, and you specify cfg.statistic ='diff' in freqstatistics. In general by specifying cfg.statistic='xxx', the function statfun_xxx will be called. Please look in the function statfun_diff.m to see how the statistic for each sample (=time- frequency-channel point) is computed. best regards, Robert Send instant messages to your online friends http://uk.messenger.yahoo.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From Jan.Schoffelen at FCDONDERS.RU.NL Fri Nov 10 22:06:51 2006 From: Jan.Schoffelen at FCDONDERS.RU.NL (Jan Mathijs Schoffelen) Date: Fri, 10 Nov 2006 22:06:51 +0100 Subject: Statistical comparisons in virtual electrode spectrograms In-Reply-To: <45548DEA.4000605@psych.york.ac.uk> Message-ID: Dear Piers, As a matter of fact, I have very little hands on experience with the clusterrandanalysis myself, and to be honest I'd prefer to use the new implementation of the statistics-routine, which has the same functionality as the clusterrandanalysis-function, and which was the subject of the last activity on this mailing-list, as well as a thread I pointed you to lately. In any way it is nice to hear that there is progress, and I forward your questions to the mailing list, so that people more experienced in clusterrandanalysis can join the discussion and vent their insights. Yours, Jan-Mathijs -----Original Message----- From: Piers Cornelissen [mailto:p.cornelissen at psych.york.ac.uk] Sent: Friday, November 10, 2006 3:34 PM To: Jan Mathijs Schoffelen Subject: Re: [FIELDTRIP] Statistical comparisons in virtual electrode spectrograms Dear Jan I think I may finally have got somewhere! However, I would be grateful if you or one of the Fieldtrip team could look at the clusrand_test.m script, in which I have tried to compare equal sized baseline with active windows for the group average spectrogram for one virtual electrode. As you can see, I have tried to 'borrow' back a .grad field, which the freqgrandaverage threw away, and then tried to cheat the neighbood problem in clsterrandanalysis by setting minnbchan to zero. At least these manipulations allow clusterrandanalysis to run on the virtual electrode data, and the attached powerpoint file illustrates some plots of what I get. Therefore, the first question is - are these manipulations legitimate, or have I just generated garbage? Secondly, if the output is not garbage, then I would appreciate some pointers at to what the numbers in the fields that I have *ed below actually represent, please >> clusrand clusrand = stats: [196x51 double] * raweffect: [196x51 double] * posclusters: [1x3 struct] * negclusters: [1x2 struct] * posclusterslabelmat: [1x196x51 double] * negclusterslabelmat: [1x196x51 double] * critvals: [-785.1538 785.1538] presumably interpretable when I understand the previous numbers ?* label: {'V0'} freq: [1x196 double] time: [1x51 double] cfg: [1x1 struct] As ever, I deeply appreciate your and the teams support (it is genuinely extraordinary!) Best Piers From maris at NICI.RU.NL Fri Nov 10 22:30:11 2006 From: maris at NICI.RU.NL (Eric Maris) Date: Fri, 10 Nov 2006 22:30:11 +0100 Subject: Statistical comparisons in virtual electrode spectrograms In-Reply-To: <000801c7050c$24569930$902dae83@fcdonders.nl> Message-ID: Hi Piers, > As you can see, I have tried to 'borrow' back a .grad field, which the > freqgrandaverage threw away, and then tried to cheat the neighbood > problem in clsterrandanalysis by setting minnbchan to zero. If you supply a hand-made neighbourhood-structure for your virtual channel(s) then you don't have to borrow back the grad field. > clusrand = > > stats: [196x51 double] * > raweffect: [196x51 double] * > posclusters: [1x3 struct] * If the elements of this array (structs) have value in the pval-field that is less than 0.05, then you have found a significant positive cluster. > negclusters: [1x2 struct] * If the elements of this array (structs) have value in the pval-field that is less than 0.05, then you have found a significant negative cluster.> Have a look at the clusterrandanalysis tutorial to find out how you can plot your significant clusters. Good luck, Eric Maris From Daria.Osipova at FCDONDERS.RU.NL Wed Nov 15 17:31:52 2006 From: Daria.Osipova at FCDONDERS.RU.NL (Daria Osipova) Date: Wed, 15 Nov 2006 17:31:52 +0100 Subject: Beamformer time course In-Reply-To: <78E05DBA-BC4C-469B-A508-5653CF799233@fcdonders.ru.nl> Message-ID: Hi In continuation of this discussion... I would like to use the lcmv method to localize sources of (band-pass filtered) ongoing alpha which I can use as spatial filters for my (unfiltered) data. >>From the previous discussions on lcmv it seems that most people try to estimate covariance matrix from the average since they are doing ERFs. In my case data is not time-locked so I have to estimate it from single trials and not from the average (I would think). But judging from your response, Robert, it seems that cfg.rawtrial = 'yes' (which uses covariance matrix from single trials and applies it to single trials) produces a noisy estimate. Is there a workaround then? Thanks in advance Best regards, Dasha PS I need time-domain data -----Original Message----- From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf Of Robert Oostenveld Sent: Tuesday, May 23, 2006 12:13 PM To: FIELDTRIP at NIC.SURFNET.NL Subject: Re: [FIELDTRIP] Beamformer time course Hi Marie, On 22 May 2006, at 17:18, Marie Smith wrote: > I have been trying out the various methods as discussed and have > come across a problem. > > When I select cfg.singletrials = 'yes' I get a number of error > messages saying > error('this option contains a bug, and is therefore not supported > at the moment'); > > I am using the toolbox fieldtrip-20060516. > > I noticed however, if I select cfg.rawtrials = 'yes' the function > will run. I recall disabling this functionality, since it was rarely used and since I was concerned that it would not be correct. I now had a more detailled look at the code. If you do rawtrial=yes, beamformer uses the single-trial covariance to construct the filter and also applies it to the single trial covariance/csd. That results in a very poorly estimated filter in each trial, hence projecting large amounts of noise and a lot of variance over trials. Therefore we found it not to be very usefull on real data, although conceptually and in the code it is correct. The idea behind singletrial=yes is that beamformer uses the average covariance to construct the filter and applies it to the single trial covariance/csd. The problem in the code however is that beamformer would use the averaged covariance/csd to estimate the power and not the single trial covariance/csd. The estimated single-trial timecourse would be correct, but the power would not be correct. Therefore I disabled that option in the code. The solution is something that you can do yourself in two subsequent runs of sourceanalysis: you can do sourceanalysis on the average (i.e. do not specify any of singletrial/rawtrial options) and specify keepfilter=yes. That will give you the filter, computed on the average covariance. Subsequently do cfg.grid=source2grid(source), and use the resulting grid (including the filters) in the second run of sourceanalysis, in which you specify cfg.rawtrial=yes. In the second run, the previous (based on average covariance) filters will be applied to the unaveraged data, resulting in the desired single-trial power and dipole moment. best regards, Robert From c.hesse at FCDONDERS.RU.NL Wed Nov 15 17:59:02 2006 From: c.hesse at FCDONDERS.RU.NL (Christian Hesse) Date: Wed, 15 Nov 2006 17:59:02 +0100 Subject: Beamformer time course In-Reply-To: <000701c708d3$8e8e4a80$032dae83@fcdonders.nl> Message-ID: Hi Dasha, you could try averaging the single trial covariance matrices (preserving the spatial correlation structure of both time-locked and non-time-locked activity). Then replace the single-trial covariance matrices in your timelock data structure with that average and call lcmv with cfg.rawtrial = 'yes'; However don't expect miracles, because: a) single trial estimates will always be noisy b) if there is significant head-movement between trials, then using the average covaraiance matrix may not do much better than single trial covariance estimates (because you effectively havve moving sources) Hope this helps. Christian On 15 Nov 2006, at 17:31, Daria Osipova wrote: > Hi > > In continuation of this discussion... > > I would like to use the lcmv method to localize sources of (band-pass > filtered) ongoing alpha which I can use as spatial filters for my > (unfiltered) data. > From the previous discussions on lcmv it seems that most people try to > estimate covariance matrix from the average since they are doing ERFs. > In my case data is not time-locked so I have to estimate it from > single > trials and not from the average (I would think). > But judging from your response, Robert, it seems that cfg.rawtrial > = 'yes' > (which uses covariance matrix from single trials and applies it to > single > trials) produces a noisy estimate. > Is there a workaround then? > Thanks in advance > Best regards, > Dasha > PS I need time-domain data > > > > -----Original Message----- > From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] > On Behalf > Of Robert Oostenveld > Sent: Tuesday, May 23, 2006 12:13 PM > To: FIELDTRIP at NIC.SURFNET.NL > Subject: Re: [FIELDTRIP] Beamformer time course > > Hi Marie, > > On 22 May 2006, at 17:18, Marie Smith wrote: >> I have been trying out the various methods as discussed and have >> come across a problem. >> >> When I select cfg.singletrials = 'yes' I get a number of error >> messages saying >> error('this option contains a bug, and is therefore not supported >> at the moment'); >> >> I am using the toolbox fieldtrip-20060516. >> >> I noticed however, if I select cfg.rawtrials = 'yes' the function >> will run. > > I recall disabling this functionality, since it was rarely used and > since I was concerned that it would not be correct. I now had a more > detailled look at the code. > > If you do rawtrial=yes, beamformer uses the single-trial covariance > to construct the filter and also applies it to the single trial > covariance/csd. That results in a very poorly estimated filter in > each trial, hence projecting large amounts of noise and a lot of > variance over trials. Therefore we found it not to be very usefull on > real data, although conceptually and in the code it is correct. > > The idea behind singletrial=yes is that beamformer uses the average > covariance to construct the filter and applies it to the single trial > covariance/csd. The problem in the code however is that beamformer > would use the averaged covariance/csd to estimate the power and not > the single trial covariance/csd. The estimated single-trial > timecourse would be correct, but the power would not be correct. > Therefore I disabled that option in the code. > > The solution is something that you can do yourself in two subsequent > runs of sourceanalysis: you can do sourceanalysis on the average > (i.e. do not specify any of singletrial/rawtrial options) and specify > keepfilter=yes. That will give you the filter, computed on the > average covariance. Subsequently do cfg.grid=source2grid(source), and > use the resulting grid (including the filters) in the second run of > sourceanalysis, in which you specify cfg.rawtrial=yes. In the second > run, the previous (based on average covariance) filters will be > applied to the unaveraged data, resulting in the desired single-trial > power and dipole moment. > > best regards, > Robert > ---------------------------------------------------------------------- Christian Hesse, PhD, MIEEE F.C. Donders Centre for Cognitive Neuroimaging P.O. Box 9101 NL-6500 HB Nijmegen The Netherlands Tel.: +31 (0)24 36 68293 Fax: +31 (0)24 36 10989 Email: c.hesse at fcdonders.ru.nl Web: www.fcdonders.ru.nl ---------------------------------------------------------------------- -------------- next part -------------- An HTML attachment was scrubbed... URL: From c.hesse at FCDONDERS.RU.NL Wed Nov 15 18:07:50 2006 From: c.hesse at FCDONDERS.RU.NL (Christian Hesse) Date: Wed, 15 Nov 2006 18:07:50 +0100 Subject: Beamformer time course In-Reply-To: <6E2E8326-EBD6-4565-9CC7-B58E9FD54F70@fcdonders.ru.nl> Message-ID: Ooops, didn't read all the way through the previous discussion ... source analysis does that anyway, and as Robert points out the power estimate is not correct, either (however, depending on the analysis that need not be a problem). Please disregard my previous comment. Christian On 15 Nov 2006, at 17:59, Christian Hesse wrote: > Hi Dasha, > > you could try averaging the single trial covariance matrices > (preserving the spatial correlation structure of both time-locked > and non-time-locked activity). Then replace the single-trial > covariance matrices in your timelock data structure with that > average and call lcmv with cfg.rawtrial = 'yes'; > > However don't expect miracles, because: > a) single trial estimates will always be noisy > b) if there is significant head-movement between trials, then using > the average covaraiance matrix may not do much better than single > trial covariance estimates (because you effectively havve moving > sources) > > Hope this helps. > Christian > > > > On 15 Nov 2006, at 17:31, Daria Osipova wrote: > >> Hi >> >> In continuation of this discussion... >> >> I would like to use the lcmv method to localize sources of (band-pass >> filtered) ongoing alpha which I can use as spatial filters for my >> (unfiltered) data. >> From the previous discussions on lcmv it seems that most people >> try to >> estimate covariance matrix from the average since they are doing >> ERFs. >> In my case data is not time-locked so I have to estimate it from >> single >> trials and not from the average (I would think). >> But judging from your response, Robert, it seems that cfg.rawtrial >> = 'yes' >> (which uses covariance matrix from single trials and applies it to >> single >> trials) produces a noisy estimate. >> Is there a workaround then? >> Thanks in advance >> Best regards, >> Dasha >> PS I need time-domain data >> >> >> >> -----Original Message----- >> From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] >> On Behalf >> Of Robert Oostenveld >> Sent: Tuesday, May 23, 2006 12:13 PM >> To: FIELDTRIP at NIC.SURFNET.NL >> Subject: Re: [FIELDTRIP] Beamformer time course >> >> Hi Marie, >> >> On 22 May 2006, at 17:18, Marie Smith wrote: >>> I have been trying out the various methods as discussed and have >>> come across a problem. >>> >>> When I select cfg.singletrials = 'yes' I get a number of error >>> messages saying >>> error('this option contains a bug, and is therefore not supported >>> at the moment'); >>> >>> I am using the toolbox fieldtrip-20060516. >>> >>> I noticed however, if I select cfg.rawtrials = 'yes' the function >>> will run. >> >> I recall disabling this functionality, since it was rarely used and >> since I was concerned that it would not be correct. I now had a more >> detailled look at the code. >> >> If you do rawtrial=yes, beamformer uses the single-trial covariance >> to construct the filter and also applies it to the single trial >> covariance/csd. That results in a very poorly estimated filter in >> each trial, hence projecting large amounts of noise and a lot of >> variance over trials. Therefore we found it not to be very usefull on >> real data, although conceptually and in the code it is correct. >> >> The idea behind singletrial=yes is that beamformer uses the average >> covariance to construct the filter and applies it to the single trial >> covariance/csd. The problem in the code however is that beamformer >> would use the averaged covariance/csd to estimate the power and not >> the single trial covariance/csd. The estimated single-trial >> timecourse would be correct, but the power would not be correct. >> Therefore I disabled that option in the code. >> >> The solution is something that you can do yourself in two subsequent >> runs of sourceanalysis: you can do sourceanalysis on the average >> (i.e. do not specify any of singletrial/rawtrial options) and specify >> keepfilter=yes. That will give you the filter, computed on the >> average covariance. Subsequently do cfg.grid=source2grid(source), and >> use the resulting grid (including the filters) in the second run of >> sourceanalysis, in which you specify cfg.rawtrial=yes. In the second >> run, the previous (based on average covariance) filters will be >> applied to the unaveraged data, resulting in the desired single-trial >> power and dipole moment. >> >> best regards, >> Robert >> > > ---------------------------------------------------------------------- > Christian Hesse, PhD, MIEEE > > F.C. Donders Centre for Cognitive Neuroimaging > P.O. Box 9101 > NL-6500 HB Nijmegen > The Netherlands > > Tel.: +31 (0)24 36 68293 > Fax: +31 (0)24 36 10989 > > Email: c.hesse at fcdonders.ru.nl > Web: www.fcdonders.ru.nl > ---------------------------------------------------------------------- > > > > ---------------------------------------------------------------------- Christian Hesse, PhD, MIEEE F.C. Donders Centre for Cognitive Neuroimaging P.O. Box 9101 NL-6500 HB Nijmegen The Netherlands Tel.: +31 (0)24 36 68293 Fax: +31 (0)24 36 10989 Email: c.hesse at fcdonders.ru.nl Web: www.fcdonders.ru.nl ---------------------------------------------------------------------- -------------- next part -------------- An HTML attachment was scrubbed... URL: From anderman at MIT.EDU Wed Nov 15 18:54:39 2006 From: anderman at MIT.EDU (Mark Andermann) Date: Wed, 15 Nov 2006 12:54:39 -0500 Subject: How do you load Neuromag Averaged files into Fieldtrip? Message-ID: Greetings, My name is Mark Andermann, I'm working at the Low Temperature Lab and Lab for Computational Engineering in Helsinki. I'd like to use Fieldtrip to fit dipoles to data acquired on a 306 channel neuromag MEG system. While Fieldtrip offers instructions for loading raw data, I have not found a simple script to load in Neuromag data that's already been averaged in MATLAB, and converted back to an averaged .fif file. Also, can MEG dipole fitting (and time-series estimation) in Fieldtrip be done with a spherical head model in the absence of any subject MRI data? Thank you for your help, Dr. Mark Andermann From lorina_naci at YAHOO.CO.UK Mon Nov 20 19:32:50 2006 From: lorina_naci at YAHOO.CO.UK (Lorina Naci) Date: Mon, 20 Nov 2006 18:32:50 +0000 Subject: Within-subject coherence statististics for virtual sources In-Reply-To: <000301c7050a$ad618610$902dae83@fcdonders.nl> Message-ID: Dear Jan-Mathijs, thanks so much for your message. I am sorry I did not respond any earlier – the message ended up misclassified in my mailbox and I did not notice it. Thank you for sending me the modified script. I’ve defined the cfg.neighbours{j}.label by entering one of my data structures. Also, I’ve loaded all my subjects’ data structures which are saved in the file ‘allsubjects.m’ I ran it but again it crashes, giving the same error pointing to the statistics_wrapper, saying that the input data could not be determined. I am attaching here my scrip and ‘allsubjects.m’ Sorry to keep bothering you with this. Many thanks for your help, Lorina Jan Mathijs Schoffelen wrote: v\:* {behavior:url(#default#VML);} o\:* {behavior:url(#default#VML);} w\:* {behavior:url(#default#VML);} .shape {behavior:url(#default#VML);} st1\:*{behavior:url(#default#ieooui) } Dear Lorina, Even though my name is not Robert, I hope that is OK. I do not really understand why you use freqstatistics_test function the way you do, but this is the way I get it going in your case (so not using the function you sent along: and I think what went wrong is how you configured your input-data): Cfg.method = ‘montecarlo’; Cfg.statistic = ‘diff’; Cfg.parameter = ‘powerspctrm’; %these contain coherences in reality, right? Cfg.numrandomization = something; Cfg.design = dependent on your input data; Cfg.ivar = 1; %put condition in the first row of your desing-matrix Cfg.uvar = 2; %put the subject-index on the second row And now comes the trick, and I guess that’s why you tried it the way you did, at least so that you would not run into problems with neighbourselection anymore. For j = 1:length(dataBlabla.label) Cfg.neighbours{j}.label = dataBlabla.label{j}; Cfg.neighbours{j}.neighblabel = {}; End You have virtual channel data, so the neighbourhood-structure is irrelevant for clustering (you don’t want to cluster in space, but only in time and frequency perhaps) At least it should run through if you call: Stat = freqstatistics(cfg, dataS1C1, dataS1C2, dataS2C1 etc) Yours, Jan-Mathijs --------------------------------- From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf Of Lorina Naci Sent: Friday, November 10, 2006 6:41 PM To: FIELDTRIP at NIC.SURFNET.NL Subject: Re: [FIELDTRIP] Within-subject coherence statististics for virtual sources Hi Robert, Thank you very much for your help, I was wondering whether I could trouble you with a couple more questions. I converted my besa data to fieldtrip format and this seemed to work fine. I got no error messages and the data structures look like they contain all my data in them (I am attaching an example mat file with the output structures from a few subjects). However, I am still having problems with running freqstatistics. The cfg options are defined OK but the matlab script crushes when it comes to calling statistics_wrapper. The error message I get is as follows: "Could not determine type of input data" which leads me to believe there is a problem with the converted data. I am also attaching my script for freqstatistics in case you need to see this file. Very many thanks for your help, Lorina Robert Oostenveld wrote: Hi Lorina On 8 Nov 2006, at 20:00, Lorina Naci wrote: > I tried to run the script as you suggested but it did not work. The > error message I get is to do with > [stat] = statistics_wrapper(cfg, varargin{:}). It just gives me an > error message pointing to this line,saying: error using > fieldtrip-20061003/private/statistics_wrapper, could not determine > the type of input data. Then it means that the data structure that you have obtained from besa2fieldtrip is not recognized. It is also not clear to me how your data looks like (i.e. as a Matlab structure). It is virtual channel data, time-frequency analyzed, and then single trial coherences computed? Could you show the output that you get on screen after dataA = besa2fieldtrip('filenameA.tfc') % i.e. without semicolon, to show the output on screen dataB = besa2fieldtrip('filenameB.tfc') % i.e. without semicolon, to show the output on screen > Also, the function 'cfg.numrandomization' requires a number, but I > am not sure what the choice of the number depends on? I've inputed > 500 as in the documentation example. That is the number of resamplings that is used to construct the reference distribution, 500 should be fine. > Finally, at risk making my ignorance of how Fieldtrip works > entirely transparent, I am not quite sure how the function you send > me 'statfun_diff.m' links with the 'freqstatistics.m,' and whether > I do need to use it? You just have to put it on your Matlab path somewhere, and you specify cfg.statistic ='diff' in freqstatistics. In general by specifying cfg.statistic='xxx', the function statfun_xxx will be called. Please look in the function statfun_diff.m to see how the statistic for each sample (=time- frequency-channel point) is computed. best regards, Robert Send instant messages to your online friends http://uk.messenger.yahoo.com --------------------------------- Inbox full of spam? Get leading spam protection and 1GB storage with All New Yahoo! Mail. -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: allsubjects.mat Type: application/octet-stream Size: 769060 bytes Desc: 2990736193-allsubjects.mat URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: freqstatistics_test.m Type: application/octet-stream Size: 3928 bytes Desc: 669505844-freqstatistics_test.m URL: From Jan.Schoffelen at FCDONDERS.RU.NL Tue Nov 21 08:02:00 2006 From: Jan.Schoffelen at FCDONDERS.RU.NL (Jan Mathijs Schoffelen) Date: Tue, 21 Nov 2006 08:02:00 +0100 Subject: freqanalysis_wltconvol.m question In-Reply-To: <6.1.2.0.2.20061120134916.01cb9ec0@email.med.yale.edu> Message-ID: Dear Brian et al, _____ From: Brian Roach [mailto:Brian.Roach at yale.edu] Sent: Monday, November 20, 2006 11:56 PM To: Jan Mathijs Schoffelen Subject: Re: [FIELDTRIP] freqanalysis_wltconvol.m question Hi, I could not get this posted to the list, and figured since you gave most of the feedback, I would see what you think. thanks, Brian Date: Mon, 13 Nov 2006 12:09:00 -0500 To: FieldTrip discussion list From: Brian Roach Subject: Re: [FIELDTRIP] freqanalysis_wltconvol.m question Bcc: Daniel Mathalon Thanks for the advice, I am wondering if FT users would agree that this is an acceptable way to estimate univariate phase coherence: In freqanalysis_wltconvol.m, line 283: % powdum = (2.* abs(autspctrmacttap) ./ data.fsample) .^ 2; powdum = (2.*autspctrmacttap ./ data.fsample); 1. I've commented out the power line and inserted basically the same thing (but not squared) 2. As suggested, I change cfg.keeptrials = 'yes'; 3. After running freqanalysis.m, in the command prompt: itc = abs(mean(squeeze(freq.powspctrm)./abs(squeeze(freq.powspctrm)),1)) squeeze is used because freq.powspctrm is a 3 d matrix including sites, times, and frequencies and in the above case I am just getting itc from 1 channel. Does this method seem alright? Regarding step #1 above, it seemed to make no difference whether I left the 2.* in that equation or not, which seems consistent with an earlier e-mail that mentioned this multiplication being tied into power, so it does not influence phase angle. Is that right? Or, should it be taken out for my purposes? thanks, Brian This looks fine to me. Indeed the factor of 2 does not affect the outcome, because it falls out in the division (normalization) step. Yours, Jan-Mathijs PS: you might have to think about whether or not to square the final itc, to make it consistent with the way it is defined in the literature. At 04:37 AM 11/9/2006, you wrote: Dear Brian, Freqanalysis_wltconvol does not support fourier as an output. However, since wavelet-analysis and fft's in the end are about the same thingy, you could use freqanalysis_mtmconvol to achieve your goal. There is a tutorial on the fieldtrip-website which deals with this function, and uses it in a way that it resembles a wavelet-analysis, in which the time-frequency resolution is treated in the same way as with standard wavelet-analysis. Phase-locking-value is defined in fieldtrip as a bivariate-measure, so that means that it quantifies how consistent the phase-relation between two channels is across trials. Inter-trial coherence is a bit an odd thingy, because the term coherence suggests something bivariate, but the way you would like to use it, is essentially univariate. You want to estimate how consistent the phase of the oscillations at a particular channel is across trials. However, both measures use similar math. In fact, when you create a dummy-fourier-channel you can use the plv-option to obtain your 'itc'. This is because in this situation, the mathematics become identical. I would advise it like this: Do your freqanalysis as Robert suggested in one of his previous mails (see below (cfg.keeptapers = 'yes')). Then create a dummy channel: dim = size(freq.fourierspctrm; freq.fourierspctrm(:,end+1,:,:) = ones(dim([1 3 4])); freq.label = 'dummy'; cfg = []; cfg.cohmethod = 'plv'; cfg.channelcmb = channelcombination({'dummy' 'all'}, freq.label); %should work itc = freqdescriptives(cfg, freq); Your 'itc' now is contained in the field itc.cohspctrm; The check whether this is correctly done is done outside fieldtrip: itc2 = abs(mean(freq.fourierspctrm./abs(freq.fourierspctrm),1)); Yours, Jan-Mathijs -----Original Message----- From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf Of Brian Roach Sent: Wednesday, November 08, 2006 11:13 PM To: FIELDTRIP at NIC.SURFNET.NL Subject: Re: [FIELDTRIP] freqanalysis_wltconvol.m question Robert, Thanks for your quick reply. I did not realize that freqanalysis_wltconvol.m allowed for 'fourier' output, but maybe I need to download the latest version. Or, do you mean I should use freqanalysis_mtm instead? Also, how does ITC differ from phase-locking value? I thought they were the same measure. At 04:56 PM 11/8/2006, you wrote: >Hi Brian > >On 8 Nov 2006, at 21:20, Brian Roach wrote: >>eI would like to take this complex output and use it to calculate >>phase-locking factor, but I am not sure what parts of the power >>transformation need to be removed - just the abs() and the >>squaring? Clarification of this line of code would be extremely >>helpful to me. > >You can use the existing code for that: > >For computing the phase-locking value I suggest that you use either > cfg.output='fourier' > cfg.keeptrials='yes' > cfg.keeptapers='yes' >or > cfg.output='fourier' > cfg.keeptrials='yes' > cfg.keeptapers='no' (not needed now) > cfg.channelcmb = something, see the help >in freqanalysis. > >Subsequently, use the option > cfg.cohmethod='plv' >in freqdescriptives. In case of fourier output in freqanalysis, you >should specify the channel combinations here. > >... >Looking back at your previous mail, I see that you mean ITC and not >PLV. The stuff above then does not apply. You can do output=fourier >in freqanalysis and work manually on the output freq structure. I >think that this should work > >magnitude = abs(freq.fourierspctrm); >scaled = freq.fourierspctrm ./ magnitude; >freq.itcspctrm = mean(scaled, 1); >freq = rmfield(freq, 'fourierspctrm'); % remove the single >fourierspectrum, to avoid confusion >freq.dimord = 'chan_freq_time'; % remove the rpt or rpttap >dimension > >best regards, >Robert > -------------- next part -------------- An HTML attachment was scrubbed... URL: From r.oostenveld at FCDONDERS.RU.NL Tue Nov 21 09:42:02 2006 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Tue, 21 Nov 2006 09:42:02 +0100 Subject: How do you load Neuromag Averaged files into Fieldtrip? In-Reply-To: Message-ID: Dear Mark On 16 Nov 2006, at 1:54, Mark Andermann wrote: > I'd like to use Fieldtrip to fit dipoles to data acquired on a 306 > channel neuromag MEG system. While Fieldtrip offers instructions > for loading raw data, I have not found a simple script to load in > Neuromag data that's already been averaged in MATLAB, and converted > back to an averaged .fif file. Fieldtrip usually reads the data from disk itself, since the data is accopanied with auxiliary information (e.g. events and channel locations). So there is no default option to read in data from a matlab file, or from a matlab variable. The fif reading functions are nott included by default in fieldtrip (since they are closed source), but if you have the meg_pd toolbox on your matlab path then fieldtrip will detect that and use those functions (seee http://www2.ru.nl/fcdonders/fieldtrip/doku.php? id=fieldtrip:documentation:dataformats). The only issue with Neuromag data that I am aware about is that the stimulus channel is noisy, and hence the event detection might not be flawless. The alternative is to take the variables that you already have in your matlab session and convert them (manually) into a data structure taht is compatible with fieldtrip. You can find instructions on how to do that in the frequently asked questions list (see http:// www2.ru.nl/fcdonders/fieldtrip/doku.php? id=fieldtrip:documentation:frequently_asked_questions#how_can_i_import_m y_own_dataformat). > Also, can MEG dipole fitting (and time-series estimation) in > Fieldtrip be done with a spherical head model in the absence of any > subject MRI data? Yes, but then you have to define the spherical head model yourself. For the DIPOLEFITTING function you would specify cfg.vol.r = radius, single number cfg.vol.o = origin, [x y z] Both these values should be expressed in the same units (e.g. meters, centimeters or milimeters) as the channel locations. At the moment I do not recall what the default units are for Neuromag, but you can have a look at the "grad.pnt" field (i.e. the position of all the gradiometer coils) and you will probably easily recognize the units. best regards, Robert From jedmeltzer at YAHOO.COM Wed Nov 22 19:34:21 2006 From: jedmeltzer at YAHOO.COM (Jed Meltzer) Date: Wed, 22 Nov 2006 19:34:21 +0100 Subject: matlab crashes upon running fieldtrip - glibc error Message-ID: Hi, I am just trying to get fieldtrip running on my computer, which is brand new along with my matlab installation. I am trying to run the code in the first tutorial. The computer is a fancy 64-bit dual- xeon workstation, with RHEL 4.0, EM64T processors, and the newest Matlab 7.3 (R2006b). Here is some info about the system that might be relevant: uname -a Linux gemara.nidcd.nih.gov 2.6.9-42.ELsmp #1 SMP Wed Jul 12 23:32:02 EDT 2006 x86_64 x86_64 x86_64 GNU/Linux rpm -q glibc glibc-2.3.4-2.25 glibc-2.3.4-2.25 Now my problem: as soon as I run this line in the tutorial: dataFIC = preprocessing(cfg); matlab crashes and I get the following error message in the shell: *** glibc detected *** free(): invalid pointer: 0x0000002af5fd5dd0 *** Abort Any ideas about how to fix this? Thanks! -Jed Meltzer From jedmeltzer at YAHOO.COM Wed Nov 22 22:16:00 2006 From: jedmeltzer at YAHOO.COM (Jed Meltzer) Date: Wed, 22 Nov 2006 22:16:00 +0100 Subject: matlab crashes upon running fieldtrip - glibc error Message-ID: Just some further details here about my problem - I used the matlab debugger to try to find where preprocessing.m was crashing, and found that it was in the calling of "progress.m" If I comment out that call, the function works. Of course, I don't want to have to do that on every single field trip function that calls progress.m. Upon examining the code for progress.m, I see that there is this little workaround "to prevent matlab 2006b (7.3) from crashing" So I guess I am reporting that the workaround does not work! I have matlab 7.3 and it crashes anyway. However if I just type "feature accel off" at the beginning of my matlab session it works ok. I don't know why, but in the meantime this is working. Maybe you can fix this in the future? Thanks. -Jed From ali.mazaheri at FCDONDERS.RU.NL Thu Nov 23 14:39:52 2006 From: ali.mazaheri at FCDONDERS.RU.NL (Ali Mazaheri) Date: Thu, 23 Nov 2006 14:39:52 +0100 Subject: 64 bit.. detrending... Message-ID: Dear fieldtrippers... I've noticed that when I run some scripts on my pc I get quite diffrent results than when I run them on the 64 bit linux clusters. I initially thought perhaps it had to do with the matlab version.. and specifically the detrend function and specific toolboxes.. but that does not appear to be case since puting the toolboxes of matlab 7.0.1 (the matlab on my pc) on the path of the matlab7.1.0 ( the one on the 64 bit clusters) still gives different results. If any one has experience with this.. or suggestions please let me know..... bests ali From jeremiemattout at YAHOO.FR Thu Nov 23 17:06:40 2006 From: jeremiemattout at YAHOO.FR (Jeremie MATTOUT) Date: Thu, 23 Nov 2006 16:06:40 +0000 Subject: reading .sdq format Message-ID: Dear Fieldtrip users and developers, I need to read Yokogawa MEG data (*.sdq files). I saw on the fieldtrip web site that some functions should be available from the fieldtrip FTP server. However I have not been able to download them. Any help would be most welcome. To be a bit more precise, I am looking for a filter that would import those data format directly into Matlab or, alternatively, that would enable me to produce binary (.bin) files that I should then be able to convert into Matlab. Many Thanks, Jeremie Mattout INSERM U562 Service Hospitalier Frédéric Joliot CEA 4 pl. du Général Leclerc Orsay, F91401 FRANCE ___________________________________________________________________________ Découvrez une nouvelle façon d'obtenir des réponses à toutes vos questions ! Profitez des connaissances, des opinions et des expériences des internautes sur Yahoo! Questions/Réponses http://fr.answers.yahoo.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From r.oostenveld at FCDONDERS.RU.NL Mon Nov 27 15:38:32 2006 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Mon, 27 Nov 2006 15:38:32 +0100 Subject: reading .sdq format In-Reply-To: <20061123160640.62770.qmail@web26009.mail.ukl.yahoo.com> Message-ID: Dear Jeremie On 23 Nov 2006, at 17:06, Jeremie MATTOUT wrote: > I need to read Yokogawa MEG data (*.sdq files). > > I saw on the fieldtrip web site that some functions should be > available from the fieldtrip FTP server. > However I have not been able to download them. Any help would be > most welcome. The documentatino and a link to the ftp server is given here http:// www2.ru.nl/fcdonders/fieldtrip/doku.php? id=fieldtrip:documentation:dataformats#support_for_yokogawa_meg_data > To be a bit more precise, I am looking for a filter that would > import those data format directly into Matlab or, alternatively, > that would enable me to produce binary (.bin) files that I should > then be able to convert into Matlab. I suggest that you download the fileio module and use the Matlab interface described here http://www2.ru.nl/fcdonders/fieldtrip/ doku.php?id=fieldtrip:development:fileio That requires that you drop the yokogawa specific functions in the "private" directory. best regards, Robert From r.oostenveld at FCDONDERS.RU.NL Mon Nov 27 15:46:23 2006 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Mon, 27 Nov 2006 15:46:23 +0100 Subject: matlab crashes upon running fieldtrip - glibc error In-Reply-To: Message-ID: Hi Jed, On 22 Nov 2006, at 22:16, Jed Meltzer wrote: > Just some further details here about my problem - > > I used the matlab debugger to try to find where preprocessing.m was > crashing, and found that it was > in the calling of "progress.m" > ... > So I guess I am reporting that the workaround does not work! I > have matlab 7.3 and it crashes > anyway. Yes, that is also what I have observed. I have contacted Mathworks with this, and they confirmed that that is a bug in Matlab 7.3. It has something to do with acceleration and persistent variables. It turns out that "feature accel off" should be given prior to calling the "progress" function, so therefore it does not work when included in the progress function itself. > However if I just type "feature accel off" at the beginning of my > matlab session it works ok. I don't > know why, but in the meantime this is working. > Maybe you can fix this in the future? Thanks. I have no idea how to fix this myself, I hope that Mathworks will fix it in the next Matlab version. I suggest that you include the "feature accel off" in yur matlab startup.m file. E.g. this is what I have in my ~/matlab/startup.m if strcmp(getfield(ver('MATLAB'), 'Version'), '7.3') feature accel off end best regards Robert From r.oostenveld at FCDONDERS.RU.NL Mon Nov 27 16:37:17 2006 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Mon, 27 Nov 2006 16:37:17 +0100 Subject: Within-subject coherence statististics for virtual sources In-Reply-To: <20061120183250.77617.qmail@web28104.mail.ukl.yahoo.com> Message-ID: Hi Lornia, On 20 Nov 2006, at 19:32, Lorina Naci wrote: > Thank you for sending me the modified script. I’ve defined the > cfg.neighbours{j}.label by entering one of my data structures. > Also, I’ve loaded all my subjects’ data structures which are saved > in the file ‘allsubjects.m’ > > I ran it but again it crashes, giving the same error pointing to > the statistics_wrapper, saying that the input data could not be > determined. I am attaching here my scrip and ‘allsubjects.m’ > Sorry to keep bothering you with this. I found one small bug in your attached script for j = 1:length(data1257Vis.label); cfg.neighbours{j}.label = data1257Vis.label{j}; cgf.neighbours{j}.neighblabel = {}; <========== TYPO cgf->cfg end Furthermore, I do not understand why your attached script is a mixture of fieldtrip code and your own code. You should put your own code in a script (which does NOT start with "function"), and call that script from the command line. The script should call the freqstatistics function. If I do the following using your data, it seems to work for me. best regards, Robert %-------------------- script starts here -------------------- load allsubjects cfg = []; cfg.method = 'montecarlo'; cfg.statistic = 'diff'; % cfg.parameter = 'cohspctrm'; <==== it will always use powspctrm, regardless of this parameter cfg.numrandomization = 500; cfg.design = [1 1 2 2 3 3 4 4 5 5 6 6; 1 2 1 2 1 2 1 2 1 2 1 2]; cfg.ivar = 2; cfg.uvar = 1; cfg.correctm = 'yes'; for j = 1:length(data1257Vis.label); cfg.neighbours{j}.label = data1257Vis.label{j}; cfg.neighbours{j}.neighblabel = {}; end stat = freqstatistics(cfg, data1257XM, data1257Vis, data1299XM, data1299Vis, data349XM, data349Vis, data449XM, data449Vis, data732XM, data732Vis, data868XM, data868Vis); From ali.mazaheri at FCDONDERS.RU.NL Tue Nov 28 13:55:05 2006 From: ali.mazaheri at FCDONDERS.RU.NL (Ali Mazaheri) Date: Tue, 28 Nov 2006 13:55:05 +0100 Subject: operations on single precision numbers unstable in matlab 7.1 (64bit ) vesions and higher In-Reply-To: <20061123160640.62770.qmail@web26009.mail.ukl.yahoo.com> Message-ID: Dear all, The long subject captions says it all. I just recently discovered that solutions to the low level functions in matlab7.1 and higher run on a 64 bit platform become unstable when using single precision. This problem does not appear to be present on matlabs running on a 32 bit platform. . A simple example of this problem is as follows a=[1 2] b=[1 2]; >> a/b ans = 1 NOW in single precision a=single(a); b=single(b); >> a/b ans = 1.9074 e-05 the problem of course become much more compounded when doing more higher level functions such as detrend. I am completely unable to do a linear detrend on single precious data. regards Ali From Jan.Schoffelen at FCDONDERS.RU.NL Tue Nov 28 14:12:28 2006 From: Jan.Schoffelen at FCDONDERS.RU.NL (Jan Mathijs Schoffelen) Date: Tue, 28 Nov 2006 14:12:28 +0100 Subject: operations on single precision numbers unstable in matlab 7.1 (64bit ) vesions and higher In-Reply-To: <456C31A9.9080300@fcdonders.ru.nl> Message-ID: Dear Ali, What about temporarily converting your data into double precision, and doing your stuff? data = struct2double(data); DO YOUR STUFF HERE data = struct2single(data); Yours, JM -----Original Message----- From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf Of Ali Mazaheri Sent: Tuesday, November 28, 2006 1:55 PM To: FIELDTRIP at NIC.SURFNET.NL Subject: [FIELDTRIP] operations on single precision numbers unstable in matlab 7.1 (64bit ) vesions and higher Dear all, The long subject captions says it all. I just recently discovered that solutions to the low level functions in matlab7.1 and higher run on a 64 bit platform become unstable when using single precision. This problem does not appear to be present on matlabs running on a 32 bit platform. . A simple example of this problem is as follows a=[1 2] b=[1 2]; >> a/b ans = 1 NOW in single precision a=single(a); b=single(b); >> a/b ans = 1.9074 e-05 the problem of course become much more compounded when doing more higher level functions such as detrend. I am completely unable to do a linear detrend on single precious data. regards Ali From r.oostenveld at FCDONDERS.RU.NL Tue Nov 28 16:47:03 2006 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Tue, 28 Nov 2006 16:47:03 +0100 Subject: operations on single precision numbers unstable in matlab 7.1 (64bit ) vesions and higher In-Reply-To: <456C31A9.9080300@fcdonders.ru.nl> Message-ID: Dear all, Ali quite convincingly demonstrated this bug in Matlab. Sofar, we have only seen it on the 64 bit linux machines running 64 bit matlab, which means all the nodes in the FCDC mentat cluster. Desktop PCs running a 32 bit version of Windows+matlab are not affected. Also 32 bit linux machines (e.g. loke and odin in the FCDC) are unaffected. I don't know about 64 bit Mac OS X versions, but the 32 bit Mac OS X does not have a problem either. We are not yet running 64 bit Windows at the FCDC, so we do not have experience with those yet. Regarding fieldtrip: if you want to use single precision (to save memory/quota), I suggest that you only store the data on disk in single precision, and that you do struct2double (as JM suggested) as soon as you read the data from disk. I will contact Mathworks about this serious bug. best regards Robert On 28 Nov 2006, at 13:55, Ali Mazaheri wrote: > Dear all, > The long subject captions says it all. > I just recently discovered that solutions to the low level > functions in matlab7.1 and higher run on a 64 bit platform become > unstable when using single precision. > This problem does not appear to be present on matlabs running on a > 32 bit platform. > > . > A simple example of this problem is as follows > > a=[1 2] > b=[1 2]; > > >> a/b > ans = 1 > > NOW in single precision > > a=single(a); > b=single(b); > >> a/b > ans = 1.9074 e-05 > > > the problem of course become much more compounded when doing more > higher level functions such as detrend. I am completely unable to > do a linear detrend on > single precious data. > > > regards > Ali > From sdim14hg at T2.TECHNION.AC.IL Tue Nov 28 20:05:50 2006 From: sdim14hg at T2.TECHNION.AC.IL (Hanukaev Dmitri) Date: Tue, 28 Nov 2006 20:05:50 +0100 Subject: sourcestatistics_randcluster Message-ID: Hello We want to perform a T-dependent statistics test and to find the time- space clusters. The data has two condition and N replication (12 patient) and was acquired using the Loreta software. We used the loreta2fieldtrip.m function convert it to a fieldtrip structure. Now after the conversion we want to perform the test but we aren't sure which sourcestatistics function to use. We think that we need to use the sourcestatistics_randcluster function but don’t sure how to arrange the data and how to perform it on all the replications. sincerely From litvak at TX.TECHNION.AC.IL Tue Nov 28 20:33:02 2006 From: litvak at TX.TECHNION.AC.IL (Vladimir Litvak) Date: Tue, 28 Nov 2006 19:33:02 -0000 Subject: Some issues in freqanalysis Message-ID: Dear Robert and all, I'm writing a new script for analysis of MEG data and I encountered some problems with FT (I'm using 20061029 version): 1) In freqdescriptives the lines 494 and 515 seem to be redundant and also don't work and cause a crash. 2) there are some missing functions: inputlabel2outputlabel called by freqdescriptives, line 234 fourier2crsspctrm called by freqdescriptives, line 290 Can you please explain to me what cfg.combinechan in freqdescriptives does (I'm new to MEG which might explain my ignorance)? Finally, I would like to compute coherence from data of a single subject with 300 trials and check whether it is significant (i.e. not random). I don't think I can use any of the nonparametric stuff because I don't have a baseline. It seems to me that I should use the jackknife SEMs. How exactly? Should I use the bias correction? Should I take 2*SEM as the threshold? Thanks, Vladimir -------------- next part -------------- An HTML attachment was scrubbed... URL: From Jan.Schoffelen at FCDONDERS.RU.NL Tue Nov 28 23:24:19 2006 From: Jan.Schoffelen at FCDONDERS.RU.NL (Jan Mathijs Schoffelen) Date: Tue, 28 Nov 2006 23:24:19 +0100 Subject: Some issues in freqanalysis In-Reply-To: <009301c71324$055adde0$f0463ec1@sobell.ion.ucl.ac.uk> Message-ID: Dear Vladimir, Regarding the missing functions: you are absolutely right. The functions will be added to the latest release. Regarding the crash: I don't know what is happening there, and I do not have any experience with the option biascorrect. You'll have to ask Eric about this. Does it still crash when you use cfg.biascorrect = 'no'? This might already solve your problem. cfg.combinechan is a rather obscure option (and is set to 'no' by default) in freqdescriptives which is (as far as I know) undocumented. It has to do with combining planar gradiometer representation back into an axial gradiometer representation in order to be able to compute coherence between sensor-combinations (in their original axial representation). As a matter of fact, it is an option which has a high 'don't try this at home'-content. At least a correct behavior is not guaranteed. Anyhow, it should run through even when it is not specified. If you want to test coherence against 0, the jack-knife estimate of the variance is not going to help you too much. Rather, you could use some kind of Z-transformation as proposed by Jarvis & Mitra Neural computation 2001, or the Z-transformation that is described in James Kilner's papers, or from the Rosenberg group. In this context, the coherence can be parametrically evaluated. Another possibility is using a 'shiftpredictor' to estimate the bias, meaning that you shuffle the trial order of one of the two channels in your channel-combination (only works when taking fourier as an output of freqanalysis). In my experience this only works if you use an external reference signal, such as the EMG. Hope this gives some handles, Jan-Mathijs _____ From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf Of Vladimir Litvak Sent: Tuesday, November 28, 2006 8:33 PM To: FIELDTRIP at NIC.SURFNET.NL Subject: [FIELDTRIP] Some issues in freqanalysis Dear Robert and all, I'm writing a new script for analysis of MEG data and I encountered some problems with FT (I'm using 20061029 version): 1) In freqdescriptives the lines 494 and 515 seem to be redundant and also don't work and cause a crash. 2) there are some missing functions: inputlabel2outputlabel called by freqdescriptives, line 234 fourier2crsspctrm called by freqdescriptives, line 290 Can you please explain to me what cfg.combinechan in freqdescriptives does (I'm new to MEG which might explain my ignorance)? Finally, I would like to compute coherence from data of a single subject with 300 trials and check whether it is significant (i.e. not random). I don't think I can use any of the nonparametric stuff because I don't have a baseline. It seems to me that I should use the jackknife SEMs. How exactly? Should I use the bias correction? Should I take 2*SEM as the threshold? Thanks, Vladimir -------------- next part -------------- An HTML attachment was scrubbed... URL: From r.oostenveld at FCDONDERS.RU.NL Wed Nov 29 09:08:47 2006 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Wed, 29 Nov 2006 09:08:47 +0100 Subject: sourcestatistics_randcluster In-Reply-To: Message-ID: On 28 Nov 2006, at 20:05, Hanukaev Dmitri wrote: > We want to perform a T-dependent statistics test and to find the time- > space clusters. > The data has two condition and N replication (12 patient) and was > acquired using the Loreta software. We used the loreta2fieldtrip.m > function convert it to a fieldtrip structure. > Now after the conversion we want to perform the test but we aren't > sure > which sourcestatistics function to use. For statistical testing with space-time clusters, you have to use a non-parametric randomization test. The single sample (voxel/ timepoint) statistic can be a dependent-T value, which then will be clustered over neighbouring voxels and timepoints. So you should use sourcestatistics itself, with cfg.method=montecarlo and cfg.correctm=cluster. The functions sourcestatistics_randomization and sourcestatistics_randcluster are implemented to test a hypothesis for single subject source reconstructions in which the data was randomized between two conditions prior to computing the source reconstruction. In your case, you want to randomize between conditions over subjects so these functions do not apply. Note that 4D clustering (x,y,z,time) is rather experimental, and I am not sure whether the bookkeeping aspects of the code will work smoothly. Please read the help of sourcestatistics and of statistics_montecarlo. Keep us posted on whether it works, and please do report it if you encounter problems. I suggest that you use the feature "dbstop if error" in Matlab together with the matlab debugger. best regards, Robert From maris at NICI.RU.NL Wed Nov 29 11:13:00 2006 From: maris at NICI.RU.NL (Eric Maris) Date: Wed, 29 Nov 2006 11:13:00 +0100 Subject: Some issues in freqanalysis In-Reply-To: <009301c71324$055adde0$f0463ec1@sobell.ion.ucl.ac.uk> Message-ID: Dear Vladimir, 1) In freqdescriptives the lines 494 and 515 seem to be redundant and also don't work and cause a crash. This is a stupid bug due to an erroneous copy-paste. It is corrected now. I would always set the biascorrect-option to 'yes' because it produces less biased coherence estimates. However, in practice it only makes a substantial difference if the number of trials is small. Try it out for yourself. Greetings, Eric -------------- next part -------------- An HTML attachment was scrubbed... URL: From litvak at TX.TECHNION.AC.IL Wed Nov 29 11:33:51 2006 From: litvak at TX.TECHNION.AC.IL (Vladimir Litvak) Date: Wed, 29 Nov 2006 10:33:51 -0000 Subject: Some issues in freqanalysis In-Reply-To: <010d01c7133b$f2c6c6e0$902dae83@fcdonders.nl> Message-ID: Dear Eric and Jan-Mathijs, My reference channel is indeed EMG. I thought about this trial shuffling idea myself over night. It can actually be combined with clustering in channel/frequency space. Is there a way to do it with the current version of statistics routines or should it be programmed by hand? Thanks, Vladimir _____ From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf Of Jan Mathijs Schoffelen Sent: Tuesday, November 28, 2006 10:24 PM To: FIELDTRIP at NIC.SURFNET.NL Subject: Re: [FIELDTRIP] Some issues in freqanalysis Dear Vladimir, Regarding the missing functions: you are absolutely right. The functions will be added to the latest release. Regarding the crash: I don't know what is happening there, and I do not have any experience with the option biascorrect. You'll have to ask Eric about this. Does it still crash when you use cfg.biascorrect = 'no'? This might already solve your problem. cfg.combinechan is a rather obscure option (and is set to 'no' by default) in freqdescriptives which is (as far as I know) undocumented. It has to do with combining planar gradiometer representation back into an axial gradiometer representation in order to be able to compute coherence between sensor-combinations (in their original axial representation). As a matter of fact, it is an option which has a high 'don't try this at home'-content. At least a correct behavior is not guaranteed. Anyhow, it should run through even when it is not specified. If you want to test coherence against 0, the jack-knife estimate of the variance is not going to help you too much. Rather, you could use some kind of Z-transformation as proposed by Jarvis & Mitra Neural computation 2001, or the Z-transformation that is described in James Kilner's papers, or from the Rosenberg group. In this context, the coherence can be parametrically evaluated. Another possibility is using a 'shiftpredictor' to estimate the bias, meaning that you shuffle the trial order of one of the two channels in your channel-combination (only works when taking fourier as an output of freqanalysis). In my experience this only works if you use an external reference signal, such as the EMG. Hope this gives some handles, Jan-Mathijs _____ From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf Of Vladimir Litvak Sent: Tuesday, November 28, 2006 8:33 PM To: FIELDTRIP at NIC.SURFNET.NL Subject: [FIELDTRIP] Some issues in freqanalysis Dear Robert and all, I'm writing a new script for analysis of MEG data and I encountered some problems with FT (I'm using 20061029 version): 1) In freqdescriptives the lines 494 and 515 seem to be redundant and also don't work and cause a crash. 2) there are some missing functions: inputlabel2outputlabel called by freqdescriptives, line 234 fourier2crsspctrm called by freqdescriptives, line 290 Can you please explain to me what cfg.combinechan in freqdescriptives does (I'm new to MEG which might explain my ignorance)? Finally, I would like to compute coherence from data of a single subject with 300 trials and check whether it is significant (i.e. not random). I don't think I can use any of the nonparametric stuff because I don't have a baseline. It seems to me that I should use the jackknife SEMs. How exactly? Should I use the bias correction? Should I take 2*SEM as the threshold? Thanks, Vladimir -------------- next part -------------- An HTML attachment was scrubbed... URL: From jeremiemattout at YAHOO.FR Wed Nov 29 12:57:55 2006 From: jeremiemattout at YAHOO.FR (Jeremie MATTOUT) Date: Wed, 29 Nov 2006 11:57:55 +0000 Subject: [FIELDTRIP] reading .sdq format Message-ID: Dear Robert, > I saw on the fieldtrip web site that some functions should be > available from the fieldtrip FTP server. > However I have not been able to download them. Any help would be > most welcome. The documentatino and a link to the ftp server is given here http:// www2.ru.nl/fcdonders/fieldtrip/doku.php? id=fieldtrip:documentation:dataformats#support_for_yokogawa_meg_data The problem is that the .zip file for that format is empty. Actually, the lst fileio...zip is empty as well! > To be a bit more precise, I am looking for a filter that would > import those data format directly into Matlab or, alternatively, > that would enable me to produce binary (.bin) files that I should > then be able to convert into Matlab. I suggest that you download the fileio module and use the Matlab interface described here http://www2.ru.nl/fcdonders/fieldtrip/ doku.php?id=fieldtrip:development:fileio That requires that you drop the yokogawa specific functions in the "private" directory. I've downloaded the most recent fileio.zip available but the keyval.m function was missing !? Thanks very much for your help. Best, Jeremie ___________________________________________________________________________ Yahoo! Mail réinvente le mail ! Découvrez le nouveau Yahoo! Mail et son interface révolutionnaire. http://fr.mail.yahoo.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From Jan.Schoffelen at FCDONDERS.RU.NL Wed Nov 29 13:01:01 2006 From: Jan.Schoffelen at FCDONDERS.RU.NL (Jan Mathijs Schoffelen) Date: Wed, 29 Nov 2006 13:01:01 +0100 Subject: Some issues in freqanalysis In-Reply-To: <00a801c713a1$dcb1f120$f0463ec1@sobell.ion.ucl.ac.uk> Message-ID: Dear Vladimir, You can do it when you create a clever statfun_blabla. I assume you are familiar with the new statistics-framework in fieldtrip. What you now can do, is to put your reshaped EMG-fourierdata into your design such that it is "Nvox" (=reshaped channel*freq*time) x Ntapers (do you use multitapering?). Important is to append a row to the design which specifies the trial-number from which the taper was coming from. I guess you should then define this row-number as the the corresponding cfg.cvar, or uvar, or something. What your statfun_blabla then should output is the coherence, computed between the input-data dat (which is the reshaped MEG-fourierspectra), and the "design". To this end, I would reshape the data back into the original TFR-dimensions (there should be a dim in the cfg which is passed to the statfun), and extract the EMG-data from the design, which will be shuffled in the taper-dimension when running the randomization, which is exactly what you want, and write some for-loops around the critical computation, which involves some cross-spectral density computations, according to fft1*ctranspose(fft2) and power-spectral density computations, according to diag(fft1*ctranspose(fft1)). In short, the usual business. Do you have some handles to proceed? Yours, Jan-Mathijs _____ From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf Of Vladimir Litvak Sent: Wednesday, November 29, 2006 11:34 AM To: FIELDTRIP at NIC.SURFNET.NL Subject: Re: [FIELDTRIP] Some issues in freqanalysis Dear Eric and Jan-Mathijs, My reference channel is indeed EMG. I thought about this trial shuffling idea myself over night. It can actually be combined with clustering in channel/frequency space. Is there a way to do it with the current version of statistics routines or should it be programmed by hand? Thanks, Vladimir _____ From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf Of Jan Mathijs Schoffelen Sent: Tuesday, November 28, 2006 10:24 PM To: FIELDTRIP at NIC.SURFNET.NL Subject: Re: [FIELDTRIP] Some issues in freqanalysis Dear Vladimir, Regarding the missing functions: you are absolutely right. The functions will be added to the latest release. Regarding the crash: I don't know what is happening there, and I do not have any experience with the option biascorrect. You'll have to ask Eric about this. Does it still crash when you use cfg.biascorrect = 'no'? This might already solve your problem. cfg.combinechan is a rather obscure option (and is set to 'no' by default) in freqdescriptives which is (as far as I know) undocumented. It has to do with combining planar gradiometer representation back into an axial gradiometer representation in order to be able to compute coherence between sensor-combinations (in their original axial representation). As a matter of fact, it is an option which has a high 'don't try this at home'-content. At least a correct behavior is not guaranteed. Anyhow, it should run through even when it is not specified. If you want to test coherence against 0, the jack-knife estimate of the variance is not going to help you too much. Rather, you could use some kind of Z-transformation as proposed by Jarvis & Mitra Neural computation 2001, or the Z-transformation that is described in James Kilner's papers, or from the Rosenberg group. In this context, the coherence can be parametrically evaluated. Another possibility is using a 'shiftpredictor' to estimate the bias, meaning that you shuffle the trial order of one of the two channels in your channel-combination (only works when taking fourier as an output of freqanalysis). In my experience this only works if you use an external reference signal, such as the EMG. Hope this gives some handles, Jan-Mathijs _____ From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf Of Vladimir Litvak Sent: Tuesday, November 28, 2006 8:33 PM To: FIELDTRIP at NIC.SURFNET.NL Subject: [FIELDTRIP] Some issues in freqanalysis Dear Robert and all, I'm writing a new script for analysis of MEG data and I encountered some problems with FT (I'm using 20061029 version): 1) In freqdescriptives the lines 494 and 515 seem to be redundant and also don't work and cause a crash. 2) there are some missing functions: inputlabel2outputlabel called by freqdescriptives, line 234 fourier2crsspctrm called by freqdescriptives, line 290 Can you please explain to me what cfg.combinechan in freqdescriptives does (I'm new to MEG which might explain my ignorance)? Finally, I would like to compute coherence from data of a single subject with 300 trials and check whether it is significant (i.e. not random). I don't think I can use any of the nonparametric stuff because I don't have a baseline. It seems to me that I should use the jackknife SEMs. How exactly? Should I use the bias correction? Should I take 2*SEM as the threshold? Thanks, Vladimir -------------- next part -------------- An HTML attachment was scrubbed... URL: From litvak at TX.TECHNION.AC.IL Wed Nov 29 14:16:26 2006 From: litvak at TX.TECHNION.AC.IL (Vladimir Litvak) Date: Wed, 29 Nov 2006 13:16:26 -0000 Subject: Some issues in freqanalysis In-Reply-To: <013101c713ae$09bdf630$902dae83@fcdonders.nl> Message-ID: This sounds like a lot of work and I don't have much experience yet with the new statistics framework since I've used the old one until now. I think at this stage I'm not motivated enough to get into this and I'll try to find a simpler way to put some sensible error bars on the coherence. If you are planning to implement this anyway at a later stage I might be interested in contributing. Best, Vladimir _____ From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf Of Jan Mathijs Schoffelen Sent: Wednesday, November 29, 2006 12:01 PM To: FIELDTRIP at NIC.SURFNET.NL Subject: Re: [FIELDTRIP] Some issues in freqanalysis Dear Vladimir, You can do it when you create a clever statfun_blabla. I assume you are familiar with the new statistics-framework in fieldtrip. What you now can do, is to put your reshaped EMG-fourierdata into your design such that it is "Nvox" (=reshaped channel*freq*time) x Ntapers (do you use multitapering?). Important is to append a row to the design which specifies the trial-number from which the taper was coming from. I guess you should then define this row-number as the the corresponding cfg.cvar, or uvar, or something. What your statfun_blabla then should output is the coherence, computed between the input-data dat (which is the reshaped MEG-fourierspectra), and the "design". To this end, I would reshape the data back into the original TFR-dimensions (there should be a dim in the cfg which is passed to the statfun), and extract the EMG-data from the design, which will be shuffled in the taper-dimension when running the randomization, which is exactly what you want, and write some for-loops around the critical computation, which involves some cross-spectral density computations, according to fft1*ctranspose(fft2) and power-spectral density computations, according to diag(fft1*ctranspose(fft1)). In short, the usual business. Do you have some handles to proceed? Yours, Jan-Mathijs _____ From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf Of Vladimir Litvak Sent: Wednesday, November 29, 2006 11:34 AM To: FIELDTRIP at NIC.SURFNET.NL Subject: Re: [FIELDTRIP] Some issues in freqanalysis Dear Eric and Jan-Mathijs, My reference channel is indeed EMG. I thought about this trial shuffling idea myself over night. It can actually be combined with clustering in channel/frequency space. Is there a way to do it with the current version of statistics routines or should it be programmed by hand? Thanks, Vladimir _____ From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf Of Jan Mathijs Schoffelen Sent: Tuesday, November 28, 2006 10:24 PM To: FIELDTRIP at NIC.SURFNET.NL Subject: Re: [FIELDTRIP] Some issues in freqanalysis Dear Vladimir, Regarding the missing functions: you are absolutely right. The functions will be added to the latest release. Regarding the crash: I don't know what is happening there, and I do not have any experience with the option biascorrect. You'll have to ask Eric about this. Does it still crash when you use cfg.biascorrect = 'no'? This might already solve your problem. cfg.combinechan is a rather obscure option (and is set to 'no' by default) in freqdescriptives which is (as far as I know) undocumented. It has to do with combining planar gradiometer representation back into an axial gradiometer representation in order to be able to compute coherence between sensor-combinations (in their original axial representation). As a matter of fact, it is an option which has a high 'don't try this at home'-content. At least a correct behavior is not guaranteed. Anyhow, it should run through even when it is not specified. If you want to test coherence against 0, the jack-knife estimate of the variance is not going to help you too much. Rather, you could use some kind of Z-transformation as proposed by Jarvis & Mitra Neural computation 2001, or the Z-transformation that is described in James Kilner's papers, or from the Rosenberg group. In this context, the coherence can be parametrically evaluated. Another possibility is using a 'shiftpredictor' to estimate the bias, meaning that you shuffle the trial order of one of the two channels in your channel-combination (only works when taking fourier as an output of freqanalysis). In my experience this only works if you use an external reference signal, such as the EMG. Hope this gives some handles, Jan-Mathijs _____ From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf Of Vladimir Litvak Sent: Tuesday, November 28, 2006 8:33 PM To: FIELDTRIP at NIC.SURFNET.NL Subject: [FIELDTRIP] Some issues in freqanalysis Dear Robert and all, I'm writing a new script for analysis of MEG data and I encountered some problems with FT (I'm using 20061029 version): 1) In freqdescriptives the lines 494 and 515 seem to be redundant and also don't work and cause a crash. 2) there are some missing functions: inputlabel2outputlabel called by freqdescriptives, line 234 fourier2crsspctrm called by freqdescriptives, line 290 Can you please explain to me what cfg.combinechan in freqdescriptives does (I'm new to MEG which might explain my ignorance)? Finally, I would like to compute coherence from data of a single subject with 300 trials and check whether it is significant (i.e. not random). I don't think I can use any of the nonparametric stuff because I don't have a baseline. It seems to me that I should use the jackknife SEMs. How exactly? Should I use the bias correction? Should I take 2*SEM as the threshold? Thanks, Vladimir -------------- next part -------------- An HTML attachment was scrubbed... URL: From wibral at MPIH-FRANKFURT.MPG.DE Wed Nov 29 15:11:17 2006 From: wibral at MPIH-FRANKFURT.MPG.DE (Michael Wibral) Date: Wed, 29 Nov 2006 15:11:17 +0100 Subject: Reading in data from a new CTF system with ECC Message-ID: Hi, I'm trying to read in data from a CTF 275 channel system. It is equipped with the new ECC console that now (among other things) is responsible for the triggers from presentation. These 'triggers' are written to the channel UPPT001 (indicating that they arrive on the first parallel port of the Acq computer?). We record in a 'pseudo trial'ed fashion i.e. one trigger starts the acquistion of one long trial, other triggers are written to the UPPT001 channel but do not chop the data. There is also a truly continous recording resulting in an ...aux.ds file but that's still experimental CTF said. When I use trialfun_ctf_continuous to read in the data no triggers are found and as a consequence no trials are defined - I wonder whether there is a problem with things like the 'STIM' channel and the [backpanel, frontpanel] stuff as the machine doesn't seem to have any back or frontpanel - but the ECC instead. I have also tried to trial the data inside the CTF Software (using newDs with the corresponding markers) and then to use trialfun_ctf_epoched with the same result. BESA reads the triggers however without problems, both, their values (1,2,3...) and der names. so I think the data format shouldn't have changed too much. here is the code (with variations) that I have tried so far - any suggestions?: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Reading CTF .ds data files and preprocess them %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% clear all; fclose('all'); pathname ='/home/wibral/DATA/BAM_EEGIIIRC_oldTime/'; % I used either continuous or epoched data filename='ASL30_AMMEGIIIRC_20061124_01.ds'; % filename='ASL30_AMMEGIIIRC_20061124_01_trials.ds'; FullName=strcat(pathname,filename); % build analysis configuration cfg=[]; cfg.channel={'MEG' 'UPPT001'}; % also tried 'STIM' instead cfg.dataset=FullName; cfg.trialfun='trialfun_ctf_continuous'; % also tried ..._epoched % I tried either of the following three lines cfg.trialdef.trigger=2; cfg.trialdef.stim = 2; cfg.trialdef.includeTrigger= 2; % I also tried strings given in the markers file instead... % this doesn't result in any output either...interestingly cfg.trialdef.eventtype='?'; cfg.trialdef.excludeConditions={'BAD'}; % I also tried to give a trigger file separately: % cfg.trialdef.trgfile= strcat(FullName,'/','MarkerFile.mrk'); cfg.trialdef.prestim=0.5; cfg.trialdef.poststim=1; cfg=definetrial(cfg); cfg.blc='yes'; cfg.blcwindow=[-0.2 0]; DataName=strcat('data_trigger_',num2str(cfg.trialdef.includeTrigger)); EvalStr=strcat(DataName,'=preprocessing(cfg);'); eval(EvalStr); Any help is appreciated. Thank you very much. Best Regards, Michael Wibral From r.oostenveld at FCDONDERS.RU.NL Wed Nov 29 18:14:05 2006 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Wed, 29 Nov 2006 18:14:05 +0100 Subject: Reading in data from a new CTF system with ECC In-Reply-To: <06112915111720_2800013E@mpih-frankfurt.mpg.de> Message-ID: Hi Michael On 29 Nov 2006, at 15:11, Michael Wibral wrote: > I'm trying to read in data from a CTF 275 channel system. > ... > When I use trialfun_ctf_continuous to read in the data no triggers are > found and as a consequence no trials are defined - I wonder whether > there is a problem with things like the 'STIM' channel and the > [backpanel, frontpanel] stuff as the machine doesn't seem to have any > back or frontpanel - but the ECC instead. I indeed think that the problem is that trialfun_ctf_continuous assumes back and frontpanel. The code in that trialfun predates the read_event code, and it is not maintained. You can use trialfun_general instead, or make your own trialfun. Read the help of definetrial to see what trialfun_general can do for you (not too much, but it might be enough). Alternatively, have a look at the bottom of the page http://www2.ru.nl/fcdonders/fieldtrip/doku.php? id=fieldtrip:documentation:tutorial:eventrelatedaveraging to see a straightforward example trialfun. For that, you should also look into read_fcdc_event. We also use pseudocontinuous data at the Donders. Note that you have to do cfg.datatype='continuous' in preprocessing and artifact detection. > I have also tried to trial the data inside the CTF Software (using > newDs > with the corresponding markers) and then to use trialfun_ctf_epoched > with the same result. Also the trialfun_ctf_epoched is very old. > BESA reads the triggers however without problems, both, their values > (1,2,3...) and der names. so I think the data format shouldn't have > changed too much. No, the dataformat indeed did not change that much. It is also already implemented in the read_fcdc_event code, and the general trial function (or custom trial functions) can work with it. best regards, Robert From Brian.Roach at YALE.EDU Wed Nov 29 18:20:14 2006 From: Brian.Roach at YALE.EDU (Brian Roach) Date: Wed, 29 Nov 2006 12:20:14 -0500 Subject: freqanalysis_wltconvol.m question In-Reply-To: <000f01c70d3a$f122ea50$902dae83@fcdonders.nl> Message-ID: Thanks again, I have just one last follow-up question: Why would you square the final ITC? Tallon-Baudry et al. do not do this in their j Neurosci. '97 publication. Brian At 02:02 AM 11/21/2006, Jan Mathijs Schoffelen wrote: >Dear Brian et al, > > >---------- >From: Brian Roach [mailto:Brian.Roach at yale.edu] >Sent: Monday, November 20, 2006 11:56 PM >To: Jan Mathijs Schoffelen >Subject: Re: [FIELDTRIP] freqanalysis_wltconvol.m question > >Hi, I could not get this posted to the list, and figured since you gave >most of the feedback, I would see what you think. > >thanks, >Brian > > >Date: Mon, 13 Nov 2006 12:09:00 -0500 >To: FieldTrip discussion list >From: Brian Roach >Subject: Re: [FIELDTRIP] freqanalysis_wltconvol.m question >Bcc: Daniel Mathalon > >Thanks for the advice, I am wondering if FT users would agree that this >is an acceptable way to estimate univariate phase coherence: > >In freqanalysis_wltconvol.m, line 283: > % powdum = (2.* abs(autspctrmacttap) ./ > data.fsample) .^ 2; > powdum = (2.*autspctrmacttap ./ data.fsample); > >1. I've commented out the power line and inserted basically the same thing >(but not squared) >2. As suggested, I change cfg.keeptrials = 'yes'; >3. After running freqanalysis.m, in the command prompt: > itc = > abs(mean(squeeze(freq.powspctrm)./abs(squeeze(freq.powspctrm)),1)) > >squeeze is used because freq.powspctrm is a 3 d matrix including sites, >times, and frequencies and in the above case I am just getting itc from 1 >channel. Does this method seem alright? Regarding step #1 above, it >seemed to make no difference whether I left the 2.* in that equation or >not, which seems consistent with an earlier e-mail that mentioned this >multiplication being tied into power, so it does not influence phase >angle. Is that right? Or, should it be taken out for my purposes? > >thanks, >Brian > >This looks fine to me. Indeed the factor of 2 does not affect the outcome, >because it falls out in the division (normalization) step. > >Yours, > >Jan-Mathijs > >PS: you might have to think about whether or not to square the final itc, >to make it consistent with the way it is defined in the literature. > > > >At 04:37 AM 11/9/2006, you wrote: > >Dear Brian, > >Freqanalysis_wltconvol does not support fourier as an output. However, since >wavelet-analysis and fft's in the end are about the same thingy, you could >use freqanalysis_mtmconvol to achieve your goal. >There is a tutorial on the fieldtrip-website which deals with this function, >and uses it in a way that it resembles a wavelet-analysis, in which the >time-frequency resolution is treated in the same way as with standard >wavelet-analysis. > >Phase-locking-value is defined in fieldtrip as a bivariate-measure, so that >means that it quantifies how consistent the phase-relation between two >channels is across trials. >Inter-trial coherence is a bit an odd thingy, because the term coherence >suggests something bivariate, but the way you would like to use it, is >essentially univariate. You want to estimate how consistent the phase of the >oscillations at a particular channel is across trials. >However, both measures use similar math. In fact, when you create a >dummy-fourier-channel you can use the plv-option to obtain your 'itc'. This >is because in this situation, the mathematics become identical. I would >advise it like this: > >Do your freqanalysis as Robert suggested in one of his previous mails (see >below (cfg.keeptapers = 'yes')). >Then create a dummy channel: > >dim = size(freq.fourierspctrm; >freq.fourierspctrm(:,end+1,:,:) = ones(dim([1 3 4])); >freq.label = 'dummy'; > >cfg = []; >cfg.cohmethod = 'plv'; >cfg.channelcmb = channelcombination({'dummy' 'all'}, freq.label); %should >work > >itc = freqdescriptives(cfg, freq); > >Your 'itc' now is contained in the field itc.cohspctrm; > >The check whether this is correctly done is done outside fieldtrip: > >itc2 = abs(mean(freq.fourierspctrm./abs(freq.fourierspctrm),1)); > >Yours, > >Jan-Mathijs > > >-----Original Message----- >From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf >Of Brian Roach >Sent: Wednesday, November 08, 2006 11:13 PM >To: FIELDTRIP at NIC.SURFNET.NL >Subject: Re: [FIELDTRIP] freqanalysis_wltconvol.m question > >Robert, >Thanks for your quick reply. I did not realize that >freqanalysis_wltconvol.m allowed for 'fourier' output, but maybe I need to >download the latest version. Or, do you mean I should use freqanalysis_mtm >instead? Also, how does ITC differ from phase-locking value? I thought >they were the same measure. >At 04:56 PM 11/8/2006, you wrote: > >Hi Brian > > > >On 8 Nov 2006, at 21:20, Brian Roach wrote: > >>eI would like to take this complex output and use it to calculate > >>phase-locking factor, but I am not sure what parts of the power > >>transformation need to be removed - just the abs() and the > >>squaring? Clarification of this line of code would be extremely > >>helpful to me. > > > >You can use the existing code for that: > > > >For computing the phase-locking value I suggest that you use either > > cfg.output='fourier' > > cfg.keeptrials='yes' > > cfg.keeptapers='yes' > >or > > cfg.output='fourier' > > cfg.keeptrials='yes' > > cfg.keeptapers='no' (not needed now) > > cfg.channelcmb = something, see the help > >in freqanalysis. > > > >Subsequently, use the option > > cfg.cohmethod='plv' > >in freqdescriptives. In case of fourier output in freqanalysis, you > >should specify the channel combinations here. > > > >... > >Looking back at your previous mail, I see that you mean ITC and not > >PLV. The stuff above then does not apply. You can do output=fourier > >in freqanalysis and work manually on the output freq structure. I > >think that this should work > > > >magnitude = abs(freq.fourierspctrm); > >scaled = freq.fourierspctrm ./ magnitude; > >freq.itcspctrm = mean(scaled, 1); > >freq = rmfield(freq, 'fourierspctrm'); % remove the single > >fourierspectrum, to avoid confusion > >freq.dimord = 'chan_freq_time'; % remove the rpt or rpttap > >dimension > > > >best regards, > >Robert > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From r.oostenveld at FCDONDERS.RU.NL Wed Nov 29 18:20:26 2006 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Wed, 29 Nov 2006 18:20:26 +0100 Subject: [FIELDTRIP] reading .sdq format In-Reply-To: <20061129115755.65556.qmail@web26015.mail.ukl.yahoo.com> Message-ID: Hi Jeremie On 29 Nov 2006, at 12:57, Jeremie MATTOUT wrote: > The problem is that the .zip file for that format is empty. The yokogawa zip file indeed was corrupt, but I fixed it immediately after your previous mail. So please try again. (I just checked, it is now ok) > Actually, the lst fileio...zip is empty as well! Ok, I'll remove that. > I've downloaded the most recent fileio.zip available but the > keyval.m function was missing !? Sorry. I'll include it in future versions. Please find the keyval function attached, you can put it in private. best Robert PS version and release management is quite a lot of work, and sometimes stuff breaks the different versions of the modules. Thanks for letting me know, since it is something that I would not notice myself. -------------- next part -------------- A non-text attachment was scrubbed... Name: keyval.m Type: application/octet-stream Size: 726 bytes Desc: not available URL: -------------- next part -------------- From Pascal.Fries at FCDONDERS.RU.NL Wed Nov 29 21:18:06 2006 From: Pascal.Fries at FCDONDERS.RU.NL (Pascal Fries) Date: Wed, 29 Nov 2006 21:18:06 +0100 Subject: FW: Still getting NaNs Message-ID: I used freqanalysis_mtmconvol with output= fourier and then called freqdescriptives and got this error message: > ??? Reference to non-existent field 'cumtapcnt'. > > Error in ==> fourier2crsspctrm at 79 > Nrpt = length(freq.cumtapcnt); > > Error in ==> freqdescriptives at 290 > freq = fourier2crsspctrm(tmpcfg, freq); Why didn't freqanalysis give freq.cumtapcnt? Best, Pascal From Jan.Schoffelen at FCDONDERS.RU.NL Wed Nov 29 21:58:47 2006 From: Jan.Schoffelen at FCDONDERS.RU.NL (Jan Mathijs Schoffelen) Date: Wed, 29 Nov 2006 21:58:47 +0100 Subject: freqanalysis_wltconvol.m question In-Reply-To: <6.1.2.0.2.20061129121815.04dd3ec0@email.med.yale.edu> Message-ID: Dear Brian, Then I would say not to square it. Yours, Jan-Mathijs _____ From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf Of Brian Roach Sent: Wednesday, November 29, 2006 6:20 PM To: FIELDTRIP at NIC.SURFNET.NL Subject: Re: [FIELDTRIP] freqanalysis_wltconvol.m question Thanks again, I have just one last follow-up question: Why would you square the final ITC? Tallon-Baudry et al. do not do this in their j Neurosci. '97 publication. Brian At 02:02 AM 11/21/2006, Jan Mathijs Schoffelen wrote: Dear Brian et al, _____ From: Brian Roach [mailto:Brian.Roach at yale.edu] Sent: Monday, November 20, 2006 11:56 PM To: Jan Mathijs Schoffelen Subject: Re: [FIELDTRIP] freqanalysis_wltconvol.m question Hi, I could not get this posted to the list, and figured since you gave most of the feedback, I would see what you think. thanks, Brian Date: Mon, 13 Nov 2006 12:09:00 -0500 To: FieldTrip discussion list From: Brian Roach Subject: Re: [FIELDTRIP] freqanalysis_wltconvol.m question Bcc: Daniel Mathalon Thanks for the advice, I am wondering if FT users would agree that this is an acceptable way to estimate univariate phase coherence: In freqanalysis_wltconvol.m, line 283: % powdum = (2.* abs(autspctrmacttap) ./ data.fsample) .^ 2; powdum = (2.*autspctrmacttap ./ data.fsample); 1. I've commented out the power line and inserted basically the same thing (but not squared) 2. As suggested, I change cfg.keeptrials = 'yes'; 3. After running freqanalysis.m, in the command prompt: itc = abs(mean(squeeze(freq.powspctrm)./abs(squeeze(freq.powspctrm)),1)) squeeze is used because freq.powspctrm is a 3 d matrix including sites, times, and frequencies and in the above case I am just getting itc from 1 channel. Does this method seem alright? Regarding step #1 above, it seemed to make no difference whether I left the 2.* in that equation or not, which seems consistent with an earlier e-mail that mentioned this multiplication being tied into power, so it does not influence phase angle. Is that right? Or, should it be taken out for my purposes? thanks, Brian This looks fine to me. Indeed the factor of 2 does not affect the outcome, because it falls out in the division (normalization) step. Yours, Jan-Mathijs PS: you might have to think about whether or not to square the final itc, to make it consistent with the way it is defined in the literature. At 04:37 AM 11/9/2006, you wrote: Dear Brian, Freqanalysis_wltconvol does not support fourier as an output. However, since wavelet-analysis and fft's in the end are about the same thingy, you could use freqanalysis_mtmconvol to achieve your goal. There is a tutorial on the fieldtrip-website which deals with this function, and uses it in a way that it resembles a wavelet-analysis, in which the time-frequency resolution is treated in the same way as with standard wavelet-analysis. Phase-locking-value is defined in fieldtrip as a bivariate-measure, so that means that it quantifies how consistent the phase-relation between two channels is across trials. Inter-trial coherence is a bit an odd thingy, because the term coherence suggests something bivariate, but the way you would like to use it, is essentially univariate. You want to estimate how consistent the phase of the oscillations at a particular channel is across trials. However, both measures use similar math. In fact, when you create a dummy-fourier-channel you can use the plv-option to obtain your 'itc'. This is because in this situation, the mathematics become identical. I would advise it like this: Do your freqanalysis as Robert suggested in one of his previous mails (see below (cfg.keeptapers = 'yes')). Then create a dummy channel: dim = size(freq.fourierspctrm; freq.fourierspctrm(:,end+1,:,:) = ones(dim([1 3 4])); freq.label = 'dummy'; cfg = []; cfg.cohmethod = 'plv'; cfg.channelcmb = channelcombination({'dummy' 'all'}, freq.label); %should work itc = freqdescriptives(cfg, freq); Your 'itc' now is contained in the field itc.cohspctrm; The check whether this is correctly done is done outside fieldtrip: itc2 = abs(mean(freq.fourierspctrm./abs(freq.fourierspctrm),1)); Yours, Jan-Mathijs -----Original Message----- From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf Of Brian Roach Sent: Wednesday, November 08, 2006 11:13 PM To: FIELDTRIP at NIC.SURFNET.NL Subject: Re: [FIELDTRIP] freqanalysis_wltconvol.m question Robert, Thanks for your quick reply. I did not realize that freqanalysis_wltconvol.m allowed for 'fourier' output, but maybe I need to download the latest version. Or, do you mean I should use freqanalysis_mtm instead? Also, how does ITC differ from phase-locking value? I thought they were the same measure. At 04:56 PM 11/8/2006, you wrote: >Hi Brian > >On 8 Nov 2006, at 21:20, Brian Roach wrote: >>eI would like to take this complex output and use it to calculate >>phase-locking factor, but I am not sure what parts of the power >>transformation need to be removed - just the abs() and the >>squaring? Clarification of this line of code would be extremely >>helpful to me. > >You can use the existing code for that: > >For computing the phase-locking value I suggest that you use either > cfg.output='fourier' > cfg.keeptrials='yes' > cfg.keeptapers='yes' >or > cfg.output='fourier' > cfg.keeptrials='yes' > cfg.keeptapers='no' (not needed now) > cfg.channelcmb = something, see the help >in freqanalysis. > >Subsequently, use the option > cfg.cohmethod='plv' >in freqdescriptives. In case of fourier output in freqanalysis, you >should specify the channel combinations here. > >... >Looking back at your previous mail, I see that you mean ITC and not >PLV. The stuff above then does not apply. You can do output=fourier >in freqanalysis and work manually on the output freq structure. I >think that this should work > >magnitude = abs(freq.fourierspctrm); >scaled = freq.fourierspctrm ./ magnitude; >freq.itcspctrm = mean(scaled, 1); >freq = rmfield(freq, 'fourierspctrm'); % remove the single >fourierspectrum, to avoid confusion >freq.dimord = 'chan_freq_time'; % remove the rpt or rpttap >dimension > >best regards, >Robert > -------------- next part -------------- An HTML attachment was scrubbed... URL: From Jan.Schoffelen at FCDONDERS.RU.NL Wed Nov 29 22:02:04 2006 From: Jan.Schoffelen at FCDONDERS.RU.NL (Jan Mathijs Schoffelen) Date: Wed, 29 Nov 2006 22:02:04 +0100 Subject: FW: Still getting NaNs In-Reply-To: <001501c713f3$7b140a00$6de36391@fcdonders.nl> Message-ID: Dear Pascal, This is a known problem and should be fixed. The easiest workaround is to manually add a cumtapcnt prior to calling freqdescriptives: freq.cumtapcnt = ones(size(freq.fourierspctrm,1),1); Yours, Jan-Mathijs -----Original Message----- From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf Of Pascal Fries Sent: Wednesday, November 29, 2006 9:18 PM To: FIELDTRIP at NIC.SURFNET.NL Subject: [FIELDTRIP] FW: Still getting NaNs I used freqanalysis_mtmconvol with output= fourier and then called freqdescriptives and got this error message: > ??? Reference to non-existent field 'cumtapcnt'. > > Error in ==> fourier2crsspctrm at 79 > Nrpt = length(freq.cumtapcnt); > > Error in ==> freqdescriptives at 290 > freq = fourier2crsspctrm(tmpcfg, freq); Why didn't freqanalysis give freq.cumtapcnt? Best, Pascal From Pascal.Fries at FCDONDERS.RU.NL Wed Nov 29 22:05:14 2006 From: Pascal.Fries at FCDONDERS.RU.NL (Pascal Fries) Date: Wed, 29 Nov 2006 22:05:14 +0100 Subject: FW: Still getting NaNs In-Reply-To: <001701c713f9$9fb39780$902dae83@fcdonders.nl> Message-ID: Thanks!!! > -----Original Message----- > From: FieldTrip discussion list > [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf Of Jan Mathijs Schoffelen > Sent: Wednesday, 29 November, 2006 22:02 > To: FIELDTRIP at NIC.SURFNET.NL > Subject: Re: [FIELDTRIP] FW: Still getting NaNs > > Dear Pascal, > > This is a known problem and should be fixed. The easiest > workaround is to manually add a cumtapcnt prior to calling > freqdescriptives: > > freq.cumtapcnt = ones(size(freq.fourierspctrm,1),1); > > Yours, > > Jan-Mathijs > > > -----Original Message----- > From: FieldTrip discussion list > [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf Of Pascal Fries > Sent: Wednesday, November 29, 2006 9:18 PM > To: FIELDTRIP at NIC.SURFNET.NL > Subject: [FIELDTRIP] FW: Still getting NaNs > > > > I used freqanalysis_mtmconvol with output= fourier and then > called freqdescriptives and got this error message: > > > ??? Reference to non-existent field 'cumtapcnt'. > > > > Error in ==> fourier2crsspctrm at 79 > > Nrpt = length(freq.cumtapcnt); > > > > Error in ==> freqdescriptives at 290 > > freq = fourier2crsspctrm(tmpcfg, freq); > > Why didn't freqanalysis give freq.cumtapcnt? > > Best, Pascal > From wibral at MPIH-FRANKFURT.MPG.DE Wed Nov 29 22:22:41 2006 From: wibral at MPIH-FRANKFURT.MPG.DE (Michael Wibral) Date: Wed, 29 Nov 2006 22:22:41 +0100 Subject: Reading in data from a new CTF system with ECC Message-ID: Robert, thank you very much. The trialfun_general indeed does the job (at least for my simple design). Best Regards, Michael >Hi Michael > >On 29 Nov 2006, at 15:11, Michael Wibral wrote: >> I'm trying to read in data from a CTF 275 channel system. >> ... >> When I use trialfun_ctf_continuous to read in the data no triggers are >> found and as a consequence no trials are defined - I wonder whether >> there is a problem with things like the 'STIM' channel and the >> [backpanel, frontpanel] stuff as the machine doesn't seem to have any >> back or frontpanel - but the ECC instead. > >I indeed think that the problem is that trialfun_ctf_continuous >assumes back and frontpanel. The code in that trialfun predates the >read_event code, and it is not maintained. You can use >trialfun_general instead, or make your own trialfun. Read the help of >definetrial to see what trialfun_general can do for you (not too >much, but it might be enough). > >Alternatively, have a look at the bottom of the page >http://www2.ru.nl/fcdonders/fieldtrip/doku.php? >id=fieldtrip:documentation:tutorial:eventrelatedaveraging >to see a straightforward example trialfun. For that, you should also >look into read_fcdc_event. > >We also use pseudocontinuous data at the Donders. Note that you have >to do cfg.datatype='continuous' in preprocessing and artifact detection. > >> I have also tried to trial the data inside the CTF Software (using >> newDs >> with the corresponding markers) and then to use trialfun_ctf_epoched >> with the same result. > >Also the trialfun_ctf_epoched is very old. > >> BESA reads the triggers however without problems, both, their values >> (1,2,3...) and der names. so I think the data format shouldn't have >> changed too much. > >No, the dataformat indeed did not change that much. It is also >already implemented in the read_fcdc_event code, and the general >trial function (or custom trial functions) can work with it. > >best regards, >Robert From jeremiemattout at YAHOO.FR Thu Nov 30 10:30:34 2006 From: jeremiemattout at YAHOO.FR (Jeremie MATTOUT) Date: Thu, 30 Nov 2006 09:30:34 +0000 Subject: [FIELDTRIP] Re : [FIELDTRIP] reading .sdq format Message-ID: Dear Robert, thanks very much for your help and time. I now could access and run the routines. However, the .sqd fileformat does not seem to be supported. I don't know if I missed something here but if not, could anyone advise me on some filter routine that would enable me to then read them in Matlab? Best, Jeremie ----- Message d'origine ---- De : Robert Oostenveld À : FIELDTRIP at NIC.SURFNET.NL Envoyé le : Mercredi, 29 Novembre 2006, 17h20mn 26s Objet : Re: [FIELDTRIP] Re : [FIELDTRIP] reading .sdq format Hi Jeremie On 29 Nov 2006, at 12:57, Jeremie MATTOUT wrote: > The problem is that the .zip file for that format is empty. The yokogawa zip file indeed was corrupt, but I fixed it immediately after your previous mail. So please try again. (I just checked, it is now ok) > Actually, the lst fileio...zip is empty as well! Ok, I'll remove that. > I've downloaded the most recent fileio.zip available but the > keyval.m function was missing !? Sorry. I'll include it in future versions. Please find the keyval function attached, you can put it in private. best Robert PS version and release management is quite a lot of work, and sometimes stuff breaks the different versions of the modules. Thanks for letting me know, since it is something that I would not notice myself. ___________________________________________________________________________ Découvrez une nouvelle façon d'obtenir des réponses à toutes vos questions ! Profitez des connaissances, des opinions et des expériences des internautes sur Yahoo! Questions/Réponses http://fr.answers.yahoo.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From wibral at MPIH-FRANKFURT.MPG.DE Thu Nov 30 10:40:55 2006 From: wibral at MPIH-FRANKFURT.MPG.DE (Michael Wibral) Date: Thu, 30 Nov 2006 10:40:55 +0100 Subject: Reading data with trialfun_general Message-ID: Dear Robert, as I replied yesterday, trialfun_general does indeed create trials, at least if I directly specify eventtype as a string. If I however try to use eventvalues from the trigger channel (UPPT001 in my case) I noticed that FT changes the values from what presentation send (and from what BESA reads correctly) in the following way: Stimulus CTFdisplay BESAreading FTreading 'StimUpper' 2 2 3 'StimMiddle' 3 3 5 'StimLower' 4 4 7 i.e. it changes it from the first three numbers bigger than 1 to the first three odd numbers that are bigger than one. Is it possible that there is still some frontpanel+backpanel binary addition going on - even in trialfun_general? Thank you very much for your help. Best Regards, Michael From r.oostenveld at FCDONDERS.RU.NL Thu Nov 30 11:02:01 2006 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Thu, 30 Nov 2006 11:02:01 +0100 Subject: [FIELDTRIP] Re : [FIELDTRIP] reading .sdq format In-Reply-To: <20061130093034.38442.qmail@web26002.mail.ukl.yahoo.com> Message-ID: Hu Jeremie On 30 Nov 2006, at 10:30, Jeremie MATTOUT wrote: > However, the .sqd fileformat does not seem to be supported. > I don't know if I missed something here but if not, could anyone > advise me on some filter routine that would enable me to then read > them in Matlab? I recall that the sdq format is an averaged format that is not supported any more (I could be wrong here). As suggested to me by Masahiro Shimogawara, one of the engineers at Yokogawa, I have dropped support for it. If you can, please use the *.ave file instead. See below for his message: On 24 Oct 2005, at 4:56, Masahiro.Shimogawara at jp.yokogawa.com wrote: > I have added some programs to your toolbox. Please refer the attached > files. > > 1) I have changed the code in filetype.m not to use the extension > ".sqd". > Because this extension remains for compatibility and we have not > use > one any more. It might be that it is only the extension, try renaming the file to *.ave and see whether it works with read_header and read_data. Robert From jeremiemattout at YAHOO.FR Thu Nov 30 12:20:20 2006 From: jeremiemattout at YAHOO.FR (Jeremie MATTOUT) Date: Thu, 30 Nov 2006 11:20:20 +0000 Subject: [FIELDTRIP] Re : [FIELDTRIP] Re : [FIELDTRIP] reading .sdq format Message-ID: Dear Robert, Thanks a lot, it is working now. Well I am facing a memory problem but the routine seems to do the job. FYI, I had to comment the use of hastoolbox.m function in both read_data and read_header since I could not find this function. Also I corrected a parsing error on line 226 of read_yokogawa_data.m All the best, Jeremie ___________________________________________________________________________ Découvrez une nouvelle façon d'obtenir des réponses à toutes vos questions ! Profitez des connaissances, des opinions et des expériences des internautes sur Yahoo! Questions/Réponses http://fr.answers.yahoo.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From r.oostenveld at FCDONDERS.RU.NL Thu Nov 30 14:27:52 2006 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Thu, 30 Nov 2006 14:27:52 +0100 Subject: [FIELDTRIP] Re : [FIELDTRIP] Re : [FIELDTRIP] reading .sdq format In-Reply-To: <20061130112020.47118.qmail@web26006.mail.ukl.yahoo.com> Message-ID: On 30 Nov 2006, at 12:20, Jeremie MATTOUT wrote: > FYI, I had to comment the use of hastoolbox.m function in both > read_data and read_header since I could not find this function. > Also I corrected a parsing error on line 226 of read_yokogawa_data.m thanks, I'll fix those two bugs in the next fileio version. Robert From marco.buiatti at GMAIL.COM Thu Nov 30 15:27:46 2006 From: marco.buiatti at GMAIL.COM (Marco Buiatti) Date: Thu, 30 Nov 2006 15:27:46 +0100 Subject: CRA on ERPs Message-ID: Dear FieldTrippers, I have a question on the use and interpretation of Cluster Randomization Analysis on ERPs. I analised the statistical difference between 2 conditions (9 subjects, within-subjects design), and I obtained two NON-significant clusters, one negative in the frontal lobe (p=0.24) and one positive in posterior regions (p=0.08). These clusters emerge and die at almost the same times, so they really look like reflecting the SAME process. I tested this hypothesis by performing the same analysis on the absolute value of the ERPs: now a significant positive cluster (p=0.02) emerges at the same latency of the previous two, and spatially overlapping to their topography. Do you think that this procedure is plausible, or alternatively that it is not correct and the effect is just too weak? Anyone faced a similar problem and has alternative procedures? Thanks, Marco -- Marco Buiatti - Post Doc ************************************************************** Cognitive Neuroimaging Unit - INSERM U562 Service Hospitalier Frederic Joliot, CEA/DRM/DSV 4 Place du general Leclerc, 91401 Orsay cedex, France Telephone: +33 1 69 86 77 65 Fax: +33 1 69 86 78 16 E-mail: marco.buiatti at gmail.com Web: www.unicog.org *************************************************************** From thomas at UCSD.EDU Thu Nov 30 17:42:07 2006 From: thomas at UCSD.EDU (Thomas Thesen) Date: Thu, 30 Nov 2006 11:42:07 -0500 Subject: freqbaseline & zscore Message-ID: Dear Fieldtrippers, It's been quite busy on this list lately. Nice! I have three quick questions. In version 20060605 of FT, there is an option for cf.baselinetype = zscore; but it is commented out in freqbaseline.m. Is there a specific reason for it, i.e. is the code for computing a zscore for baseline vs active not correct? Is there an inbuilt option to plot the spectrograms with multiplotTFR funcions 'as they are', i.e. without any baseline operations, just the raw values. So far I've been using imagesc on the data matrix, but would like to plot them in an arrangement specified by the .lay file. And is there a way to compute a 2D representation of the frequency spectrum of a particular channel? Like a typical FFT plot with frequency on the x axis and power on the y axis? Thanks a lot, Thomas -------------- next part -------------- An HTML attachment was scrubbed... URL: From maris at NICI.RU.NL Thu Nov 30 21:44:03 2006 From: maris at NICI.RU.NL (Eric Maris) Date: Thu, 30 Nov 2006 21:44:03 +0100 Subject: CRA on ERPs In-Reply-To: <22f732b0611300627y44f34263hd09a1cdd3582af50@mail.gmail.com> Message-ID: Hi Marco, > I have a question on the use and interpretation of Cluster > Randomization Analysis on ERPs. I analised the statistical difference > between 2 conditions (9 subjects, within-subjects design), and I > obtained two NON-significant clusters, one negative in the frontal > lobe (p=0.24) and one positive in posterior regions (p=0.08). These > clusters emerge and die at almost the same times, so they really look > like reflecting the SAME process. I tested this hypothesis by > performing the same analysis on the absolute value of the ERPs: now a > significant positive cluster (p=0.02) emerges at the same latency of > the previous two, and spatially overlapping to their topography. > > Do you think that this procedure is plausible, or alternatively that > it is not correct and the effect is just too weak? Anyone faced a > similar problem and has alternative procedures? If you had decided to run Cluster Randomizaton Analysis on the absolute value of the ERP's WITHOUT HAVING LOOKED AT YOUR DATA, then you would have controlled your Type 1 error (false alarm) rate at 0.05. This does not imply that, for your data, the null hypothesis holds. I would advise you to run Cluster Randomization Analysis on the data of each of the subjects separately. If the same significant spatiotemporal pattern shows up in the majority of the subjects, then I would be convinced that something interesting is going on here. However, in this way, you are not testing a random effects null hypothesis. Maybe you can live with this. I can live with it, and so do all monkey neuroscientists with their N=2 studies. Greetings, Eric > > Thanks, > > Marco > > > > -- > Marco Buiatti - Post Doc > > ************************************************************** > Cognitive Neuroimaging Unit - INSERM U562 > Service Hospitalier Frederic Joliot, CEA/DRM/DSV > 4 Place du general Leclerc, 91401 Orsay cedex, France > Telephone: +33 1 69 86 77 65 Fax: +33 1 69 86 78 16 > E-mail: marco.buiatti at gmail.com Web: www.unicog.org > *************************************************************** From s.debener at UKE.UNI-HAMBURG.DE Thu Nov 30 23:22:02 2006 From: s.debener at UKE.UNI-HAMBURG.DE (Stefan Debener) Date: Thu, 30 Nov 2006 23:22:02 +0100 Subject: CRA on ERPs In-Reply-To: <22f732b0611300627y44f34263hd09a1cdd3582af50@mail.gmail.com> Message-ID: Dear Marco, I have noticed the same phenomenon with other channel-wise statistics (like sample-wise ttests) before. A nose-tip recorded ERP P3, for instance, may show a significant condition effect (e.g. target vs non-target) at parietal electrodes. This condition effect often is "mirrored" to, and "shared" with, frontal sites after re-referencing the data to the common average. At these formerly "inactive" frontal electrodes, the time course and morphology of the parietal P3 now shows up, with the absolute amplitude being decreased and the polarity reversed (due to re-referencing). As a result, if you look at the spatial pattern of p values before/after re-referencing, a previously significant effect at parietal sites may now turn out to be non-significant. Probably a good argument for doing statistical analysis on the source level (which may come with other prolems). Best, Stefan Marco Buiatti wrote: > Dear FieldTrippers, > > I have a question on the use and interpretation of Cluster > Randomization Analysis on ERPs. I analised the statistical difference > between 2 conditions (9 subjects, within-subjects design), and I > obtained two NON-significant clusters, one negative in the frontal > lobe (p=0.24) and one positive in posterior regions (p=0.08). These > clusters emerge and die at almost the same times, so they really look > like reflecting the SAME process. I tested this hypothesis by > performing the same analysis on the absolute value of the ERPs: now a > significant positive cluster (p=0.02) emerges at the same latency of > the previous two, and spatially overlapping to their topography. > > Do you think that this procedure is plausible, or alternatively that > it is not correct and the effect is just too weak? Anyone faced a > similar problem and has alternative procedures? > > Thanks, > > Marco > > > From hanneke.vandijk at FCDONDERS.RU.NL Wed Nov 1 09:54:15 2006 From: hanneke.vandijk at FCDONDERS.RU.NL (Hanneke van Dijk) Date: Wed, 1 Nov 2006 09:54:15 +0100 Subject: Clusterrandanalysis In-Reply-To: <7.0.0.16.0.20061031180808.019e58a8@tiscali.it> Message-ID: Dear all, I have been working with clusterrandanalysis a while ago and started the same scripts this week, but I don't seem to be able to replicate my previous results. Has something been changed in the function? If yes, how can I solve that? Best, Hanneke _________________________________________________ Hanneke van Dijk-van de Geijn Ph. D. Student Measuring and Modeling Magnetic Brain Activity F.C. Donders Centre for Cognitive Neuroimaging. e-mail: hanneke.vandijk at fcdonders.ru.nl tel: 024-3610985 From maris at NICI.RU.NL Wed Nov 1 10:19:24 2006 From: maris at NICI.RU.NL (Eric Maris) Date: Wed, 1 Nov 2006 10:19:24 +0100 Subject: Clusterrandanalysis In-Reply-To: <000601c6fd93$4f2f5640$302dae83@fcdonders.nl> Message-ID: Dear Hanneke, > -----Original Message----- > From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf Of > Hanneke van Dijk > Sent: Wednesday, November 01, 2006 9:54 AM > To: FIELDTRIP at NIC.SURFNET.NL > Subject: [FIELDTRIP] Clusterrandanalysis > > Dear all, > > I have been working with clusterrandanalysis a while ago and started the > same scripts this week, but I don't seem to be able to replicate my previous > results. Has something been changed in the function? If yes, how can I solve > that? I have discussed this with Vladimir Litvak in a non-discussion-list-correspondence. The non-reproducibility is due to an error in the old code (not serious, however). Here is an excerpt from an email to Vladimir that may clarify things: BEGIN EXCERPT With respect to the non-reproducibility of your old result, the cause of the problem lies in the private subfunction findcluster.m. In the old version of findcluster.m (the one you used for your first analyses), the pruning of significant (sensor, frequency)-pairs, as controlled by cfg.minnbchan, was performed incorrectly. This has no consequence for false alarm rate control, because the pruning is part of the procedure for calculating the overall test statistic (i.e., the maximum cluster-level statistic), and the nonparametric test controls the false alarm rat for all test statistics. You will get your old result with the latest FT version if you replace cfg.minnbchan=2 by cfg.minnbchan=1. The error in the old version of findcluster.m was that the number of neighboring significant (sensor, frequency)-pairs was calculated incorrectly for symmetric neighbourhood structures. So, when reporting about your results, you have to change nothing, except that you may mention that the option cfg.minnbchan=1 was used. END EXCERPT Good luck, Eric From r.oostenveld at FCDONDERS.RU.NL Wed Nov 1 14:20:52 2006 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Wed, 1 Nov 2006 14:20:52 +0100 Subject: SPM integration In-Reply-To: <007b01c6fcf5$e06e7440$f0463ec1@sobell.ion.ucl.ac.uk> Message-ID: Hi Vladimir, On 31 Oct 2006, at 15:06, Vladimir Litvak wrote: > I'm starting to work on a project where I will analyze data > preprocessed in FT with SPM5 (www.fil.ion.ucl.ac.uk/spm/). For this > purpose I'd like to develop FT/SPM integration routines. It would be really nice if you could work on that. > I'll probably start with my immediate needs but I think I'm > motivated enough at the moment to eventually turn it into something > of general usefulness. If anyone has already worked in this > direction and has some code or would like to collaborate please let > me know. I am not aware of anything substantial in this direction, except that James Kilner and I have been exchanging emails about CTF dataformats (it could be that he is using snippets of our code). Furthermore, I know that Stefan Kiebel has integrated the EEG forward modelling code from FieldTrip into SPM. I have CCd this mail to them. > I'm affiliated to the methods group at FIL so I can get help from > SPM developers if necessary. Right now I'd like to be able to use > FT to read any FT supported format to SPM. I have split off the import routines (the "fileio" part) that we use in FieldTrip into a seperate package, already with the idea that other projects (SPM, EEGLAB) can reuse and contribute to the reading functions. So you can use the reading functions seperately from FieldTrip. That means that you will not be using the cfg-structure interface to the high-level FT functions, but that you will use the lower level read_header/read_data/read_event functions. See http://www2.ru.nl/fcdonders/fieldtrip/doku.php? id=fieldtrip:development:read_fcdc_xxx The download for the fileio functions is available from ftp:// ftp.fcdonders.nl/pub/fieldtrip/modules. I am considering moving the FT version control system (esp. for the fileio and forwinv module) to an external server (e.g. sourceforge) so that other people can contribute. Sofar I did not find that neccessary, and all external contributions go through email. > Additional question: how does one create low-level routines for a > new (rare) data format to be used by FT preprocessing? Is there a > template or some interface they should adhere to? I suggest that you look into read_header/read_data/read_event (in fieldtrip/private), and that you pick one of the already supported formats that you are familiar with as template. There is also some (sparse) documentation on http://www2.ru.nl/fcdonders/fieldtrip/doku.php? id=fieldtrip:documentation:dataformats#how_can_i_import_my_own_dataforma t. Furthermore, I could dig up some old emails with additional explanation (you are not the first to contribute data format specific code), but I think that the info sofar should already get you started. I will try to update the documentation on the FT wiki as well. best regards, Robert From r.oostenveld at FCDONDERS.RU.NL Wed Nov 1 15:01:17 2006 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Wed, 1 Nov 2006 15:01:17 +0100 Subject: lcmv localization In-Reply-To: <7.0.0.16.0.20061031180808.019e58a8@tiscali.it> Message-ID: Dear Luca, On 31 Oct 2006, at 18:28, Luca Ciancetta wrote: > I'm trying to localize a source with the lcmv method. I understand that you want to use simulated and SEF data. What kind of MEG system do you have? In the code below, you seem to be putting effort into construcing some details that I would not expect to be neccessary (but I might be wrong). > Following, it's the configuration I use: > > time_step = 1/h.smpfq; % the time step depends by sampling frequency > time = 0:time_step:(500*time_step); % I want to see 500 points of data this will give you 501 samples, the first sample is "0", the second is "1" etc. > data.trial{1} = data_raw(gch,0:500); % gch: list of good channels > data.time{1} = time; I suggest that you construct the "grad" seperately, and that you store it in the data (i.e. data.grad = your structure). That also helps for plotting the data. > cfg = []; > cfg.method = 'lcmv'; > cfg.grid.pos = model; % model is a matrix [number_of_sources X 3]. > This represent position of dipoles in the reference of the sphere > which contains them. > > cfg.grad.tra = zeros(nch,nch); % number of good sensors ( size of > 'gch' list ) > for i=1:nch > cfg.grad.pnt(i,: ) = h.ch(gch(i)+offset).pos(1).r_s.comp'; % > positions of MEG sensors in the reference of the spherical model > cfg.grad.ori(i,: ) = h.ch(gch(i)+offset).pos(1).u_s.comp'; % > orientations of MEG sensors in the reference of the spherical model > cfg.grad.tra(i,i) = 1; > cfg.grad.label{i} = sprintf('MZ_%d\n',gch(i)-1); > end Note that all orientation vectors should have length 1, i.e. norm (grad.ori(i,:))=1. The MEG sensors are usually given in head coordinates (i.e. related to the nose and ears in most MEG systems), and the (spherical) volume conduction model can also be defined in head coordinates. SO you don't have to express the positions of MEG sensors in the reference of the spherical model. If you do that, you should also express your dipoles in the same spherical model. All geometrical objects (sensors, dipoles, geometry of the head model) should be expressed in the same coordinates and the same units. > cfg.vol = []; > cfg.vol.r = 65; I presume that you use "mm" as units? You should also add the center of the sphere, i.e. cfg.vol.o = [0 0 0]; The center of the sphere is by default in the origin, but it is good to be explicit about it. > cfg.bpfilter = 'yes'; > cfg.bpfreq = [1 100]; These settings are _not_ used in SOURCEANALYSIS. > data.avg = squeeze(data.trial{1}); > > source = sourceanalysis(cfg,data); Probably you want to use a protocol like this preprocessing -> timelockanalysis -> sourceanalysis where the preprocessing is done manually (i.e. not in FT). You can do timelockanalysis manually as well, but it is more convenient to use FTs timelockanalysis anyway. The filter options above relate to timelockanalysis. Furthermore, you should use cfg.covariance='yes' in timelockanalysis, and you can specify a covariance latency window. > In this case I used only one trial and the result is a localization > in the center of the sphere ( the source is a dipole simulation, it > was placed on the surface of my spherical model). > Also analyzing over more trials or using different data set, for > example a median nerve stimulation, the result was the same. To me it is not clear where your data comes from (since you include only parts of your script), and therefore it is not clear where your problem stems from. See my suggestions above. Your problem may also be related to plotting the power, and not the neural activity index (source.avg.nai, obtained after SOURCEDESCRIPTIVES), the beamformer power is biuassed to deep locations, the NAI corrects that. See http://www2.ru.nl/fcdonders/fieldtrip/doku.php? id=fieldtrip:documentation:tutorial:beamformer#plot_the_result and further on that page. best regards, Robert From marie at PSY.GLA.AC.UK Tue Nov 7 18:59:48 2006 From: marie at PSY.GLA.AC.UK (Marie Smith) Date: Tue, 7 Nov 2006 17:59:48 +0000 Subject: Meg realign In-Reply-To: Message-ID: Hi, I am trying to use the megrealign function in fieldtrip and get an error from the headsurface function that it cannot find the function retriangulate. I have searched through the Fieldtrip toolbox and this does not appear to be a function that is provided. Can you tell me how to get hold of this function or how to perform the realignment without calling it. Thanks, Marie From r.oostenveld at FCDONDERS.RU.NL Tue Nov 7 20:07:13 2006 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Tue, 7 Nov 2006 20:07:13 +0100 Subject: Meg realign In-Reply-To: <7AF45CEA-EBDB-4C89-BD52-B7B613FE4618@psy.gla.ac.uk> Message-ID: Hi Marie I just checked, retriangulate is at least in the latest version of fieldtrip (in the fieldtrip/private directory, where it also should be). It may be missing from your copy if your copy is old. Please get the latest fieldtrip version from the ftp server. best regards, Robert On 7 Nov 2006, at 18:59, Marie Smith wrote: > Hi, > > I am trying to use the megrealign function in fieldtrip and get an > error from the headsurface function that it cannot find the > function retriangulate. > I have searched through the Fieldtrip toolbox and this does not > appear to be a function that is provided. > > Can you tell me how to get hold of this function or how to perform > the realignment without calling it. > > Thanks, > > Marie From p.cornelissen at PSYCH.YORK.AC.UK Wed Nov 8 15:19:00 2006 From: p.cornelissen at PSYCH.YORK.AC.UK (Piers Cornelissen) Date: Wed, 8 Nov 2006 15:19:00 +0100 Subject: Statistical comparisons in virtual electrode spectrograms Message-ID: Dear all Can anyone advise on the following: I have 6 sets of virtual electrode data (from CTF based MEG recordings) from a total of 9 subjects, each of whom carried out 4 conditions of interest. So far, for each virtual electrode I have succeeded (I hope) in computing group level spectrograms for each condition, where each spectrogram reflects either evoked or evoked+induced power changes. What I would like to do is to a) compare spectrograms, and also b)compute statistics for each group level spectrogram to ask the question whether the power changes in the active window (0 - 700ms) are significantly different from the those in the passive/baseline window (-250 - 0 ms). So far I have had alot of help from Jan, and, on his suggestion, I have copied out my query below, plus provided the matlab scripts which cause the problem: The attached script E_versus_EI.m shows the code for analysing one condition from one particular virtual electrode. This gives the evoked as well as the evoked+induced spectrograms (as far as I understand it). To carry out the comaprison between the evoked versus evoked+Induced test, I thought I should be able to modify the freqgrandaverage step for generating both iefgranfavg and efgrandavg by setting cfg.keepindividual to 'yes'. In doing so, I was hoping that this would retain the 9 separate powerspectra in each case, which it seems to have done. I was then hoping that this would be sufficient input to the second script test_clusrand.m (which is just a minor modification of E_versus_EL.m). Certainly the powspctrm field for each dataset appears as: [4-D double] which I think is correct. However, when I ran clusterrandanalysis on iefgranfavg and efgrandavg, I got the following errors: >> cfg15 = statistic: 'depsamplesT' alphathresh: 0.0500 makeclusters: 'yes' minnbchan: 2 clusterteststat: 'maxsum' onetwo: 'twosided' alpha: 0.0500 nranddraws: 100 channel: {'V0'} >> %cfg15.latency = [0 0.5] % increases sensitivity if prior temporal information is knowm >> cfg15.frequency = [5 40]; >> >> %frange = 'all_freqs'; % file addition for saving >> >> [clusrand] = clusterrandanalysis (cfg15, ind_efgrandavg, ind_iefgrandavg); Selecting and formatting the data. selected 1 channels selected 191 time bins selected 176 frequency bins Calculating the neighbourhood structure of the channels. ??? Error using ==> clusterrandanalysis (getneighbgeometry) Did not find gradiometer or electrode information. Error in ==> /home/willis/plc/matlab/clusterrandanalysis.m On line 473 ==> [cfg,data] = getneighbgeometry(cfg,data,varargin{1}); >> I noticed also that the way I used freqgrandaverage in order to compile the two datasets appeared to throw out the gradiometer information. At least there was a warning to this effect. So, I am guessing that using freqgrandaverage in this way is incorrect. Therefore please could anyone suggest how I compile my 2 sets of nine spectrograms in such a way that they provide appropriate input to clusterrandanalysis. Or, if as Jan seems to suggest, that clusterrandanalysis can't cope with virtual electrode data, does anyone have any other clever solutions. Please! Thanks in anticipation Piers C -------------- next part -------------- A non-text attachment was scrubbed... Name: test_clusrand.m Type: application/octet-stream Size: 4665 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: E_versus_EI.m Type: application/octet-stream Size: 4809 bytes Desc: not available URL: From maris at NICI.RU.NL Wed Nov 8 16:05:53 2006 From: maris at NICI.RU.NL (Eric Maris) Date: Wed, 8 Nov 2006 16:05:53 +0100 Subject: Statistical comparisons in virtual electrode spectrograms In-Reply-To: Message-ID: Hi Piers, I think this is an easy problem to solve. In fact, you are not the first person to stumble over it. The cause of the problem is that freqgrandaverage throws away the gradiometer configurations (the .grad-fields) that are present in each of the subject-specific data structures produced by freqanalysis. The solution is simple: Copy a .grad-field from one subjects (it does not matter which one) to ind_efgrandavg and rerun clusterrandanalysis. In the analysis, this .grad-field is only used to calculate the neighbourhood-structure. Good luck, Eric Maris > -----Original Message----- > From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf Of > Piers Cornelissen > Sent: Wednesday, November 08, 2006 3:19 PM > To: FIELDTRIP at NIC.SURFNET.NL > Subject: [FIELDTRIP] Statistical comparisons in virtual electrode spectrograms > > Dear all > > Can anyone advise on the following: > > I have 6 sets of virtual electrode data (from CTF based MEG recordings) > from a total of 9 subjects, each of whom carried out 4 conditions of > interest. > > So far, for each virtual electrode I have succeeded (I hope) in computing > group level spectrograms for each condition, where each spectrogram > reflects either evoked or evoked+induced power changes. > > What I would like to do is to a) compare spectrograms, and also b)compute > statistics for each group level spectrogram to ask the question whether > the power changes in the active window (0 - 700ms) are significantly > different from the those in the passive/baseline window (-250 - 0 ms). > > So far I have had alot of help from Jan, and, on his suggestion, I have > copied out my query below, plus provided the matlab scripts which cause > the problem: > > The attached script E_versus_EI.m shows the code for > analysing one condition from one particular virtual electrode. This gives > the evoked as well as the evoked+induced spectrograms (as far as I > understand it). > > To carry out the comaprison between the evoked versus evoked+Induced test, > I thought I should be able to modify the freqgrandaverage step for > generating both iefgranfavg and efgrandavg by setting cfg.keepindividual > to 'yes'. In doing so, I was hoping that this would retain the 9 separate > powerspectra in each case, which it seems to have done. I was then hoping > that this would be sufficient input to the second script test_clusrand.m > (which is just a minor modification of E_versus_EL.m). Certainly the > powspctrm field for each dataset appears as: [4-D double] which I think is > correct. > > However, when I ran clusterrandanalysis on iefgranfavg and efgrandavg, I > got the following errors: > > >> > cfg15 = > > statistic: 'depsamplesT' > alphathresh: 0.0500 > makeclusters: 'yes' > minnbchan: 2 > clusterteststat: 'maxsum' > onetwo: 'twosided' > alpha: 0.0500 > nranddraws: 100 > channel: {'V0'} > > >> %cfg15.latency = [0 0.5] % increases sensitivity if prior temporal > information is knowm > >> cfg15.frequency = [5 40]; > >> > >> %frange = 'all_freqs'; % file addition for saving > >> > >> [clusrand] = clusterrandanalysis (cfg15, ind_efgrandavg, > ind_iefgrandavg); > Selecting and formatting the data. > selected 1 channels > selected 191 time bins > selected 176 frequency bins > Calculating the neighbourhood structure of the channels. > ??? Error using ==> clusterrandanalysis (getneighbgeometry) > Did not find gradiometer or electrode information. > > Error in ==> /home/willis/plc/matlab/clusterrandanalysis.m > On line 473 ==> [cfg,data] = getneighbgeometry(cfg,data,varargin{1}); > > >> > > I noticed also that the way I used freqgrandaverage in order to compile > the two datasets appeared to throw out the gradiometer information. At > least there was a warning to this effect. So, I am guessing that using > freqgrandaverage in this way is incorrect. Therefore please could anyone > suggest how I compile my 2 sets of nine spectrograms in such a way that > they provide appropriate input to clusterrandanalysis. Or, if as Jan seems > to suggest, that clusterrandanalysis can't cope with virtual electrode > data, does anyone have any other clever solutions. > > Please! > > Thanks in anticipation > > Piers C > > > > > > From Jan.Schoffelen at FCDONDERS.RU.NL Wed Nov 8 16:15:34 2006 From: Jan.Schoffelen at FCDONDERS.RU.NL (Jan Mathijs Schoffelen) Date: Wed, 8 Nov 2006 16:15:34 +0100 Subject: Statistical comparisons in virtual electrode spectrograms In-Reply-To: <014c01c70347$62b18170$6401a8c0@fcdonders.nl> Message-ID: Hi Piers and Eric, Eric, you're absolutely right in the case one would analyze sensor-data. However, Piers is working on virtual channel data, so the actual neighbourhood structure does not exist at all, and should be defined such that none of the channels actually has a neighbour. Yours, Jan-Mathijs -----Original Message----- From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf Of Eric Maris Sent: Wednesday, November 08, 2006 4:06 PM To: FIELDTRIP at NIC.SURFNET.NL Subject: Re: [FIELDTRIP] Statistical comparisons in virtual electrode spectrograms Hi Piers, I think this is an easy problem to solve. In fact, you are not the first person to stumble over it. The cause of the problem is that freqgrandaverage throws away the gradiometer configurations (the .grad-fields) that are present in each of the subject-specific data structures produced by freqanalysis. The solution is simple: Copy a .grad-field from one subjects (it does not matter which one) to ind_efgrandavg and rerun clusterrandanalysis. In the analysis, this .grad-field is only used to calculate the neighbourhood-structure. Good luck, Eric Maris > -----Original Message----- > From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf Of > Piers Cornelissen > Sent: Wednesday, November 08, 2006 3:19 PM > To: FIELDTRIP at NIC.SURFNET.NL > Subject: [FIELDTRIP] Statistical comparisons in virtual electrode spectrograms > > Dear all > > Can anyone advise on the following: > > I have 6 sets of virtual electrode data (from CTF based MEG recordings) > from a total of 9 subjects, each of whom carried out 4 conditions of > interest. > > So far, for each virtual electrode I have succeeded (I hope) in computing > group level spectrograms for each condition, where each spectrogram > reflects either evoked or evoked+induced power changes. > > What I would like to do is to a) compare spectrograms, and also b)compute > statistics for each group level spectrogram to ask the question whether > the power changes in the active window (0 - 700ms) are significantly > different from the those in the passive/baseline window (-250 - 0 ms). > > So far I have had alot of help from Jan, and, on his suggestion, I have > copied out my query below, plus provided the matlab scripts which cause > the problem: > > The attached script E_versus_EI.m shows the code for > analysing one condition from one particular virtual electrode. This gives > the evoked as well as the evoked+induced spectrograms (as far as I > understand it). > > To carry out the comaprison between the evoked versus evoked+Induced test, > I thought I should be able to modify the freqgrandaverage step for > generating both iefgranfavg and efgrandavg by setting cfg.keepindividual > to 'yes'. In doing so, I was hoping that this would retain the 9 separate > powerspectra in each case, which it seems to have done. I was then hoping > that this would be sufficient input to the second script test_clusrand.m > (which is just a minor modification of E_versus_EL.m). Certainly the > powspctrm field for each dataset appears as: [4-D double] which I think is > correct. > > However, when I ran clusterrandanalysis on iefgranfavg and efgrandavg, I > got the following errors: > > >> > cfg15 = > > statistic: 'depsamplesT' > alphathresh: 0.0500 > makeclusters: 'yes' > minnbchan: 2 > clusterteststat: 'maxsum' > onetwo: 'twosided' > alpha: 0.0500 > nranddraws: 100 > channel: {'V0'} > > >> %cfg15.latency = [0 0.5] % increases sensitivity if prior temporal > information is knowm > >> cfg15.frequency = [5 40]; > >> > >> %frange = 'all_freqs'; % file addition for saving > >> > >> [clusrand] = clusterrandanalysis (cfg15, ind_efgrandavg, > ind_iefgrandavg); > Selecting and formatting the data. > selected 1 channels > selected 191 time bins > selected 176 frequency bins > Calculating the neighbourhood structure of the channels. > ??? Error using ==> clusterrandanalysis (getneighbgeometry) > Did not find gradiometer or electrode information. > > Error in ==> /home/willis/plc/matlab/clusterrandanalysis.m > On line 473 ==> [cfg,data] = getneighbgeometry(cfg,data,varargin{1}); > > >> > > I noticed also that the way I used freqgrandaverage in order to compile > the two datasets appeared to throw out the gradiometer information. At > least there was a warning to this effect. So, I am guessing that using > freqgrandaverage in this way is incorrect. Therefore please could anyone > suggest how I compile my 2 sets of nine spectrograms in such a way that > they provide appropriate input to clusterrandanalysis. Or, if as Jan seems > to suggest, that clusterrandanalysis can't cope with virtual electrode > data, does anyone have any other clever solutions. > > Please! > > Thanks in anticipation > > Piers C > > > > > > From maris at NICI.RU.NL Wed Nov 8 16:26:28 2006 From: maris at NICI.RU.NL (Eric Maris) Date: Wed, 8 Nov 2006 16:26:28 +0100 Subject: Statistical comparisons in virtual electrode spectrograms In-Reply-To: Message-ID: Hi Piers, In my first reply to your email, I didn't notice that you were analyzing virtual channels. In that case, the suggestion in my previous email will not work. As I see it now, you have only a single virtual channel. In other words, you do not have a spatial dimension in your data. Nevertheless, clusterrandanalysis wants a spatial neighbourhood structure. In the case of virtual channels, you have to construct this neighbourhood structure by hand. Read the help info of clusterrandanalysis, and you will find out how to specify a neighbourhood structure as a cell array (in your case, of length 1) of structs. I also read that you want to compare evoked and (evoked + induced) power spectra. Are these power spectra calculated on the same raw data? If this is the case, does it make sense to test the null hypothesis that they come from the same probability distribution (which is what clusterrandanalysis tests)? This null hypothesis would imply that the pure induced power spectra are zero. Do I see this correctly? Greetings, Eric > -----Original Message----- > From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf Of > Piers Cornelissen > Sent: Wednesday, November 08, 2006 3:19 PM > To: FIELDTRIP at NIC.SURFNET.NL > Subject: [FIELDTRIP] Statistical comparisons in virtual electrode spectrograms > > Dear all > > Can anyone advise on the following: > > I have 6 sets of virtual electrode data (from CTF based MEG recordings) > from a total of 9 subjects, each of whom carried out 4 conditions of > interest. > > So far, for each virtual electrode I have succeeded (I hope) in computing > group level spectrograms for each condition, where each spectrogram > reflects either evoked or evoked+induced power changes. > > What I would like to do is to a) compare spectrograms, and also b)compute > statistics for each group level spectrogram to ask the question whether > the power changes in the active window (0 - 700ms) are significantly > different from the those in the passive/baseline window (-250 - 0 ms). > > So far I have had alot of help from Jan, and, on his suggestion, I have > copied out my query below, plus provided the matlab scripts which cause > the problem: > > The attached script E_versus_EI.m shows the code for > analysing one condition from one particular virtual electrode. This gives > the evoked as well as the evoked+induced spectrograms (as far as I > understand it). > > To carry out the comaprison between the evoked versus evoked+Induced test, > I thought I should be able to modify the freqgrandaverage step for > generating both iefgranfavg and efgrandavg by setting cfg.keepindividual > to 'yes'. In doing so, I was hoping that this would retain the 9 separate > powerspectra in each case, which it seems to have done. I was then hoping > that this would be sufficient input to the second script test_clusrand.m > (which is just a minor modification of E_versus_EL.m). Certainly the > powspctrm field for each dataset appears as: [4-D double] which I think is > correct. > > However, when I ran clusterrandanalysis on iefgranfavg and efgrandavg, I > got the following errors: > > >> > cfg15 = > > statistic: 'depsamplesT' > alphathresh: 0.0500 > makeclusters: 'yes' > minnbchan: 2 > clusterteststat: 'maxsum' > onetwo: 'twosided' > alpha: 0.0500 > nranddraws: 100 > channel: {'V0'} > > >> %cfg15.latency = [0 0.5] % increases sensitivity if prior temporal > information is knowm > >> cfg15.frequency = [5 40]; > >> > >> %frange = 'all_freqs'; % file addition for saving > >> > >> [clusrand] = clusterrandanalysis (cfg15, ind_efgrandavg, > ind_iefgrandavg); > Selecting and formatting the data. > selected 1 channels > selected 191 time bins > selected 176 frequency bins > Calculating the neighbourhood structure of the channels. > ??? Error using ==> clusterrandanalysis (getneighbgeometry) > Did not find gradiometer or electrode information. > > Error in ==> /home/willis/plc/matlab/clusterrandanalysis.m > On line 473 ==> [cfg,data] = getneighbgeometry(cfg,data,varargin{1}); > > >> > > I noticed also that the way I used freqgrandaverage in order to compile > the two datasets appeared to throw out the gradiometer information. At > least there was a warning to this effect. So, I am guessing that using > freqgrandaverage in this way is incorrect. Therefore please could anyone > suggest how I compile my 2 sets of nine spectrograms in such a way that > they provide appropriate input to clusterrandanalysis. Or, if as Jan seems > to suggest, that clusterrandanalysis can't cope with virtual electrode > data, does anyone have any other clever solutions. > > Please! > > Thanks in anticipation > > Piers C > > > > > > From p.cornelissen at PSYCH.YORK.AC.UK Wed Nov 8 16:42:51 2006 From: p.cornelissen at PSYCH.YORK.AC.UK (Piers Cornelissen) Date: Wed, 8 Nov 2006 15:42:51 +0000 Subject: Statistical comparisons in virtual electrode spectrograms In-Reply-To: <015001c7034a$42919990$6401a8c0@fcdonders.nl> Message-ID: Dear Eric thanks for your thoughts. I would like to try: "a neighbourhood structure as a cell array (in your case, of length 1) of structs". But could you clarify a little more what the syntax would be for this cfg? Re- the hypothesis tests, when I put the script together I hadn't really thought through the hypothesis testing carefully. I was just trying to get something to work at all. But you are quite right, it doesn't make sense to statistically compare E versus E+I However, I do want to apply a test, separately, for E baseline v E active, *and* E+I baseline versus E+I active. Might it make sense, do you think, to compare ([E+I]-E) baseline versus ([E+I]-E) active, to try to work out whether there is indeed any significant induced activity? Best regards Piers > Hi Piers, > > > > In my first reply to your email, I didn't notice that you were analyzing > virtual channels. In that case, the suggestion in my previous email will not > work. As I see it now, you have only a single virtual channel. In other > words, you do not have a spatial dimension in your data. Nevertheless, > clusterrandanalysis wants a spatial neighbourhood structure. In the case of > virtual channels, you have to construct this neighbourhood structure by > hand. Read the help info of clusterrandanalysis, and you will find out how > to specify a neighbourhood structure as a cell array (in your case, of > length 1) of structs. > > I also read that you want to compare evoked and (evoked + induced) power > spectra. Are these power spectra calculated on the same raw data? If this is > the case, does it make sense to test the null hypothesis that they come from > the same probability distribution (which is what clusterrandanalysis tests)? > This null hypothesis would imply that the pure induced power spectra are > zero. Do I see this correctly? > > > Greetings, > > Eric > > > > >> -----Original Message----- >> From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On >> > Behalf Of > >> Piers Cornelissen >> Sent: Wednesday, November 08, 2006 3:19 PM >> To: FIELDTRIP at NIC.SURFNET.NL >> Subject: [FIELDTRIP] Statistical comparisons in virtual electrode >> > spectrograms > >> Dear all >> >> Can anyone advise on the following: >> >> I have 6 sets of virtual electrode data (from CTF based MEG recordings) >> from a total of 9 subjects, each of whom carried out 4 conditions of >> interest. >> >> So far, for each virtual electrode I have succeeded (I hope) in computing >> group level spectrograms for each condition, where each spectrogram >> reflects either evoked or evoked+induced power changes. >> >> What I would like to do is to a) compare spectrograms, and also b)compute >> statistics for each group level spectrogram to ask the question whether >> the power changes in the active window (0 - 700ms) are significantly >> different from the those in the passive/baseline window (-250 - 0 ms). >> >> So far I have had alot of help from Jan, and, on his suggestion, I have >> copied out my query below, plus provided the matlab scripts which cause >> the problem: >> >> The attached script E_versus_EI.m shows the code for >> analysing one condition from one particular virtual electrode. This gives >> the evoked as well as the evoked+induced spectrograms (as far as I >> understand it). >> >> To carry out the comaprison between the evoked versus evoked+Induced test, >> I thought I should be able to modify the freqgrandaverage step for >> generating both iefgranfavg and efgrandavg by setting cfg.keepindividual >> to 'yes'. In doing so, I was hoping that this would retain the 9 separate >> powerspectra in each case, which it seems to have done. I was then hoping >> that this would be sufficient input to the second script test_clusrand.m >> (which is just a minor modification of E_versus_EL.m). Certainly the >> powspctrm field for each dataset appears as: [4-D double] which I think is >> correct. >> >> However, when I ran clusterrandanalysis on iefgranfavg and efgrandavg, I >> got the following errors: >> >> >> cfg15 = >> >> statistic: 'depsamplesT' >> alphathresh: 0.0500 >> makeclusters: 'yes' >> minnbchan: 2 >> clusterteststat: 'maxsum' >> onetwo: 'twosided' >> alpha: 0.0500 >> nranddraws: 100 >> channel: {'V0'} >> >> >>>> %cfg15.latency = [0 0.5] % increases sensitivity if prior temporal >>>> >> information is knowm >> >>>> cfg15.frequency = [5 40]; >>>> >>>> %frange = 'all_freqs'; % file addition for saving >>>> >>>> [clusrand] = clusterrandanalysis (cfg15, ind_efgrandavg, >>>> >> ind_iefgrandavg); >> Selecting and formatting the data. >> selected 1 channels >> selected 191 time bins >> selected 176 frequency bins >> Calculating the neighbourhood structure of the channels. >> ??? Error using ==> clusterrandanalysis (getneighbgeometry) >> Did not find gradiometer or electrode information. >> >> Error in ==> /home/willis/plc/matlab/clusterrandanalysis.m >> On line 473 ==> [cfg,data] = getneighbgeometry(cfg,data,varargin{1}); >> >> >> I noticed also that the way I used freqgrandaverage in order to compile >> the two datasets appeared to throw out the gradiometer information. At >> least there was a warning to this effect. So, I am guessing that using >> freqgrandaverage in this way is incorrect. Therefore please could anyone >> suggest how I compile my 2 sets of nine spectrograms in such a way that >> they provide appropriate input to clusterrandanalysis. Or, if as Jan seems >> to suggest, that clusterrandanalysis can't cope with virtual electrode >> data, does anyone have any other clever solutions. >> >> Please! >> >> Thanks in anticipation >> >> Piers C >> >> >> >> >> >> >> > > > > From maris at NICI.RU.NL Wed Nov 8 16:54:58 2006 From: maris at NICI.RU.NL (Eric Maris) Date: Wed, 8 Nov 2006 16:54:58 +0100 Subject: Statistical comparisons in virtual electrode spectrograms In-Reply-To: <4551FAFB.5070801@psych.york.ac.uk> Message-ID: Hi Piers, > I would like to try: "a neighbourhood structure as a cell array (in your > case, of length 1) of structs". But could you clarify a little more what > the syntax would be for this cfg? Type "Help clusterrandanalysis" on the Matlab command line. > Re- the hypothesis tests, when I put the script together I hadn't really > thought through the hypothesis testing carefully. I was just trying to > get something to work at all. > > But you are quite right, it doesn't make sense to statistically compare > E versus E+I > > However, I do want to apply a test, separately, for E baseline v E > active, *and* E+I baseline versus E+I active. > > Might it make sense, do you think, to compare ([E+I]-E) baseline versus > ([E+I]-E) active, to try to work out whether there is indeed any > significant induced activity? I think this makes sense. For activation-versus-baseline testing, you better use the activation-versus-baseline t-statistic instead of the dependent-samples t-statistic. Greetings, Eric > > Best regards > > Piers > > Hi Piers, > > > > > > > > In my first reply to your email, I didn't notice that you were analyzing > > virtual channels. In that case, the suggestion in my previous email will not > > work. As I see it now, you have only a single virtual channel. In other > > words, you do not have a spatial dimension in your data. Nevertheless, > > clusterrandanalysis wants a spatial neighbourhood structure. In the case of > > virtual channels, you have to construct this neighbourhood structure by > > hand. Read the help info of clusterrandanalysis, and you will find out how > > to specify a neighbourhood structure as a cell array (in your case, of > > length 1) of structs. > > > > I also read that you want to compare evoked and (evoked + induced) power > > spectra. Are these power spectra calculated on the same raw data? If this is > > the case, does it make sense to test the null hypothesis that they come from > > the same probability distribution (which is what clusterrandanalysis tests)? > > This null hypothesis would imply that the pure induced power spectra are > > zero. Do I see this correctly? > > > > > > Greetings, > > > > Eric > > > > > > > > > >> -----Original Message----- > >> From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On > >> > > Behalf Of > > > >> Piers Cornelissen > >> Sent: Wednesday, November 08, 2006 3:19 PM > >> To: FIELDTRIP at NIC.SURFNET.NL > >> Subject: [FIELDTRIP] Statistical comparisons in virtual electrode > >> > > spectrograms > > > >> Dear all > >> > >> Can anyone advise on the following: > >> > >> I have 6 sets of virtual electrode data (from CTF based MEG recordings) > >> from a total of 9 subjects, each of whom carried out 4 conditions of > >> interest. > >> > >> So far, for each virtual electrode I have succeeded (I hope) in computing > >> group level spectrograms for each condition, where each spectrogram > >> reflects either evoked or evoked+induced power changes. > >> > >> What I would like to do is to a) compare spectrograms, and also b)compute > >> statistics for each group level spectrogram to ask the question whether > >> the power changes in the active window (0 - 700ms) are significantly > >> different from the those in the passive/baseline window (-250 - 0 ms). > >> > >> So far I have had alot of help from Jan, and, on his suggestion, I have > >> copied out my query below, plus provided the matlab scripts which cause > >> the problem: > >> > >> The attached script E_versus_EI.m shows the code for > >> analysing one condition from one particular virtual electrode. This gives > >> the evoked as well as the evoked+induced spectrograms (as far as I > >> understand it). > >> > >> To carry out the comaprison between the evoked versus evoked+Induced test, > >> I thought I should be able to modify the freqgrandaverage step for > >> generating both iefgranfavg and efgrandavg by setting cfg.keepindividual > >> to 'yes'. In doing so, I was hoping that this would retain the 9 separate > >> powerspectra in each case, which it seems to have done. I was then hoping > >> that this would be sufficient input to the second script test_clusrand.m > >> (which is just a minor modification of E_versus_EL.m). Certainly the > >> powspctrm field for each dataset appears as: [4-D double] which I think is > >> correct. > >> > >> However, when I ran clusterrandanalysis on iefgranfavg and efgrandavg, I > >> got the following errors: > >> > >> > >> cfg15 = > >> > >> statistic: 'depsamplesT' > >> alphathresh: 0.0500 > >> makeclusters: 'yes' > >> minnbchan: 2 > >> clusterteststat: 'maxsum' > >> onetwo: 'twosided' > >> alpha: 0.0500 > >> nranddraws: 100 > >> channel: {'V0'} > >> > >> > >>>> %cfg15.latency = [0 0.5] % increases sensitivity if prior temporal > >>>> > >> information is knowm > >> > >>>> cfg15.frequency = [5 40]; > >>>> > >>>> %frange = 'all_freqs'; % file addition for saving > >>>> > >>>> [clusrand] = clusterrandanalysis (cfg15, ind_efgrandavg, > >>>> > >> ind_iefgrandavg); > >> Selecting and formatting the data. > >> selected 1 channels > >> selected 191 time bins > >> selected 176 frequency bins > >> Calculating the neighbourhood structure of the channels. > >> ??? Error using ==> clusterrandanalysis (getneighbgeometry) > >> Did not find gradiometer or electrode information. > >> > >> Error in ==> /home/willis/plc/matlab/clusterrandanalysis.m > >> On line 473 ==> [cfg,data] = getneighbgeometry(cfg,data,varargin{1}); > >> > >> > >> I noticed also that the way I used freqgrandaverage in order to compile > >> the two datasets appeared to throw out the gradiometer information. At > >> least there was a warning to this effect. So, I am guessing that using > >> freqgrandaverage in this way is incorrect. Therefore please could anyone > >> suggest how I compile my 2 sets of nine spectrograms in such a way that > >> they provide appropriate input to clusterrandanalysis. Or, if as Jan seems > >> to suggest, that clusterrandanalysis can't cope with virtual electrode > >> data, does anyone have any other clever solutions. > >> > >> Please! > >> > >> Thanks in anticipation > >> > >> Piers C > >> > >> > >> > >> > >> > >> > >> > > > > > > > > From lorina_naci at YAHOO.CO.UK Wed Nov 8 20:00:27 2006 From: lorina_naci at YAHOO.CO.UK (Lorina Naci) Date: Wed, 8 Nov 2006 19:00:27 +0000 Subject: Within-subject coherence statististics for virtual sources In-Reply-To: <004601c6f770$c7297aa0$902dae83@fcdonders.nl> Message-ID: Dear Jan-Mathijs, Thank you for the detailed help in your previous message. >For the time being, I assume that you have your data imported into a fieldtrip-like >format, using besa2fieldtrip. I am not familiar with this function, but when I read the >help of besa2fieldtrip I guess that your besa file was a .tfc file. So probably your >data-object looks like what fieldtrip considers to be a frequency-structure, containing >a TFR for each ROI. I guess you have two data-objects for each subject. One clarification: yes, i do have two data-object (or .tfc files) for each subject, one for each condition, but there are two types of .tfc files that I could use: either the raw time-frequency data for each condition, or the statistically analysed time-frequency data for that condition. BESA saves both of these as .tfc files. At the moment I am using the raw TFR data. I tried to run the script as you suggested but it did not work. The error message I get is to do with [stat] = statistics_wrapper(cfg, varargin{:}). It just gives me an error message pointing to this line,saying: error using fieldtrip-20061003/private/statistics_wrapper, could not determine the type of input data. Also, the function 'cfg.numrandomization' requires a number, but I am not sure what the choice of the number depends on? I've inputed 500 as in the documentation example. Finally, at risk making my ignorance of how Fieldtrip works entirely transparent, I am not quite sure how the function you send me 'statfun_diff.m' links with the 'freqstatistics.m,' and whether I do need to use it? I would greatly appreciate any help with this, Many thanks, Lorina Jan Mathijs Schoffelen wrote: v\:* {behavior:url(#default#VML);} o\:* {behavior:url(#default#VML);} w\:* {behavior:url(#default#VML);} .shape {behavior:url(#default#VML);} st1\:*{behavior:url(#default#ieooui) } Dear Lorina, For the time being, I assume that you have your data imported into a fieldtrip-like format, using besa2fieldtrip. I am not familiar with this function, but when I read the help of besa2fieldtrip I guess that your besa file was a .tfc file. So probably your data-object looks like what fieldtrip considers to be a frequency-structure, containing a TFR for each ROI. I guess you have two data-objects for each subject. What you would like to do is possible within fieldtrip, but I would advise you not to use clusterrandanalysis to get there. Quite some correspondence has been devoted to the new statistical interface, you can read about it on the discussion list’s website (follow the appropriate links on the fieldtrip website), concerning Re: clusterrandanalysis on scalar values + problem with topoplotER during the past month, but which started in August. In a nutshell: instead of using clusterrandanalysis you could use freqstatistics (under the above assumption that your data resembles a fieldtrip-frequency structure) with the appropriate settings to get your statistics done. Freqstatistics relies on statistics_montecarlo, when you specify cfg.method = ‘montecarlo’. Please have a try following the thread on the discussion list, and the following configuration settings, as well as the information in statistics_montecarlo and other dependent functions. You’ll probably need the attached function as well, which computes your statistic of interest. Cfg = []; Cfg.method = ‘montecarlo’; Cfg.statistic = ‘diff’; Cfg.parameter = ‘cohspctrm’; %This is at least what I expect your data objects to contain! Cfg.numrandomization = a number; Cfg.design = [1 1 2 2 3 3 with all the numbers in between 14 14; 1 2 1 2 1 2 with all the numbers in between 1 2]; %this specifies how the data has to be interpreted Cfg.ivar = 2; %row-index of independent variable, which is the condition in your case Cfg.uvar = 1; %row-index of the ‘unit’-variable, your unit of observation, which are your individual subjects. %the design-matrix will be shuffled, by swapping the 1 and 2’s in the ivar-row, while keeping the uvar-doublets together. Cfg.correctm = ‘yes’; %keep it at this for the time being, we have to develop a cunning strategy to incorporate something about the neighbourhood structure of your ROIs %as soon as you get your script running, you can try to incorporate fancy multiple-comparison correction strategies, such as clustering in time and frequency. Stat = freqstatistics(cfg, subj1cond1, subj1cond2, subj2cond1, subj2cond2 .); %take care that this corresponds with how you specified your design. Subjxconx should then be the data-structure containing your TFRs in a field called cohspctrm. I hope this puts you on track, Yours, Jan-Mathijs --------------------------------- From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf Of Lorina Naci Sent: Monday, October 23, 2006 7:18 PM To: FIELDTRIP at NIC.SURFNET.NL Subject: [FIELDTRIP] Within-subject coherence statististics for virtual sources Dear FIELDTRIP members, I have used BESA to perform source coherence calculations for a multiple-subject/multiple-condition experiment. I have 14 subjects, and 2 conditions for which I’d like to compare coherence values. I have calculated coherence values in the Time-Frequency domain for each person. Given that BESA cannot calculate statistics in a multiple-subject study, their support personnel directed me towards FieldTrip. I would like to use your existing script ‘clusterrandanalysis on TFRs of power that were computed with BESA,’ but I cannot relate this to my data as the coherence values have been calculated for ROI sources, (8 per hemisphere - 16 sources total), and not for electrodes (I had 128). Do you have any advice regarding how I may adopt the script to for source coherence as opposed to electrode coherence? How do I import the source locations? Many thanks is advance for your help, Lorina Send instant messages to your online friends http://uk.messenger.yahoo.com --------------------------------- The all-new Yahoo! Mail goes wherever you go - free your email address from your Internet provider. -------------- next part -------------- An HTML attachment was scrubbed... URL: From r.oostenveld at FCDONDERS.RU.NL Wed Nov 8 21:17:53 2006 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Wed, 8 Nov 2006 21:17:53 +0100 Subject: Within-subject coherence statististics for virtual sources In-Reply-To: <20061108190027.45562.qmail@web28110.mail.ukl.yahoo.com> Message-ID: Hi Lorina On 8 Nov 2006, at 20:00, Lorina Naci wrote: > I tried to run the script as you suggested but it did not work. The > error message I get is to do with > [stat] = statistics_wrapper(cfg, varargin{:}). It just gives me an > error message pointing to this line,saying: error using > fieldtrip-20061003/private/statistics_wrapper, could not determine > the type of input data. Then it means that the data structure that you have obtained from besa2fieldtrip is not recognized. It is also not clear to me how your data looks like (i.e. as a Matlab structure). It is virtual channel data, time-frequency analyzed, and then single trial coherences computed? Could you show the output that you get on screen after dataA = besa2fieldtrip('filenameA.tfc') % i.e. without semicolon, to show the output on screen dataB = besa2fieldtrip('filenameB.tfc') % i.e. without semicolon, to show the output on screen > Also, the function 'cfg.numrandomization' requires a number, but I > am not sure what the choice of the number depends on? I've inputed > 500 as in the documentation example. That is the number of resamplings that is used to construct the reference distribution, 500 should be fine. > Finally, at risk making my ignorance of how Fieldtrip works > entirely transparent, I am not quite sure how the function you send > me 'statfun_diff.m' links with the 'freqstatistics.m,' and whether > I do need to use it? You just have to put it on your Matlab path somewhere, and you specify cfg.statistic ='diff' in freqstatistics. In general by specifying cfg.statistic='xxx', the function statfun_xxx will be called. Please look in the function statfun_diff.m to see how the statistic for each sample (=time- frequency-channel point) is computed. best regards, Robert From Brian.Roach at YALE.EDU Wed Nov 8 21:20:10 2006 From: Brian.Roach at YALE.EDU (Brian Roach) Date: Wed, 8 Nov 2006 15:20:10 -0500 Subject: freqanalysis_wltconvol.m question Message-ID: Hi, In the freqanalysis_wltconvol.m function, the FFT of zero-padded eeg or MEG data and the FFT of the wavelets at various frequencies of interest are convolved and the inverse FFT of that result is used to calculate power in this manner on line 283: powdum = (2.* abs(autspctrmacttap) ./ data.fsample) .^ 2; here, autspctrmacttap corresponds to the complex output from the call to ifft. In previous e-mail Jan-Mathijs has mentioned that the abs of the complex data gets you amplitude, so I am wondering why it gets multiplied by 2 and divided by the sampling rate before being squared since power = amplitude^2. I am wondering how important it is to multiply by 2 and divide by the AD rate because I would like to take this complex output and use it to calculate phase-locking factor, but I am not sure what parts of the power transformation need to be removed - just the abs() and the squaring? Clarification of this line of code would be extremely helpful to me. Thanks, Brian -------------- next part -------------- An HTML attachment was scrubbed... URL: From r.oostenveld at FCDONDERS.RU.NL Wed Nov 8 22:56:46 2006 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Wed, 8 Nov 2006 22:56:46 +0100 Subject: freqanalysis_wltconvol.m question In-Reply-To: <6.1.2.0.2.20061108143858.05b15ec0@email.med.yale.edu> Message-ID: Hi Brian On 8 Nov 2006, at 21:20, Brian Roach wrote: > eI would like to take this complex output and use it to calculate > phase-locking factor, but I am not sure what parts of the power > transformation need to be removed - just the abs() and the > squaring? Clarification of this line of code would be extremely > helpful to me. You can use the existing code for that: For computing the phase-locking value I suggest that you use either cfg.output='fourier' cfg.keeptrials='yes' cfg.keeptapers='yes' or cfg.output='fourier' cfg.keeptrials='yes' cfg.keeptapers='no' (not needed now) cfg.channelcmb = something, see the help in freqanalysis. Subsequently, use the option cfg.cohmethod='plv' in freqdescriptives. In case of fourier output in freqanalysis, you should specify the channel combinations here. ... Looking back at your previous mail, I see that you mean ITC and not PLV. The stuff above then does not apply. You can do output=fourier in freqanalysis and work manually on the output freq structure. I think that this should work magnitude = abs(freq.fourierspctrm); scaled = freq.fourierspctrm ./ magnitude; freq.itcspctrm = mean(scaled, 1); freq = rmfield(freq, 'fourierspctrm'); % remove the single fourierspectrum, to avoid confusion freq.dimord = 'chan_freq_time'; % remove the rpt or rpttap dimension best regards, Robert From Brian.Roach at YALE.EDU Wed Nov 8 23:12:49 2006 From: Brian.Roach at YALE.EDU (Brian Roach) Date: Wed, 8 Nov 2006 17:12:49 -0500 Subject: freqanalysis_wltconvol.m question In-Reply-To: <48D89F70-A97D-48F6-800A-2FE2A854C0D9@fcdonders.ru.nl> Message-ID: Robert, Thanks for your quick reply. I did not realize that freqanalysis_wltconvol.m allowed for 'fourier' output, but maybe I need to download the latest version. Or, do you mean I should use freqanalysis_mtm instead? Also, how does ITC differ from phase-locking value? I thought they were the same measure. At 04:56 PM 11/8/2006, you wrote: >Hi Brian > >On 8 Nov 2006, at 21:20, Brian Roach wrote: >>eI would like to take this complex output and use it to calculate >>phase-locking factor, but I am not sure what parts of the power >>transformation need to be removed - just the abs() and the >>squaring? Clarification of this line of code would be extremely >>helpful to me. > >You can use the existing code for that: > >For computing the phase-locking value I suggest that you use either > cfg.output='fourier' > cfg.keeptrials='yes' > cfg.keeptapers='yes' >or > cfg.output='fourier' > cfg.keeptrials='yes' > cfg.keeptapers='no' (not needed now) > cfg.channelcmb = something, see the help >in freqanalysis. > >Subsequently, use the option > cfg.cohmethod='plv' >in freqdescriptives. In case of fourier output in freqanalysis, you >should specify the channel combinations here. > >... >Looking back at your previous mail, I see that you mean ITC and not >PLV. The stuff above then does not apply. You can do output=fourier >in freqanalysis and work manually on the output freq structure. I >think that this should work > >magnitude = abs(freq.fourierspctrm); >scaled = freq.fourierspctrm ./ magnitude; >freq.itcspctrm = mean(scaled, 1); >freq = rmfield(freq, 'fourierspctrm'); % remove the single >fourierspectrum, to avoid confusion >freq.dimord = 'chan_freq_time'; % remove the rpt or rpttap >dimension > >best regards, >Robert > From abastos at BERKELEY.EDU Wed Nov 8 23:11:04 2006 From: abastos at BERKELEY.EDU (Andre Bastos) Date: Wed, 8 Nov 2006 14:11:04 -0800 Subject: another coherence question In-Reply-To: <006a01c70348$bd278180$902dae83@fcdonders.nl> Message-ID: Hello Everyone, So I am trying to do a simple coherence measure between a single electrode pair, PO3 and Cz. It seems like the computations are running, fine, the problem is in trying to use singleplotER to visualize the results, which always fails with the following error: Error using ==> plot, Vectors must be the same lengths. Error in ==> singleplotER at 287 plot(varargin{k-1}.(cfg.xparam), P, style); My cfg structure looks like this: cfg = zparam = 'plvspctrm'; xlim = [5 100]; cohrefchannel = 'Cz'; channel = 'PO3'; The data were first run through the scalpcurrentdensity function using the 'finite' method, then time frequency analysis was compute in frequencies 1-100 using the 'mtmconvol' method with 'powandcsd' output, using the channel = {'PO3' 'PO4' 'Cz'}, with channelcmb set to {'PO3' 'Cz'; 'PO4' 'Cz'}. Then I called freqdescriptives using cohmethod = 'plv'. The returned data structure definetly has coherence data in it, and has a .plvspctrm field which is 2x100x61, channelcmb x freqs x time. Ive looked at the data and it seems to make sense, it has numbers that range from 0 to 0.5, so it seems like the plot function is really whats giving me trouble. Any words of wisdom? Thank You in advance, Andre Bastos Robertson Lab, UC Berkeley From Jan.Schoffelen at FCDONDERS.RU.NL Thu Nov 9 10:10:53 2006 From: Jan.Schoffelen at FCDONDERS.RU.NL (Jan Mathijs Schoffelen) Date: Thu, 9 Nov 2006 10:10:53 +0100 Subject: freqanalysis_wltconvol.m question In-Reply-To: <6.1.2.0.2.20061108143858.05b15ec0@email.med.yale.edu> Message-ID: Hi Brian, The multiplication with 2 and the division by the sampling rate achieves a proper normalization and should be included. The factor 2 is coming from the fact that the power at a specific frequency is estimated at both the frequency itself and its negative counterpart. The division by the number of samples ensures that the total power (summed across all computable frequencies, so between 0 and Nyquist) will be equal to the total variance of the time-domain signal. Yours, Jan-Mathijs _____ From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf Of Brian Roach Sent: Wednesday, November 08, 2006 9:20 PM To: FIELDTRIP at NIC.SURFNET.NL Subject: [FIELDTRIP] freqanalysis_wltconvol.m question Hi, In the freqanalysis_wltconvol.m function, the FFT of zero-padded eeg or MEG data and the FFT of the wavelets at various frequencies of interest are convolved and the inverse FFT of that result is used to calculate power in this manner on line 283: powdum = (2.* abs(autspctrmacttap) ./ data.fsample) .^ 2; here, autspctrmacttap corresponds to the complex output from the call to ifft. In previous e-mail Jan-Mathijs has mentioned that the abs of the complex data gets you amplitude, so I am wondering why it gets multiplied by 2 and divided by the sampling rate before being squared since power = amplitude^2. I am wondering how important it is to multiply by 2 and divide by the AD rate because I would like to take this complex output and use it to calculate phase-locking factor, but I am not sure what parts of the power transformation need to be removed - just the abs() and the squaring? Clarification of this line of code would be extremely helpful to me. Thanks, Brian -------------- next part -------------- An HTML attachment was scrubbed... URL: From Jan.Schoffelen at FCDONDERS.RU.NL Thu Nov 9 10:37:50 2006 From: Jan.Schoffelen at FCDONDERS.RU.NL (Jan Mathijs Schoffelen) Date: Thu, 9 Nov 2006 10:37:50 +0100 Subject: freqanalysis_wltconvol.m question In-Reply-To: <6.1.2.0.2.20061108170420.05a7e2d8@email.med.yale.edu> Message-ID: Dear Brian, Freqanalysis_wltconvol does not support fourier as an output. However, since wavelet-analysis and fft's in the end are about the same thingy, you could use freqanalysis_mtmconvol to achieve your goal. There is a tutorial on the fieldtrip-website which deals with this function, and uses it in a way that it resembles a wavelet-analysis, in which the time-frequency resolution is treated in the same way as with standard wavelet-analysis. Phase-locking-value is defined in fieldtrip as a bivariate-measure, so that means that it quantifies how consistent the phase-relation between two channels is across trials. Inter-trial coherence is a bit an odd thingy, because the term coherence suggests something bivariate, but the way you would like to use it, is essentially univariate. You want to estimate how consistent the phase of the oscillations at a particular channel is across trials. However, both measures use similar math. In fact, when you create a dummy-fourier-channel you can use the plv-option to obtain your 'itc'. This is because in this situation, the mathematics become identical. I would advise it like this: Do your freqanalysis as Robert suggested in one of his previous mails (see below (cfg.keeptapers = 'yes')). Then create a dummy channel: dim = size(freq.fourierspctrm; freq.fourierspctrm(:,end+1,:,:) = ones(dim([1 3 4])); freq.label = 'dummy'; cfg = []; cfg.cohmethod = 'plv'; cfg.channelcmb = channelcombination({'dummy' 'all'}, freq.label); %should work itc = freqdescriptives(cfg, freq); Your 'itc' now is contained in the field itc.cohspctrm; The check whether this is correctly done is done outside fieldtrip: itc2 = abs(mean(freq.fourierspctrm./abs(freq.fourierspctrm),1)); Yours, Jan-Mathijs -----Original Message----- From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf Of Brian Roach Sent: Wednesday, November 08, 2006 11:13 PM To: FIELDTRIP at NIC.SURFNET.NL Subject: Re: [FIELDTRIP] freqanalysis_wltconvol.m question Robert, Thanks for your quick reply. I did not realize that freqanalysis_wltconvol.m allowed for 'fourier' output, but maybe I need to download the latest version. Or, do you mean I should use freqanalysis_mtm instead? Also, how does ITC differ from phase-locking value? I thought they were the same measure. At 04:56 PM 11/8/2006, you wrote: >Hi Brian > >On 8 Nov 2006, at 21:20, Brian Roach wrote: >>eI would like to take this complex output and use it to calculate >>phase-locking factor, but I am not sure what parts of the power >>transformation need to be removed - just the abs() and the >>squaring? Clarification of this line of code would be extremely >>helpful to me. > >You can use the existing code for that: > >For computing the phase-locking value I suggest that you use either > cfg.output='fourier' > cfg.keeptrials='yes' > cfg.keeptapers='yes' >or > cfg.output='fourier' > cfg.keeptrials='yes' > cfg.keeptapers='no' (not needed now) > cfg.channelcmb = something, see the help >in freqanalysis. > >Subsequently, use the option > cfg.cohmethod='plv' >in freqdescriptives. In case of fourier output in freqanalysis, you >should specify the channel combinations here. > >... >Looking back at your previous mail, I see that you mean ITC and not >PLV. The stuff above then does not apply. You can do output=fourier >in freqanalysis and work manually on the output freq structure. I >think that this should work > >magnitude = abs(freq.fourierspctrm); >scaled = freq.fourierspctrm ./ magnitude; >freq.itcspctrm = mean(scaled, 1); >freq = rmfield(freq, 'fourierspctrm'); % remove the single >fourierspectrum, to avoid confusion >freq.dimord = 'chan_freq_time'; % remove the rpt or rpttap >dimension > >best regards, >Robert > From Jan.Schoffelen at FCDONDERS.RU.NL Thu Nov 9 10:41:53 2006 From: Jan.Schoffelen at FCDONDERS.RU.NL (Jan Mathijs Schoffelen) Date: Thu, 9 Nov 2006 10:41:53 +0100 Subject: another coherence question In-Reply-To: <38381.128.32.103.8.1163023864.squirrel@calmail.berkeley.edu> Message-ID: Dear Andre, The xparam, yparam end zparam should be: time, freq, plvspctrm. I guess the time and freq part are taken care of by the default settings. However, your xlim seems to refer to frequencies, true? Try cfg.ylim = [5 100] instead. Yours, Jan-Mathijs -----Original Message----- From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf Of Andre Bastos Sent: Wednesday, November 08, 2006 11:11 PM To: FIELDTRIP at NIC.SURFNET.NL Subject: [FIELDTRIP] another coherence question Hello Everyone, So I am trying to do a simple coherence measure between a single electrode pair, PO3 and Cz. It seems like the computations are running, fine, the problem is in trying to use singleplotER to visualize the results, which always fails with the following error: Error using ==> plot, Vectors must be the same lengths. Error in ==> singleplotER at 287 plot(varargin{k-1}.(cfg.xparam), P, style); My cfg structure looks like this: cfg = zparam = 'plvspctrm'; xlim = [5 100]; cohrefchannel = 'Cz'; channel = 'PO3'; The data were first run through the scalpcurrentdensity function using the 'finite' method, then time frequency analysis was compute in frequencies 1-100 using the 'mtmconvol' method with 'powandcsd' output, using the channel = {'PO3' 'PO4' 'Cz'}, with channelcmb set to {'PO3' 'Cz'; 'PO4' 'Cz'}. Then I called freqdescriptives using cohmethod = 'plv'. The returned data structure definetly has coherence data in it, and has a .plvspctrm field which is 2x100x61, channelcmb x freqs x time. Ive looked at the data and it seems to make sense, it has numbers that range from 0 to 0.5, so it seems like the plot function is really whats giving me trouble. Any words of wisdom? Thank You in advance, Andre Bastos Robertson Lab, UC Berkeley From lorina_naci at YAHOO.CO.UK Fri Nov 10 18:41:24 2006 From: lorina_naci at YAHOO.CO.UK (Lorina Naci) Date: Fri, 10 Nov 2006 17:41:24 +0000 Subject: Within-subject coherence statististics for virtual sources In-Reply-To: Message-ID: Hi Robert, Thank you very much for your help, I was wondering whether I could trouble you with a couple more questions. I converted my besa data to fieldtrip format and this seemed to work fine. I got no error messages and the data structures look like they contain all my data in them (I am attaching an example mat file with the output structures from a few subjects). However, I am still having problems with running freqstatistics. The cfg options are defined OK but the matlab script crushes when it comes to calling statistics_wrapper. The error message I get is as follows: "Could not determine type of input data" which leads me to believe there is a problem with the converted data. I am also attaching my script for freqstatistics in case you need to see this file. Very many thanks for your help, Lorina Robert Oostenveld wrote: Hi Lorina On 8 Nov 2006, at 20:00, Lorina Naci wrote: > I tried to run the script as you suggested but it did not work. The > error message I get is to do with > [stat] = statistics_wrapper(cfg, varargin{:}). It just gives me an > error message pointing to this line,saying: error using > fieldtrip-20061003/private/statistics_wrapper, could not determine > the type of input data. Then it means that the data structure that you have obtained from besa2fieldtrip is not recognized. It is also not clear to me how your data looks like (i.e. as a Matlab structure). It is virtual channel data, time-frequency analyzed, and then single trial coherences computed? Could you show the output that you get on screen after dataA = besa2fieldtrip('filenameA.tfc') % i.e. without semicolon, to show the output on screen dataB = besa2fieldtrip('filenameB.tfc') % i.e. without semicolon, to show the output on screen > Also, the function 'cfg.numrandomization' requires a number, but I > am not sure what the choice of the number depends on? I've inputed > 500 as in the documentation example. That is the number of resamplings that is used to construct the reference distribution, 500 should be fine. > Finally, at risk making my ignorance of how Fieldtrip works > entirely transparent, I am not quite sure how the function you send > me 'statfun_diff.m' links with the 'freqstatistics.m,' and whether > I do need to use it? You just have to put it on your Matlab path somewhere, and you specify cfg.statistic ='diff' in freqstatistics. In general by specifying cfg.statistic='xxx', the function statfun_xxx will be called. Please look in the function statfun_diff.m to see how the statistic for each sample (=time- frequency-channel point) is computed. best regards, Robert Send instant messages to your online friends http://uk.messenger.yahoo.com -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: allsubjects.mat Type: application/octet-stream Size: 769060 bytes Desc: 2990736193-allsubjects.mat URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: freqstatistics_test.m Type: application/octet-stream Size: 3768 bytes Desc: 669505844-freqstatistics_test.m URL: From Jan.Schoffelen at FCDONDERS.RU.NL Fri Nov 10 21:56:21 2006 From: Jan.Schoffelen at FCDONDERS.RU.NL (Jan Mathijs Schoffelen) Date: Fri, 10 Nov 2006 21:56:21 +0100 Subject: Within-subject coherence statististics for virtual sources In-Reply-To: <20061110174125.16585.qmail@web28113.mail.ukl.yahoo.com> Message-ID: Dear Lorina, Even though my name is not Robert, I hope that is OK. I do not really understand why you use freqstatistics_test function the way you do, but this is the way I get it going in your case (so not using the function you sent along: and I think what went wrong is how you configured your input-data): Cfg.method = 'montecarlo'; Cfg.statistic = 'diff'; Cfg.parameter = 'powerspctrm'; %these contain coherences in reality, right? Cfg.numrandomization = something; Cfg.design = dependent on your input data; Cfg.ivar = 1; %put condition in the first row of your desing-matrix Cfg.uvar = 2; %put the subject-index on the second row And now comes the trick, and I guess that's why you tried it the way you did, at least so that you would not run into problems with neighbourselection anymore. For j = 1:length(dataBlabla.label) Cfg.neighbours{j}.label = dataBlabla.label{j}; Cfg.neighbours{j}.neighblabel = {}; End You have virtual channel data, so the neighbourhood-structure is irrelevant for clustering (you don't want to cluster in space, but only in time and frequency perhaps) At least it should run through if you call: Stat = freqstatistics(cfg, dataS1C1, dataS1C2, dataS2C1 etc) Yours, Jan-Mathijs _____ From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf Of Lorina Naci Sent: Friday, November 10, 2006 6:41 PM To: FIELDTRIP at NIC.SURFNET.NL Subject: Re: [FIELDTRIP] Within-subject coherence statististics for virtual sources Hi Robert, Thank you very much for your help, I was wondering whether I could trouble you with a couple more questions. I converted my besa data to fieldtrip format and this seemed to work fine. I got no error messages and the data structures look like they contain all my data in them (I am attaching an example mat file with the output structures from a few subjects). However, I am still having problems with running freqstatistics. The cfg options are defined OK but the matlab script crushes when it comes to calling statistics_wrapper. The error message I get is as follows: "Could not determine type of input data" which leads me to believe there is a problem with the converted data. I am also attaching my script for freqstatistics in case you need to see this file. Very many thanks for your help, Lorina Robert Oostenveld wrote: Hi Lorina On 8 Nov 2006, at 20:00, Lorina Naci wrote: > I tried to run the script as you suggested but it did not work. The > error message I get is to do with > [stat] = statistics_wrapper(cfg, varargin{:}). It just gives me an > error message pointing to this line,saying: error using > fieldtrip-20061003/private/statistics_wrapper, could not determine > the type of input data. Then it means that the data structure that you have obtained from besa2fieldtrip is not recognized. It is also not clear to me how your data looks like (i.e. as a Matlab structure). It is virtual channel data, time-frequency analyzed, and then single trial coherences computed? Could you show the output that you get on screen after dataA = besa2fieldtrip('filenameA.tfc') % i.e. without semicolon, to show the output on screen dataB = besa2fieldtrip('filenameB.tfc') % i.e. without semicolon, to show the output on screen > Also, the function 'cfg.numrandomization' requires a number, but I > am not sure what the choice of the number depends on? I've inputed > 500 as in the documentation example. That is the number of resamplings that is used to construct the reference distribution, 500 should be fine. > Finally, at risk making my ignorance of how Fieldtrip works > entirely transparent, I am not quite sure how the function you send > me 'statfun_diff.m' links with the 'freqstatistics.m,' and whether > I do need to use it? You just have to put it on your Matlab path somewhere, and you specify cfg.statistic ='diff' in freqstatistics. In general by specifying cfg.statistic='xxx', the function statfun_xxx will be called. Please look in the function statfun_diff.m to see how the statistic for each sample (=time- frequency-channel point) is computed. best regards, Robert Send instant messages to your online friends http://uk.messenger.yahoo.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From Jan.Schoffelen at FCDONDERS.RU.NL Fri Nov 10 22:06:51 2006 From: Jan.Schoffelen at FCDONDERS.RU.NL (Jan Mathijs Schoffelen) Date: Fri, 10 Nov 2006 22:06:51 +0100 Subject: Statistical comparisons in virtual electrode spectrograms In-Reply-To: <45548DEA.4000605@psych.york.ac.uk> Message-ID: Dear Piers, As a matter of fact, I have very little hands on experience with the clusterrandanalysis myself, and to be honest I'd prefer to use the new implementation of the statistics-routine, which has the same functionality as the clusterrandanalysis-function, and which was the subject of the last activity on this mailing-list, as well as a thread I pointed you to lately. In any way it is nice to hear that there is progress, and I forward your questions to the mailing list, so that people more experienced in clusterrandanalysis can join the discussion and vent their insights. Yours, Jan-Mathijs -----Original Message----- From: Piers Cornelissen [mailto:p.cornelissen at psych.york.ac.uk] Sent: Friday, November 10, 2006 3:34 PM To: Jan Mathijs Schoffelen Subject: Re: [FIELDTRIP] Statistical comparisons in virtual electrode spectrograms Dear Jan I think I may finally have got somewhere! However, I would be grateful if you or one of the Fieldtrip team could look at the clusrand_test.m script, in which I have tried to compare equal sized baseline with active windows for the group average spectrogram for one virtual electrode. As you can see, I have tried to 'borrow' back a .grad field, which the freqgrandaverage threw away, and then tried to cheat the neighbood problem in clsterrandanalysis by setting minnbchan to zero. At least these manipulations allow clusterrandanalysis to run on the virtual electrode data, and the attached powerpoint file illustrates some plots of what I get. Therefore, the first question is - are these manipulations legitimate, or have I just generated garbage? Secondly, if the output is not garbage, then I would appreciate some pointers at to what the numbers in the fields that I have *ed below actually represent, please >> clusrand clusrand = stats: [196x51 double] * raweffect: [196x51 double] * posclusters: [1x3 struct] * negclusters: [1x2 struct] * posclusterslabelmat: [1x196x51 double] * negclusterslabelmat: [1x196x51 double] * critvals: [-785.1538 785.1538] presumably interpretable when I understand the previous numbers ?* label: {'V0'} freq: [1x196 double] time: [1x51 double] cfg: [1x1 struct] As ever, I deeply appreciate your and the teams support (it is genuinely extraordinary!) Best Piers From maris at NICI.RU.NL Fri Nov 10 22:30:11 2006 From: maris at NICI.RU.NL (Eric Maris) Date: Fri, 10 Nov 2006 22:30:11 +0100 Subject: Statistical comparisons in virtual electrode spectrograms In-Reply-To: <000801c7050c$24569930$902dae83@fcdonders.nl> Message-ID: Hi Piers, > As you can see, I have tried to 'borrow' back a .grad field, which the > freqgrandaverage threw away, and then tried to cheat the neighbood > problem in clsterrandanalysis by setting minnbchan to zero. If you supply a hand-made neighbourhood-structure for your virtual channel(s) then you don't have to borrow back the grad field. > clusrand = > > stats: [196x51 double] * > raweffect: [196x51 double] * > posclusters: [1x3 struct] * If the elements of this array (structs) have value in the pval-field that is less than 0.05, then you have found a significant positive cluster. > negclusters: [1x2 struct] * If the elements of this array (structs) have value in the pval-field that is less than 0.05, then you have found a significant negative cluster.> Have a look at the clusterrandanalysis tutorial to find out how you can plot your significant clusters. Good luck, Eric Maris From Daria.Osipova at FCDONDERS.RU.NL Wed Nov 15 17:31:52 2006 From: Daria.Osipova at FCDONDERS.RU.NL (Daria Osipova) Date: Wed, 15 Nov 2006 17:31:52 +0100 Subject: Beamformer time course In-Reply-To: <78E05DBA-BC4C-469B-A508-5653CF799233@fcdonders.ru.nl> Message-ID: Hi In continuation of this discussion... I would like to use the lcmv method to localize sources of (band-pass filtered) ongoing alpha which I can use as spatial filters for my (unfiltered) data. >>From the previous discussions on lcmv it seems that most people try to estimate covariance matrix from the average since they are doing ERFs. In my case data is not time-locked so I have to estimate it from single trials and not from the average (I would think). But judging from your response, Robert, it seems that cfg.rawtrial = 'yes' (which uses covariance matrix from single trials and applies it to single trials) produces a noisy estimate. Is there a workaround then? Thanks in advance Best regards, Dasha PS I need time-domain data -----Original Message----- From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf Of Robert Oostenveld Sent: Tuesday, May 23, 2006 12:13 PM To: FIELDTRIP at NIC.SURFNET.NL Subject: Re: [FIELDTRIP] Beamformer time course Hi Marie, On 22 May 2006, at 17:18, Marie Smith wrote: > I have been trying out the various methods as discussed and have > come across a problem. > > When I select cfg.singletrials = 'yes' I get a number of error > messages saying > error('this option contains a bug, and is therefore not supported > at the moment'); > > I am using the toolbox fieldtrip-20060516. > > I noticed however, if I select cfg.rawtrials = 'yes' the function > will run. I recall disabling this functionality, since it was rarely used and since I was concerned that it would not be correct. I now had a more detailled look at the code. If you do rawtrial=yes, beamformer uses the single-trial covariance to construct the filter and also applies it to the single trial covariance/csd. That results in a very poorly estimated filter in each trial, hence projecting large amounts of noise and a lot of variance over trials. Therefore we found it not to be very usefull on real data, although conceptually and in the code it is correct. The idea behind singletrial=yes is that beamformer uses the average covariance to construct the filter and applies it to the single trial covariance/csd. The problem in the code however is that beamformer would use the averaged covariance/csd to estimate the power and not the single trial covariance/csd. The estimated single-trial timecourse would be correct, but the power would not be correct. Therefore I disabled that option in the code. The solution is something that you can do yourself in two subsequent runs of sourceanalysis: you can do sourceanalysis on the average (i.e. do not specify any of singletrial/rawtrial options) and specify keepfilter=yes. That will give you the filter, computed on the average covariance. Subsequently do cfg.grid=source2grid(source), and use the resulting grid (including the filters) in the second run of sourceanalysis, in which you specify cfg.rawtrial=yes. In the second run, the previous (based on average covariance) filters will be applied to the unaveraged data, resulting in the desired single-trial power and dipole moment. best regards, Robert From c.hesse at FCDONDERS.RU.NL Wed Nov 15 17:59:02 2006 From: c.hesse at FCDONDERS.RU.NL (Christian Hesse) Date: Wed, 15 Nov 2006 17:59:02 +0100 Subject: Beamformer time course In-Reply-To: <000701c708d3$8e8e4a80$032dae83@fcdonders.nl> Message-ID: Hi Dasha, you could try averaging the single trial covariance matrices (preserving the spatial correlation structure of both time-locked and non-time-locked activity). Then replace the single-trial covariance matrices in your timelock data structure with that average and call lcmv with cfg.rawtrial = 'yes'; However don't expect miracles, because: a) single trial estimates will always be noisy b) if there is significant head-movement between trials, then using the average covaraiance matrix may not do much better than single trial covariance estimates (because you effectively havve moving sources) Hope this helps. Christian On 15 Nov 2006, at 17:31, Daria Osipova wrote: > Hi > > In continuation of this discussion... > > I would like to use the lcmv method to localize sources of (band-pass > filtered) ongoing alpha which I can use as spatial filters for my > (unfiltered) data. > From the previous discussions on lcmv it seems that most people try to > estimate covariance matrix from the average since they are doing ERFs. > In my case data is not time-locked so I have to estimate it from > single > trials and not from the average (I would think). > But judging from your response, Robert, it seems that cfg.rawtrial > = 'yes' > (which uses covariance matrix from single trials and applies it to > single > trials) produces a noisy estimate. > Is there a workaround then? > Thanks in advance > Best regards, > Dasha > PS I need time-domain data > > > > -----Original Message----- > From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] > On Behalf > Of Robert Oostenveld > Sent: Tuesday, May 23, 2006 12:13 PM > To: FIELDTRIP at NIC.SURFNET.NL > Subject: Re: [FIELDTRIP] Beamformer time course > > Hi Marie, > > On 22 May 2006, at 17:18, Marie Smith wrote: >> I have been trying out the various methods as discussed and have >> come across a problem. >> >> When I select cfg.singletrials = 'yes' I get a number of error >> messages saying >> error('this option contains a bug, and is therefore not supported >> at the moment'); >> >> I am using the toolbox fieldtrip-20060516. >> >> I noticed however, if I select cfg.rawtrials = 'yes' the function >> will run. > > I recall disabling this functionality, since it was rarely used and > since I was concerned that it would not be correct. I now had a more > detailled look at the code. > > If you do rawtrial=yes, beamformer uses the single-trial covariance > to construct the filter and also applies it to the single trial > covariance/csd. That results in a very poorly estimated filter in > each trial, hence projecting large amounts of noise and a lot of > variance over trials. Therefore we found it not to be very usefull on > real data, although conceptually and in the code it is correct. > > The idea behind singletrial=yes is that beamformer uses the average > covariance to construct the filter and applies it to the single trial > covariance/csd. The problem in the code however is that beamformer > would use the averaged covariance/csd to estimate the power and not > the single trial covariance/csd. The estimated single-trial > timecourse would be correct, but the power would not be correct. > Therefore I disabled that option in the code. > > The solution is something that you can do yourself in two subsequent > runs of sourceanalysis: you can do sourceanalysis on the average > (i.e. do not specify any of singletrial/rawtrial options) and specify > keepfilter=yes. That will give you the filter, computed on the > average covariance. Subsequently do cfg.grid=source2grid(source), and > use the resulting grid (including the filters) in the second run of > sourceanalysis, in which you specify cfg.rawtrial=yes. In the second > run, the previous (based on average covariance) filters will be > applied to the unaveraged data, resulting in the desired single-trial > power and dipole moment. > > best regards, > Robert > ---------------------------------------------------------------------- Christian Hesse, PhD, MIEEE F.C. Donders Centre for Cognitive Neuroimaging P.O. Box 9101 NL-6500 HB Nijmegen The Netherlands Tel.: +31 (0)24 36 68293 Fax: +31 (0)24 36 10989 Email: c.hesse at fcdonders.ru.nl Web: www.fcdonders.ru.nl ---------------------------------------------------------------------- -------------- next part -------------- An HTML attachment was scrubbed... URL: From c.hesse at FCDONDERS.RU.NL Wed Nov 15 18:07:50 2006 From: c.hesse at FCDONDERS.RU.NL (Christian Hesse) Date: Wed, 15 Nov 2006 18:07:50 +0100 Subject: Beamformer time course In-Reply-To: <6E2E8326-EBD6-4565-9CC7-B58E9FD54F70@fcdonders.ru.nl> Message-ID: Ooops, didn't read all the way through the previous discussion ... source analysis does that anyway, and as Robert points out the power estimate is not correct, either (however, depending on the analysis that need not be a problem). Please disregard my previous comment. Christian On 15 Nov 2006, at 17:59, Christian Hesse wrote: > Hi Dasha, > > you could try averaging the single trial covariance matrices > (preserving the spatial correlation structure of both time-locked > and non-time-locked activity). Then replace the single-trial > covariance matrices in your timelock data structure with that > average and call lcmv with cfg.rawtrial = 'yes'; > > However don't expect miracles, because: > a) single trial estimates will always be noisy > b) if there is significant head-movement between trials, then using > the average covaraiance matrix may not do much better than single > trial covariance estimates (because you effectively havve moving > sources) > > Hope this helps. > Christian > > > > On 15 Nov 2006, at 17:31, Daria Osipova wrote: > >> Hi >> >> In continuation of this discussion... >> >> I would like to use the lcmv method to localize sources of (band-pass >> filtered) ongoing alpha which I can use as spatial filters for my >> (unfiltered) data. >> From the previous discussions on lcmv it seems that most people >> try to >> estimate covariance matrix from the average since they are doing >> ERFs. >> In my case data is not time-locked so I have to estimate it from >> single >> trials and not from the average (I would think). >> But judging from your response, Robert, it seems that cfg.rawtrial >> = 'yes' >> (which uses covariance matrix from single trials and applies it to >> single >> trials) produces a noisy estimate. >> Is there a workaround then? >> Thanks in advance >> Best regards, >> Dasha >> PS I need time-domain data >> >> >> >> -----Original Message----- >> From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] >> On Behalf >> Of Robert Oostenveld >> Sent: Tuesday, May 23, 2006 12:13 PM >> To: FIELDTRIP at NIC.SURFNET.NL >> Subject: Re: [FIELDTRIP] Beamformer time course >> >> Hi Marie, >> >> On 22 May 2006, at 17:18, Marie Smith wrote: >>> I have been trying out the various methods as discussed and have >>> come across a problem. >>> >>> When I select cfg.singletrials = 'yes' I get a number of error >>> messages saying >>> error('this option contains a bug, and is therefore not supported >>> at the moment'); >>> >>> I am using the toolbox fieldtrip-20060516. >>> >>> I noticed however, if I select cfg.rawtrials = 'yes' the function >>> will run. >> >> I recall disabling this functionality, since it was rarely used and >> since I was concerned that it would not be correct. I now had a more >> detailled look at the code. >> >> If you do rawtrial=yes, beamformer uses the single-trial covariance >> to construct the filter and also applies it to the single trial >> covariance/csd. That results in a very poorly estimated filter in >> each trial, hence projecting large amounts of noise and a lot of >> variance over trials. Therefore we found it not to be very usefull on >> real data, although conceptually and in the code it is correct. >> >> The idea behind singletrial=yes is that beamformer uses the average >> covariance to construct the filter and applies it to the single trial >> covariance/csd. The problem in the code however is that beamformer >> would use the averaged covariance/csd to estimate the power and not >> the single trial covariance/csd. The estimated single-trial >> timecourse would be correct, but the power would not be correct. >> Therefore I disabled that option in the code. >> >> The solution is something that you can do yourself in two subsequent >> runs of sourceanalysis: you can do sourceanalysis on the average >> (i.e. do not specify any of singletrial/rawtrial options) and specify >> keepfilter=yes. That will give you the filter, computed on the >> average covariance. Subsequently do cfg.grid=source2grid(source), and >> use the resulting grid (including the filters) in the second run of >> sourceanalysis, in which you specify cfg.rawtrial=yes. In the second >> run, the previous (based on average covariance) filters will be >> applied to the unaveraged data, resulting in the desired single-trial >> power and dipole moment. >> >> best regards, >> Robert >> > > ---------------------------------------------------------------------- > Christian Hesse, PhD, MIEEE > > F.C. Donders Centre for Cognitive Neuroimaging > P.O. Box 9101 > NL-6500 HB Nijmegen > The Netherlands > > Tel.: +31 (0)24 36 68293 > Fax: +31 (0)24 36 10989 > > Email: c.hesse at fcdonders.ru.nl > Web: www.fcdonders.ru.nl > ---------------------------------------------------------------------- > > > > ---------------------------------------------------------------------- Christian Hesse, PhD, MIEEE F.C. Donders Centre for Cognitive Neuroimaging P.O. Box 9101 NL-6500 HB Nijmegen The Netherlands Tel.: +31 (0)24 36 68293 Fax: +31 (0)24 36 10989 Email: c.hesse at fcdonders.ru.nl Web: www.fcdonders.ru.nl ---------------------------------------------------------------------- -------------- next part -------------- An HTML attachment was scrubbed... URL: From anderman at MIT.EDU Wed Nov 15 18:54:39 2006 From: anderman at MIT.EDU (Mark Andermann) Date: Wed, 15 Nov 2006 12:54:39 -0500 Subject: How do you load Neuromag Averaged files into Fieldtrip? Message-ID: Greetings, My name is Mark Andermann, I'm working at the Low Temperature Lab and Lab for Computational Engineering in Helsinki. I'd like to use Fieldtrip to fit dipoles to data acquired on a 306 channel neuromag MEG system. While Fieldtrip offers instructions for loading raw data, I have not found a simple script to load in Neuromag data that's already been averaged in MATLAB, and converted back to an averaged .fif file. Also, can MEG dipole fitting (and time-series estimation) in Fieldtrip be done with a spherical head model in the absence of any subject MRI data? Thank you for your help, Dr. Mark Andermann From lorina_naci at YAHOO.CO.UK Mon Nov 20 19:32:50 2006 From: lorina_naci at YAHOO.CO.UK (Lorina Naci) Date: Mon, 20 Nov 2006 18:32:50 +0000 Subject: Within-subject coherence statististics for virtual sources In-Reply-To: <000301c7050a$ad618610$902dae83@fcdonders.nl> Message-ID: Dear Jan-Mathijs, thanks so much for your message. I am sorry I did not respond any earlier – the message ended up misclassified in my mailbox and I did not notice it. Thank you for sending me the modified script. I’ve defined the cfg.neighbours{j}.label by entering one of my data structures. Also, I’ve loaded all my subjects’ data structures which are saved in the file ‘allsubjects.m’ I ran it but again it crashes, giving the same error pointing to the statistics_wrapper, saying that the input data could not be determined. I am attaching here my scrip and ‘allsubjects.m’ Sorry to keep bothering you with this. Many thanks for your help, Lorina Jan Mathijs Schoffelen wrote: v\:* {behavior:url(#default#VML);} o\:* {behavior:url(#default#VML);} w\:* {behavior:url(#default#VML);} .shape {behavior:url(#default#VML);} st1\:*{behavior:url(#default#ieooui) } Dear Lorina, Even though my name is not Robert, I hope that is OK. I do not really understand why you use freqstatistics_test function the way you do, but this is the way I get it going in your case (so not using the function you sent along: and I think what went wrong is how you configured your input-data): Cfg.method = ‘montecarlo’; Cfg.statistic = ‘diff’; Cfg.parameter = ‘powerspctrm’; %these contain coherences in reality, right? Cfg.numrandomization = something; Cfg.design = dependent on your input data; Cfg.ivar = 1; %put condition in the first row of your desing-matrix Cfg.uvar = 2; %put the subject-index on the second row And now comes the trick, and I guess that’s why you tried it the way you did, at least so that you would not run into problems with neighbourselection anymore. For j = 1:length(dataBlabla.label) Cfg.neighbours{j}.label = dataBlabla.label{j}; Cfg.neighbours{j}.neighblabel = {}; End You have virtual channel data, so the neighbourhood-structure is irrelevant for clustering (you don’t want to cluster in space, but only in time and frequency perhaps) At least it should run through if you call: Stat = freqstatistics(cfg, dataS1C1, dataS1C2, dataS2C1 etc) Yours, Jan-Mathijs --------------------------------- From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf Of Lorina Naci Sent: Friday, November 10, 2006 6:41 PM To: FIELDTRIP at NIC.SURFNET.NL Subject: Re: [FIELDTRIP] Within-subject coherence statististics for virtual sources Hi Robert, Thank you very much for your help, I was wondering whether I could trouble you with a couple more questions. I converted my besa data to fieldtrip format and this seemed to work fine. I got no error messages and the data structures look like they contain all my data in them (I am attaching an example mat file with the output structures from a few subjects). However, I am still having problems with running freqstatistics. The cfg options are defined OK but the matlab script crushes when it comes to calling statistics_wrapper. The error message I get is as follows: "Could not determine type of input data" which leads me to believe there is a problem with the converted data. I am also attaching my script for freqstatistics in case you need to see this file. Very many thanks for your help, Lorina Robert Oostenveld wrote: Hi Lorina On 8 Nov 2006, at 20:00, Lorina Naci wrote: > I tried to run the script as you suggested but it did not work. The > error message I get is to do with > [stat] = statistics_wrapper(cfg, varargin{:}). It just gives me an > error message pointing to this line,saying: error using > fieldtrip-20061003/private/statistics_wrapper, could not determine > the type of input data. Then it means that the data structure that you have obtained from besa2fieldtrip is not recognized. It is also not clear to me how your data looks like (i.e. as a Matlab structure). It is virtual channel data, time-frequency analyzed, and then single trial coherences computed? Could you show the output that you get on screen after dataA = besa2fieldtrip('filenameA.tfc') % i.e. without semicolon, to show the output on screen dataB = besa2fieldtrip('filenameB.tfc') % i.e. without semicolon, to show the output on screen > Also, the function 'cfg.numrandomization' requires a number, but I > am not sure what the choice of the number depends on? I've inputed > 500 as in the documentation example. That is the number of resamplings that is used to construct the reference distribution, 500 should be fine. > Finally, at risk making my ignorance of how Fieldtrip works > entirely transparent, I am not quite sure how the function you send > me 'statfun_diff.m' links with the 'freqstatistics.m,' and whether > I do need to use it? You just have to put it on your Matlab path somewhere, and you specify cfg.statistic ='diff' in freqstatistics. In general by specifying cfg.statistic='xxx', the function statfun_xxx will be called. Please look in the function statfun_diff.m to see how the statistic for each sample (=time- frequency-channel point) is computed. best regards, Robert Send instant messages to your online friends http://uk.messenger.yahoo.com --------------------------------- Inbox full of spam? Get leading spam protection and 1GB storage with All New Yahoo! Mail. -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: allsubjects.mat Type: application/octet-stream Size: 769060 bytes Desc: 2990736193-allsubjects.mat URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: freqstatistics_test.m Type: application/octet-stream Size: 3928 bytes Desc: 669505844-freqstatistics_test.m URL: From Jan.Schoffelen at FCDONDERS.RU.NL Tue Nov 21 08:02:00 2006 From: Jan.Schoffelen at FCDONDERS.RU.NL (Jan Mathijs Schoffelen) Date: Tue, 21 Nov 2006 08:02:00 +0100 Subject: freqanalysis_wltconvol.m question In-Reply-To: <6.1.2.0.2.20061120134916.01cb9ec0@email.med.yale.edu> Message-ID: Dear Brian et al, _____ From: Brian Roach [mailto:Brian.Roach at yale.edu] Sent: Monday, November 20, 2006 11:56 PM To: Jan Mathijs Schoffelen Subject: Re: [FIELDTRIP] freqanalysis_wltconvol.m question Hi, I could not get this posted to the list, and figured since you gave most of the feedback, I would see what you think. thanks, Brian Date: Mon, 13 Nov 2006 12:09:00 -0500 To: FieldTrip discussion list From: Brian Roach Subject: Re: [FIELDTRIP] freqanalysis_wltconvol.m question Bcc: Daniel Mathalon Thanks for the advice, I am wondering if FT users would agree that this is an acceptable way to estimate univariate phase coherence: In freqanalysis_wltconvol.m, line 283: % powdum = (2.* abs(autspctrmacttap) ./ data.fsample) .^ 2; powdum = (2.*autspctrmacttap ./ data.fsample); 1. I've commented out the power line and inserted basically the same thing (but not squared) 2. As suggested, I change cfg.keeptrials = 'yes'; 3. After running freqanalysis.m, in the command prompt: itc = abs(mean(squeeze(freq.powspctrm)./abs(squeeze(freq.powspctrm)),1)) squeeze is used because freq.powspctrm is a 3 d matrix including sites, times, and frequencies and in the above case I am just getting itc from 1 channel. Does this method seem alright? Regarding step #1 above, it seemed to make no difference whether I left the 2.* in that equation or not, which seems consistent with an earlier e-mail that mentioned this multiplication being tied into power, so it does not influence phase angle. Is that right? Or, should it be taken out for my purposes? thanks, Brian This looks fine to me. Indeed the factor of 2 does not affect the outcome, because it falls out in the division (normalization) step. Yours, Jan-Mathijs PS: you might have to think about whether or not to square the final itc, to make it consistent with the way it is defined in the literature. At 04:37 AM 11/9/2006, you wrote: Dear Brian, Freqanalysis_wltconvol does not support fourier as an output. However, since wavelet-analysis and fft's in the end are about the same thingy, you could use freqanalysis_mtmconvol to achieve your goal. There is a tutorial on the fieldtrip-website which deals with this function, and uses it in a way that it resembles a wavelet-analysis, in which the time-frequency resolution is treated in the same way as with standard wavelet-analysis. Phase-locking-value is defined in fieldtrip as a bivariate-measure, so that means that it quantifies how consistent the phase-relation between two channels is across trials. Inter-trial coherence is a bit an odd thingy, because the term coherence suggests something bivariate, but the way you would like to use it, is essentially univariate. You want to estimate how consistent the phase of the oscillations at a particular channel is across trials. However, both measures use similar math. In fact, when you create a dummy-fourier-channel you can use the plv-option to obtain your 'itc'. This is because in this situation, the mathematics become identical. I would advise it like this: Do your freqanalysis as Robert suggested in one of his previous mails (see below (cfg.keeptapers = 'yes')). Then create a dummy channel: dim = size(freq.fourierspctrm; freq.fourierspctrm(:,end+1,:,:) = ones(dim([1 3 4])); freq.label = 'dummy'; cfg = []; cfg.cohmethod = 'plv'; cfg.channelcmb = channelcombination({'dummy' 'all'}, freq.label); %should work itc = freqdescriptives(cfg, freq); Your 'itc' now is contained in the field itc.cohspctrm; The check whether this is correctly done is done outside fieldtrip: itc2 = abs(mean(freq.fourierspctrm./abs(freq.fourierspctrm),1)); Yours, Jan-Mathijs -----Original Message----- From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf Of Brian Roach Sent: Wednesday, November 08, 2006 11:13 PM To: FIELDTRIP at NIC.SURFNET.NL Subject: Re: [FIELDTRIP] freqanalysis_wltconvol.m question Robert, Thanks for your quick reply. I did not realize that freqanalysis_wltconvol.m allowed for 'fourier' output, but maybe I need to download the latest version. Or, do you mean I should use freqanalysis_mtm instead? Also, how does ITC differ from phase-locking value? I thought they were the same measure. At 04:56 PM 11/8/2006, you wrote: >Hi Brian > >On 8 Nov 2006, at 21:20, Brian Roach wrote: >>eI would like to take this complex output and use it to calculate >>phase-locking factor, but I am not sure what parts of the power >>transformation need to be removed - just the abs() and the >>squaring? Clarification of this line of code would be extremely >>helpful to me. > >You can use the existing code for that: > >For computing the phase-locking value I suggest that you use either > cfg.output='fourier' > cfg.keeptrials='yes' > cfg.keeptapers='yes' >or > cfg.output='fourier' > cfg.keeptrials='yes' > cfg.keeptapers='no' (not needed now) > cfg.channelcmb = something, see the help >in freqanalysis. > >Subsequently, use the option > cfg.cohmethod='plv' >in freqdescriptives. In case of fourier output in freqanalysis, you >should specify the channel combinations here. > >... >Looking back at your previous mail, I see that you mean ITC and not >PLV. The stuff above then does not apply. You can do output=fourier >in freqanalysis and work manually on the output freq structure. I >think that this should work > >magnitude = abs(freq.fourierspctrm); >scaled = freq.fourierspctrm ./ magnitude; >freq.itcspctrm = mean(scaled, 1); >freq = rmfield(freq, 'fourierspctrm'); % remove the single >fourierspectrum, to avoid confusion >freq.dimord = 'chan_freq_time'; % remove the rpt or rpttap >dimension > >best regards, >Robert > -------------- next part -------------- An HTML attachment was scrubbed... URL: From r.oostenveld at FCDONDERS.RU.NL Tue Nov 21 09:42:02 2006 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Tue, 21 Nov 2006 09:42:02 +0100 Subject: How do you load Neuromag Averaged files into Fieldtrip? In-Reply-To: Message-ID: Dear Mark On 16 Nov 2006, at 1:54, Mark Andermann wrote: > I'd like to use Fieldtrip to fit dipoles to data acquired on a 306 > channel neuromag MEG system. While Fieldtrip offers instructions > for loading raw data, I have not found a simple script to load in > Neuromag data that's already been averaged in MATLAB, and converted > back to an averaged .fif file. Fieldtrip usually reads the data from disk itself, since the data is accopanied with auxiliary information (e.g. events and channel locations). So there is no default option to read in data from a matlab file, or from a matlab variable. The fif reading functions are nott included by default in fieldtrip (since they are closed source), but if you have the meg_pd toolbox on your matlab path then fieldtrip will detect that and use those functions (seee http://www2.ru.nl/fcdonders/fieldtrip/doku.php? id=fieldtrip:documentation:dataformats). The only issue with Neuromag data that I am aware about is that the stimulus channel is noisy, and hence the event detection might not be flawless. The alternative is to take the variables that you already have in your matlab session and convert them (manually) into a data structure taht is compatible with fieldtrip. You can find instructions on how to do that in the frequently asked questions list (see http:// www2.ru.nl/fcdonders/fieldtrip/doku.php? id=fieldtrip:documentation:frequently_asked_questions#how_can_i_import_m y_own_dataformat). > Also, can MEG dipole fitting (and time-series estimation) in > Fieldtrip be done with a spherical head model in the absence of any > subject MRI data? Yes, but then you have to define the spherical head model yourself. For the DIPOLEFITTING function you would specify cfg.vol.r = radius, single number cfg.vol.o = origin, [x y z] Both these values should be expressed in the same units (e.g. meters, centimeters or milimeters) as the channel locations. At the moment I do not recall what the default units are for Neuromag, but you can have a look at the "grad.pnt" field (i.e. the position of all the gradiometer coils) and you will probably easily recognize the units. best regards, Robert From jedmeltzer at YAHOO.COM Wed Nov 22 19:34:21 2006 From: jedmeltzer at YAHOO.COM (Jed Meltzer) Date: Wed, 22 Nov 2006 19:34:21 +0100 Subject: matlab crashes upon running fieldtrip - glibc error Message-ID: Hi, I am just trying to get fieldtrip running on my computer, which is brand new along with my matlab installation. I am trying to run the code in the first tutorial. The computer is a fancy 64-bit dual- xeon workstation, with RHEL 4.0, EM64T processors, and the newest Matlab 7.3 (R2006b). Here is some info about the system that might be relevant: uname -a Linux gemara.nidcd.nih.gov 2.6.9-42.ELsmp #1 SMP Wed Jul 12 23:32:02 EDT 2006 x86_64 x86_64 x86_64 GNU/Linux rpm -q glibc glibc-2.3.4-2.25 glibc-2.3.4-2.25 Now my problem: as soon as I run this line in the tutorial: dataFIC = preprocessing(cfg); matlab crashes and I get the following error message in the shell: *** glibc detected *** free(): invalid pointer: 0x0000002af5fd5dd0 *** Abort Any ideas about how to fix this? Thanks! -Jed Meltzer From jedmeltzer at YAHOO.COM Wed Nov 22 22:16:00 2006 From: jedmeltzer at YAHOO.COM (Jed Meltzer) Date: Wed, 22 Nov 2006 22:16:00 +0100 Subject: matlab crashes upon running fieldtrip - glibc error Message-ID: Just some further details here about my problem - I used the matlab debugger to try to find where preprocessing.m was crashing, and found that it was in the calling of "progress.m" If I comment out that call, the function works. Of course, I don't want to have to do that on every single field trip function that calls progress.m. Upon examining the code for progress.m, I see that there is this little workaround "to prevent matlab 2006b (7.3) from crashing" So I guess I am reporting that the workaround does not work! I have matlab 7.3 and it crashes anyway. However if I just type "feature accel off" at the beginning of my matlab session it works ok. I don't know why, but in the meantime this is working. Maybe you can fix this in the future? Thanks. -Jed From ali.mazaheri at FCDONDERS.RU.NL Thu Nov 23 14:39:52 2006 From: ali.mazaheri at FCDONDERS.RU.NL (Ali Mazaheri) Date: Thu, 23 Nov 2006 14:39:52 +0100 Subject: 64 bit.. detrending... Message-ID: Dear fieldtrippers... I've noticed that when I run some scripts on my pc I get quite diffrent results than when I run them on the 64 bit linux clusters. I initially thought perhaps it had to do with the matlab version.. and specifically the detrend function and specific toolboxes.. but that does not appear to be case since puting the toolboxes of matlab 7.0.1 (the matlab on my pc) on the path of the matlab7.1.0 ( the one on the 64 bit clusters) still gives different results. If any one has experience with this.. or suggestions please let me know..... bests ali From jeremiemattout at YAHOO.FR Thu Nov 23 17:06:40 2006 From: jeremiemattout at YAHOO.FR (Jeremie MATTOUT) Date: Thu, 23 Nov 2006 16:06:40 +0000 Subject: reading .sdq format Message-ID: Dear Fieldtrip users and developers, I need to read Yokogawa MEG data (*.sdq files). I saw on the fieldtrip web site that some functions should be available from the fieldtrip FTP server. However I have not been able to download them. Any help would be most welcome. To be a bit more precise, I am looking for a filter that would import those data format directly into Matlab or, alternatively, that would enable me to produce binary (.bin) files that I should then be able to convert into Matlab. Many Thanks, Jeremie Mattout INSERM U562 Service Hospitalier Frédéric Joliot CEA 4 pl. du Général Leclerc Orsay, F91401 FRANCE ___________________________________________________________________________ Découvrez une nouvelle façon d'obtenir des réponses à toutes vos questions ! Profitez des connaissances, des opinions et des expériences des internautes sur Yahoo! Questions/Réponses http://fr.answers.yahoo.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From r.oostenveld at FCDONDERS.RU.NL Mon Nov 27 15:38:32 2006 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Mon, 27 Nov 2006 15:38:32 +0100 Subject: reading .sdq format In-Reply-To: <20061123160640.62770.qmail@web26009.mail.ukl.yahoo.com> Message-ID: Dear Jeremie On 23 Nov 2006, at 17:06, Jeremie MATTOUT wrote: > I need to read Yokogawa MEG data (*.sdq files). > > I saw on the fieldtrip web site that some functions should be > available from the fieldtrip FTP server. > However I have not been able to download them. Any help would be > most welcome. The documentatino and a link to the ftp server is given here http:// www2.ru.nl/fcdonders/fieldtrip/doku.php? id=fieldtrip:documentation:dataformats#support_for_yokogawa_meg_data > To be a bit more precise, I am looking for a filter that would > import those data format directly into Matlab or, alternatively, > that would enable me to produce binary (.bin) files that I should > then be able to convert into Matlab. I suggest that you download the fileio module and use the Matlab interface described here http://www2.ru.nl/fcdonders/fieldtrip/ doku.php?id=fieldtrip:development:fileio That requires that you drop the yokogawa specific functions in the "private" directory. best regards, Robert From r.oostenveld at FCDONDERS.RU.NL Mon Nov 27 15:46:23 2006 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Mon, 27 Nov 2006 15:46:23 +0100 Subject: matlab crashes upon running fieldtrip - glibc error In-Reply-To: Message-ID: Hi Jed, On 22 Nov 2006, at 22:16, Jed Meltzer wrote: > Just some further details here about my problem - > > I used the matlab debugger to try to find where preprocessing.m was > crashing, and found that it was > in the calling of "progress.m" > ... > So I guess I am reporting that the workaround does not work! I > have matlab 7.3 and it crashes > anyway. Yes, that is also what I have observed. I have contacted Mathworks with this, and they confirmed that that is a bug in Matlab 7.3. It has something to do with acceleration and persistent variables. It turns out that "feature accel off" should be given prior to calling the "progress" function, so therefore it does not work when included in the progress function itself. > However if I just type "feature accel off" at the beginning of my > matlab session it works ok. I don't > know why, but in the meantime this is working. > Maybe you can fix this in the future? Thanks. I have no idea how to fix this myself, I hope that Mathworks will fix it in the next Matlab version. I suggest that you include the "feature accel off" in yur matlab startup.m file. E.g. this is what I have in my ~/matlab/startup.m if strcmp(getfield(ver('MATLAB'), 'Version'), '7.3') feature accel off end best regards Robert From r.oostenveld at FCDONDERS.RU.NL Mon Nov 27 16:37:17 2006 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Mon, 27 Nov 2006 16:37:17 +0100 Subject: Within-subject coherence statististics for virtual sources In-Reply-To: <20061120183250.77617.qmail@web28104.mail.ukl.yahoo.com> Message-ID: Hi Lornia, On 20 Nov 2006, at 19:32, Lorina Naci wrote: > Thank you for sending me the modified script. I’ve defined the > cfg.neighbours{j}.label by entering one of my data structures. > Also, I’ve loaded all my subjects’ data structures which are saved > in the file ‘allsubjects.m’ > > I ran it but again it crashes, giving the same error pointing to > the statistics_wrapper, saying that the input data could not be > determined. I am attaching here my scrip and ‘allsubjects.m’ > Sorry to keep bothering you with this. I found one small bug in your attached script for j = 1:length(data1257Vis.label); cfg.neighbours{j}.label = data1257Vis.label{j}; cgf.neighbours{j}.neighblabel = {}; <========== TYPO cgf->cfg end Furthermore, I do not understand why your attached script is a mixture of fieldtrip code and your own code. You should put your own code in a script (which does NOT start with "function"), and call that script from the command line. The script should call the freqstatistics function. If I do the following using your data, it seems to work for me. best regards, Robert %-------------------- script starts here -------------------- load allsubjects cfg = []; cfg.method = 'montecarlo'; cfg.statistic = 'diff'; % cfg.parameter = 'cohspctrm'; <==== it will always use powspctrm, regardless of this parameter cfg.numrandomization = 500; cfg.design = [1 1 2 2 3 3 4 4 5 5 6 6; 1 2 1 2 1 2 1 2 1 2 1 2]; cfg.ivar = 2; cfg.uvar = 1; cfg.correctm = 'yes'; for j = 1:length(data1257Vis.label); cfg.neighbours{j}.label = data1257Vis.label{j}; cfg.neighbours{j}.neighblabel = {}; end stat = freqstatistics(cfg, data1257XM, data1257Vis, data1299XM, data1299Vis, data349XM, data349Vis, data449XM, data449Vis, data732XM, data732Vis, data868XM, data868Vis); From ali.mazaheri at FCDONDERS.RU.NL Tue Nov 28 13:55:05 2006 From: ali.mazaheri at FCDONDERS.RU.NL (Ali Mazaheri) Date: Tue, 28 Nov 2006 13:55:05 +0100 Subject: operations on single precision numbers unstable in matlab 7.1 (64bit ) vesions and higher In-Reply-To: <20061123160640.62770.qmail@web26009.mail.ukl.yahoo.com> Message-ID: Dear all, The long subject captions says it all. I just recently discovered that solutions to the low level functions in matlab7.1 and higher run on a 64 bit platform become unstable when using single precision. This problem does not appear to be present on matlabs running on a 32 bit platform. . A simple example of this problem is as follows a=[1 2] b=[1 2]; >> a/b ans = 1 NOW in single precision a=single(a); b=single(b); >> a/b ans = 1.9074 e-05 the problem of course become much more compounded when doing more higher level functions such as detrend. I am completely unable to do a linear detrend on single precious data. regards Ali From Jan.Schoffelen at FCDONDERS.RU.NL Tue Nov 28 14:12:28 2006 From: Jan.Schoffelen at FCDONDERS.RU.NL (Jan Mathijs Schoffelen) Date: Tue, 28 Nov 2006 14:12:28 +0100 Subject: operations on single precision numbers unstable in matlab 7.1 (64bit ) vesions and higher In-Reply-To: <456C31A9.9080300@fcdonders.ru.nl> Message-ID: Dear Ali, What about temporarily converting your data into double precision, and doing your stuff? data = struct2double(data); DO YOUR STUFF HERE data = struct2single(data); Yours, JM -----Original Message----- From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf Of Ali Mazaheri Sent: Tuesday, November 28, 2006 1:55 PM To: FIELDTRIP at NIC.SURFNET.NL Subject: [FIELDTRIP] operations on single precision numbers unstable in matlab 7.1 (64bit ) vesions and higher Dear all, The long subject captions says it all. I just recently discovered that solutions to the low level functions in matlab7.1 and higher run on a 64 bit platform become unstable when using single precision. This problem does not appear to be present on matlabs running on a 32 bit platform. . A simple example of this problem is as follows a=[1 2] b=[1 2]; >> a/b ans = 1 NOW in single precision a=single(a); b=single(b); >> a/b ans = 1.9074 e-05 the problem of course become much more compounded when doing more higher level functions such as detrend. I am completely unable to do a linear detrend on single precious data. regards Ali From r.oostenveld at FCDONDERS.RU.NL Tue Nov 28 16:47:03 2006 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Tue, 28 Nov 2006 16:47:03 +0100 Subject: operations on single precision numbers unstable in matlab 7.1 (64bit ) vesions and higher In-Reply-To: <456C31A9.9080300@fcdonders.ru.nl> Message-ID: Dear all, Ali quite convincingly demonstrated this bug in Matlab. Sofar, we have only seen it on the 64 bit linux machines running 64 bit matlab, which means all the nodes in the FCDC mentat cluster. Desktop PCs running a 32 bit version of Windows+matlab are not affected. Also 32 bit linux machines (e.g. loke and odin in the FCDC) are unaffected. I don't know about 64 bit Mac OS X versions, but the 32 bit Mac OS X does not have a problem either. We are not yet running 64 bit Windows at the FCDC, so we do not have experience with those yet. Regarding fieldtrip: if you want to use single precision (to save memory/quota), I suggest that you only store the data on disk in single precision, and that you do struct2double (as JM suggested) as soon as you read the data from disk. I will contact Mathworks about this serious bug. best regards Robert On 28 Nov 2006, at 13:55, Ali Mazaheri wrote: > Dear all, > The long subject captions says it all. > I just recently discovered that solutions to the low level > functions in matlab7.1 and higher run on a 64 bit platform become > unstable when using single precision. > This problem does not appear to be present on matlabs running on a > 32 bit platform. > > . > A simple example of this problem is as follows > > a=[1 2] > b=[1 2]; > > >> a/b > ans = 1 > > NOW in single precision > > a=single(a); > b=single(b); > >> a/b > ans = 1.9074 e-05 > > > the problem of course become much more compounded when doing more > higher level functions such as detrend. I am completely unable to > do a linear detrend on > single precious data. > > > regards > Ali > From sdim14hg at T2.TECHNION.AC.IL Tue Nov 28 20:05:50 2006 From: sdim14hg at T2.TECHNION.AC.IL (Hanukaev Dmitri) Date: Tue, 28 Nov 2006 20:05:50 +0100 Subject: sourcestatistics_randcluster Message-ID: Hello We want to perform a T-dependent statistics test and to find the time- space clusters. The data has two condition and N replication (12 patient) and was acquired using the Loreta software. We used the loreta2fieldtrip.m function convert it to a fieldtrip structure. Now after the conversion we want to perform the test but we aren't sure which sourcestatistics function to use. We think that we need to use the sourcestatistics_randcluster function but don’t sure how to arrange the data and how to perform it on all the replications. sincerely From litvak at TX.TECHNION.AC.IL Tue Nov 28 20:33:02 2006 From: litvak at TX.TECHNION.AC.IL (Vladimir Litvak) Date: Tue, 28 Nov 2006 19:33:02 -0000 Subject: Some issues in freqanalysis Message-ID: Dear Robert and all, I'm writing a new script for analysis of MEG data and I encountered some problems with FT (I'm using 20061029 version): 1) In freqdescriptives the lines 494 and 515 seem to be redundant and also don't work and cause a crash. 2) there are some missing functions: inputlabel2outputlabel called by freqdescriptives, line 234 fourier2crsspctrm called by freqdescriptives, line 290 Can you please explain to me what cfg.combinechan in freqdescriptives does (I'm new to MEG which might explain my ignorance)? Finally, I would like to compute coherence from data of a single subject with 300 trials and check whether it is significant (i.e. not random). I don't think I can use any of the nonparametric stuff because I don't have a baseline. It seems to me that I should use the jackknife SEMs. How exactly? Should I use the bias correction? Should I take 2*SEM as the threshold? Thanks, Vladimir -------------- next part -------------- An HTML attachment was scrubbed... URL: From Jan.Schoffelen at FCDONDERS.RU.NL Tue Nov 28 23:24:19 2006 From: Jan.Schoffelen at FCDONDERS.RU.NL (Jan Mathijs Schoffelen) Date: Tue, 28 Nov 2006 23:24:19 +0100 Subject: Some issues in freqanalysis In-Reply-To: <009301c71324$055adde0$f0463ec1@sobell.ion.ucl.ac.uk> Message-ID: Dear Vladimir, Regarding the missing functions: you are absolutely right. The functions will be added to the latest release. Regarding the crash: I don't know what is happening there, and I do not have any experience with the option biascorrect. You'll have to ask Eric about this. Does it still crash when you use cfg.biascorrect = 'no'? This might already solve your problem. cfg.combinechan is a rather obscure option (and is set to 'no' by default) in freqdescriptives which is (as far as I know) undocumented. It has to do with combining planar gradiometer representation back into an axial gradiometer representation in order to be able to compute coherence between sensor-combinations (in their original axial representation). As a matter of fact, it is an option which has a high 'don't try this at home'-content. At least a correct behavior is not guaranteed. Anyhow, it should run through even when it is not specified. If you want to test coherence against 0, the jack-knife estimate of the variance is not going to help you too much. Rather, you could use some kind of Z-transformation as proposed by Jarvis & Mitra Neural computation 2001, or the Z-transformation that is described in James Kilner's papers, or from the Rosenberg group. In this context, the coherence can be parametrically evaluated. Another possibility is using a 'shiftpredictor' to estimate the bias, meaning that you shuffle the trial order of one of the two channels in your channel-combination (only works when taking fourier as an output of freqanalysis). In my experience this only works if you use an external reference signal, such as the EMG. Hope this gives some handles, Jan-Mathijs _____ From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf Of Vladimir Litvak Sent: Tuesday, November 28, 2006 8:33 PM To: FIELDTRIP at NIC.SURFNET.NL Subject: [FIELDTRIP] Some issues in freqanalysis Dear Robert and all, I'm writing a new script for analysis of MEG data and I encountered some problems with FT (I'm using 20061029 version): 1) In freqdescriptives the lines 494 and 515 seem to be redundant and also don't work and cause a crash. 2) there are some missing functions: inputlabel2outputlabel called by freqdescriptives, line 234 fourier2crsspctrm called by freqdescriptives, line 290 Can you please explain to me what cfg.combinechan in freqdescriptives does (I'm new to MEG which might explain my ignorance)? Finally, I would like to compute coherence from data of a single subject with 300 trials and check whether it is significant (i.e. not random). I don't think I can use any of the nonparametric stuff because I don't have a baseline. It seems to me that I should use the jackknife SEMs. How exactly? Should I use the bias correction? Should I take 2*SEM as the threshold? Thanks, Vladimir -------------- next part -------------- An HTML attachment was scrubbed... URL: From r.oostenveld at FCDONDERS.RU.NL Wed Nov 29 09:08:47 2006 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Wed, 29 Nov 2006 09:08:47 +0100 Subject: sourcestatistics_randcluster In-Reply-To: Message-ID: On 28 Nov 2006, at 20:05, Hanukaev Dmitri wrote: > We want to perform a T-dependent statistics test and to find the time- > space clusters. > The data has two condition and N replication (12 patient) and was > acquired using the Loreta software. We used the loreta2fieldtrip.m > function convert it to a fieldtrip structure. > Now after the conversion we want to perform the test but we aren't > sure > which sourcestatistics function to use. For statistical testing with space-time clusters, you have to use a non-parametric randomization test. The single sample (voxel/ timepoint) statistic can be a dependent-T value, which then will be clustered over neighbouring voxels and timepoints. So you should use sourcestatistics itself, with cfg.method=montecarlo and cfg.correctm=cluster. The functions sourcestatistics_randomization and sourcestatistics_randcluster are implemented to test a hypothesis for single subject source reconstructions in which the data was randomized between two conditions prior to computing the source reconstruction. In your case, you want to randomize between conditions over subjects so these functions do not apply. Note that 4D clustering (x,y,z,time) is rather experimental, and I am not sure whether the bookkeeping aspects of the code will work smoothly. Please read the help of sourcestatistics and of statistics_montecarlo. Keep us posted on whether it works, and please do report it if you encounter problems. I suggest that you use the feature "dbstop if error" in Matlab together with the matlab debugger. best regards, Robert From maris at NICI.RU.NL Wed Nov 29 11:13:00 2006 From: maris at NICI.RU.NL (Eric Maris) Date: Wed, 29 Nov 2006 11:13:00 +0100 Subject: Some issues in freqanalysis In-Reply-To: <009301c71324$055adde0$f0463ec1@sobell.ion.ucl.ac.uk> Message-ID: Dear Vladimir, 1) In freqdescriptives the lines 494 and 515 seem to be redundant and also don't work and cause a crash. This is a stupid bug due to an erroneous copy-paste. It is corrected now. I would always set the biascorrect-option to 'yes' because it produces less biased coherence estimates. However, in practice it only makes a substantial difference if the number of trials is small. Try it out for yourself. Greetings, Eric -------------- next part -------------- An HTML attachment was scrubbed... URL: From litvak at TX.TECHNION.AC.IL Wed Nov 29 11:33:51 2006 From: litvak at TX.TECHNION.AC.IL (Vladimir Litvak) Date: Wed, 29 Nov 2006 10:33:51 -0000 Subject: Some issues in freqanalysis In-Reply-To: <010d01c7133b$f2c6c6e0$902dae83@fcdonders.nl> Message-ID: Dear Eric and Jan-Mathijs, My reference channel is indeed EMG. I thought about this trial shuffling idea myself over night. It can actually be combined with clustering in channel/frequency space. Is there a way to do it with the current version of statistics routines or should it be programmed by hand? Thanks, Vladimir _____ From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf Of Jan Mathijs Schoffelen Sent: Tuesday, November 28, 2006 10:24 PM To: FIELDTRIP at NIC.SURFNET.NL Subject: Re: [FIELDTRIP] Some issues in freqanalysis Dear Vladimir, Regarding the missing functions: you are absolutely right. The functions will be added to the latest release. Regarding the crash: I don't know what is happening there, and I do not have any experience with the option biascorrect. You'll have to ask Eric about this. Does it still crash when you use cfg.biascorrect = 'no'? This might already solve your problem. cfg.combinechan is a rather obscure option (and is set to 'no' by default) in freqdescriptives which is (as far as I know) undocumented. It has to do with combining planar gradiometer representation back into an axial gradiometer representation in order to be able to compute coherence between sensor-combinations (in their original axial representation). As a matter of fact, it is an option which has a high 'don't try this at home'-content. At least a correct behavior is not guaranteed. Anyhow, it should run through even when it is not specified. If you want to test coherence against 0, the jack-knife estimate of the variance is not going to help you too much. Rather, you could use some kind of Z-transformation as proposed by Jarvis & Mitra Neural computation 2001, or the Z-transformation that is described in James Kilner's papers, or from the Rosenberg group. In this context, the coherence can be parametrically evaluated. Another possibility is using a 'shiftpredictor' to estimate the bias, meaning that you shuffle the trial order of one of the two channels in your channel-combination (only works when taking fourier as an output of freqanalysis). In my experience this only works if you use an external reference signal, such as the EMG. Hope this gives some handles, Jan-Mathijs _____ From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf Of Vladimir Litvak Sent: Tuesday, November 28, 2006 8:33 PM To: FIELDTRIP at NIC.SURFNET.NL Subject: [FIELDTRIP] Some issues in freqanalysis Dear Robert and all, I'm writing a new script for analysis of MEG data and I encountered some problems with FT (I'm using 20061029 version): 1) In freqdescriptives the lines 494 and 515 seem to be redundant and also don't work and cause a crash. 2) there are some missing functions: inputlabel2outputlabel called by freqdescriptives, line 234 fourier2crsspctrm called by freqdescriptives, line 290 Can you please explain to me what cfg.combinechan in freqdescriptives does (I'm new to MEG which might explain my ignorance)? Finally, I would like to compute coherence from data of a single subject with 300 trials and check whether it is significant (i.e. not random). I don't think I can use any of the nonparametric stuff because I don't have a baseline. It seems to me that I should use the jackknife SEMs. How exactly? Should I use the bias correction? Should I take 2*SEM as the threshold? Thanks, Vladimir -------------- next part -------------- An HTML attachment was scrubbed... URL: From jeremiemattout at YAHOO.FR Wed Nov 29 12:57:55 2006 From: jeremiemattout at YAHOO.FR (Jeremie MATTOUT) Date: Wed, 29 Nov 2006 11:57:55 +0000 Subject: [FIELDTRIP] reading .sdq format Message-ID: Dear Robert, > I saw on the fieldtrip web site that some functions should be > available from the fieldtrip FTP server. > However I have not been able to download them. Any help would be > most welcome. The documentatino and a link to the ftp server is given here http:// www2.ru.nl/fcdonders/fieldtrip/doku.php? id=fieldtrip:documentation:dataformats#support_for_yokogawa_meg_data The problem is that the .zip file for that format is empty. Actually, the lst fileio...zip is empty as well! > To be a bit more precise, I am looking for a filter that would > import those data format directly into Matlab or, alternatively, > that would enable me to produce binary (.bin) files that I should > then be able to convert into Matlab. I suggest that you download the fileio module and use the Matlab interface described here http://www2.ru.nl/fcdonders/fieldtrip/ doku.php?id=fieldtrip:development:fileio That requires that you drop the yokogawa specific functions in the "private" directory. I've downloaded the most recent fileio.zip available but the keyval.m function was missing !? Thanks very much for your help. Best, Jeremie ___________________________________________________________________________ Yahoo! Mail réinvente le mail ! Découvrez le nouveau Yahoo! Mail et son interface révolutionnaire. http://fr.mail.yahoo.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From Jan.Schoffelen at FCDONDERS.RU.NL Wed Nov 29 13:01:01 2006 From: Jan.Schoffelen at FCDONDERS.RU.NL (Jan Mathijs Schoffelen) Date: Wed, 29 Nov 2006 13:01:01 +0100 Subject: Some issues in freqanalysis In-Reply-To: <00a801c713a1$dcb1f120$f0463ec1@sobell.ion.ucl.ac.uk> Message-ID: Dear Vladimir, You can do it when you create a clever statfun_blabla. I assume you are familiar with the new statistics-framework in fieldtrip. What you now can do, is to put your reshaped EMG-fourierdata into your design such that it is "Nvox" (=reshaped channel*freq*time) x Ntapers (do you use multitapering?). Important is to append a row to the design which specifies the trial-number from which the taper was coming from. I guess you should then define this row-number as the the corresponding cfg.cvar, or uvar, or something. What your statfun_blabla then should output is the coherence, computed between the input-data dat (which is the reshaped MEG-fourierspectra), and the "design". To this end, I would reshape the data back into the original TFR-dimensions (there should be a dim in the cfg which is passed to the statfun), and extract the EMG-data from the design, which will be shuffled in the taper-dimension when running the randomization, which is exactly what you want, and write some for-loops around the critical computation, which involves some cross-spectral density computations, according to fft1*ctranspose(fft2) and power-spectral density computations, according to diag(fft1*ctranspose(fft1)). In short, the usual business. Do you have some handles to proceed? Yours, Jan-Mathijs _____ From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf Of Vladimir Litvak Sent: Wednesday, November 29, 2006 11:34 AM To: FIELDTRIP at NIC.SURFNET.NL Subject: Re: [FIELDTRIP] Some issues in freqanalysis Dear Eric and Jan-Mathijs, My reference channel is indeed EMG. I thought about this trial shuffling idea myself over night. It can actually be combined with clustering in channel/frequency space. Is there a way to do it with the current version of statistics routines or should it be programmed by hand? Thanks, Vladimir _____ From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf Of Jan Mathijs Schoffelen Sent: Tuesday, November 28, 2006 10:24 PM To: FIELDTRIP at NIC.SURFNET.NL Subject: Re: [FIELDTRIP] Some issues in freqanalysis Dear Vladimir, Regarding the missing functions: you are absolutely right. The functions will be added to the latest release. Regarding the crash: I don't know what is happening there, and I do not have any experience with the option biascorrect. You'll have to ask Eric about this. Does it still crash when you use cfg.biascorrect = 'no'? This might already solve your problem. cfg.combinechan is a rather obscure option (and is set to 'no' by default) in freqdescriptives which is (as far as I know) undocumented. It has to do with combining planar gradiometer representation back into an axial gradiometer representation in order to be able to compute coherence between sensor-combinations (in their original axial representation). As a matter of fact, it is an option which has a high 'don't try this at home'-content. At least a correct behavior is not guaranteed. Anyhow, it should run through even when it is not specified. If you want to test coherence against 0, the jack-knife estimate of the variance is not going to help you too much. Rather, you could use some kind of Z-transformation as proposed by Jarvis & Mitra Neural computation 2001, or the Z-transformation that is described in James Kilner's papers, or from the Rosenberg group. In this context, the coherence can be parametrically evaluated. Another possibility is using a 'shiftpredictor' to estimate the bias, meaning that you shuffle the trial order of one of the two channels in your channel-combination (only works when taking fourier as an output of freqanalysis). In my experience this only works if you use an external reference signal, such as the EMG. Hope this gives some handles, Jan-Mathijs _____ From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf Of Vladimir Litvak Sent: Tuesday, November 28, 2006 8:33 PM To: FIELDTRIP at NIC.SURFNET.NL Subject: [FIELDTRIP] Some issues in freqanalysis Dear Robert and all, I'm writing a new script for analysis of MEG data and I encountered some problems with FT (I'm using 20061029 version): 1) In freqdescriptives the lines 494 and 515 seem to be redundant and also don't work and cause a crash. 2) there are some missing functions: inputlabel2outputlabel called by freqdescriptives, line 234 fourier2crsspctrm called by freqdescriptives, line 290 Can you please explain to me what cfg.combinechan in freqdescriptives does (I'm new to MEG which might explain my ignorance)? Finally, I would like to compute coherence from data of a single subject with 300 trials and check whether it is significant (i.e. not random). I don't think I can use any of the nonparametric stuff because I don't have a baseline. It seems to me that I should use the jackknife SEMs. How exactly? Should I use the bias correction? Should I take 2*SEM as the threshold? Thanks, Vladimir -------------- next part -------------- An HTML attachment was scrubbed... URL: From litvak at TX.TECHNION.AC.IL Wed Nov 29 14:16:26 2006 From: litvak at TX.TECHNION.AC.IL (Vladimir Litvak) Date: Wed, 29 Nov 2006 13:16:26 -0000 Subject: Some issues in freqanalysis In-Reply-To: <013101c713ae$09bdf630$902dae83@fcdonders.nl> Message-ID: This sounds like a lot of work and I don't have much experience yet with the new statistics framework since I've used the old one until now. I think at this stage I'm not motivated enough to get into this and I'll try to find a simpler way to put some sensible error bars on the coherence. If you are planning to implement this anyway at a later stage I might be interested in contributing. Best, Vladimir _____ From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf Of Jan Mathijs Schoffelen Sent: Wednesday, November 29, 2006 12:01 PM To: FIELDTRIP at NIC.SURFNET.NL Subject: Re: [FIELDTRIP] Some issues in freqanalysis Dear Vladimir, You can do it when you create a clever statfun_blabla. I assume you are familiar with the new statistics-framework in fieldtrip. What you now can do, is to put your reshaped EMG-fourierdata into your design such that it is "Nvox" (=reshaped channel*freq*time) x Ntapers (do you use multitapering?). Important is to append a row to the design which specifies the trial-number from which the taper was coming from. I guess you should then define this row-number as the the corresponding cfg.cvar, or uvar, or something. What your statfun_blabla then should output is the coherence, computed between the input-data dat (which is the reshaped MEG-fourierspectra), and the "design". To this end, I would reshape the data back into the original TFR-dimensions (there should be a dim in the cfg which is passed to the statfun), and extract the EMG-data from the design, which will be shuffled in the taper-dimension when running the randomization, which is exactly what you want, and write some for-loops around the critical computation, which involves some cross-spectral density computations, according to fft1*ctranspose(fft2) and power-spectral density computations, according to diag(fft1*ctranspose(fft1)). In short, the usual business. Do you have some handles to proceed? Yours, Jan-Mathijs _____ From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf Of Vladimir Litvak Sent: Wednesday, November 29, 2006 11:34 AM To: FIELDTRIP at NIC.SURFNET.NL Subject: Re: [FIELDTRIP] Some issues in freqanalysis Dear Eric and Jan-Mathijs, My reference channel is indeed EMG. I thought about this trial shuffling idea myself over night. It can actually be combined with clustering in channel/frequency space. Is there a way to do it with the current version of statistics routines or should it be programmed by hand? Thanks, Vladimir _____ From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf Of Jan Mathijs Schoffelen Sent: Tuesday, November 28, 2006 10:24 PM To: FIELDTRIP at NIC.SURFNET.NL Subject: Re: [FIELDTRIP] Some issues in freqanalysis Dear Vladimir, Regarding the missing functions: you are absolutely right. The functions will be added to the latest release. Regarding the crash: I don't know what is happening there, and I do not have any experience with the option biascorrect. You'll have to ask Eric about this. Does it still crash when you use cfg.biascorrect = 'no'? This might already solve your problem. cfg.combinechan is a rather obscure option (and is set to 'no' by default) in freqdescriptives which is (as far as I know) undocumented. It has to do with combining planar gradiometer representation back into an axial gradiometer representation in order to be able to compute coherence between sensor-combinations (in their original axial representation). As a matter of fact, it is an option which has a high 'don't try this at home'-content. At least a correct behavior is not guaranteed. Anyhow, it should run through even when it is not specified. If you want to test coherence against 0, the jack-knife estimate of the variance is not going to help you too much. Rather, you could use some kind of Z-transformation as proposed by Jarvis & Mitra Neural computation 2001, or the Z-transformation that is described in James Kilner's papers, or from the Rosenberg group. In this context, the coherence can be parametrically evaluated. Another possibility is using a 'shiftpredictor' to estimate the bias, meaning that you shuffle the trial order of one of the two channels in your channel-combination (only works when taking fourier as an output of freqanalysis). In my experience this only works if you use an external reference signal, such as the EMG. Hope this gives some handles, Jan-Mathijs _____ From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf Of Vladimir Litvak Sent: Tuesday, November 28, 2006 8:33 PM To: FIELDTRIP at NIC.SURFNET.NL Subject: [FIELDTRIP] Some issues in freqanalysis Dear Robert and all, I'm writing a new script for analysis of MEG data and I encountered some problems with FT (I'm using 20061029 version): 1) In freqdescriptives the lines 494 and 515 seem to be redundant and also don't work and cause a crash. 2) there are some missing functions: inputlabel2outputlabel called by freqdescriptives, line 234 fourier2crsspctrm called by freqdescriptives, line 290 Can you please explain to me what cfg.combinechan in freqdescriptives does (I'm new to MEG which might explain my ignorance)? Finally, I would like to compute coherence from data of a single subject with 300 trials and check whether it is significant (i.e. not random). I don't think I can use any of the nonparametric stuff because I don't have a baseline. It seems to me that I should use the jackknife SEMs. How exactly? Should I use the bias correction? Should I take 2*SEM as the threshold? Thanks, Vladimir -------------- next part -------------- An HTML attachment was scrubbed... URL: From wibral at MPIH-FRANKFURT.MPG.DE Wed Nov 29 15:11:17 2006 From: wibral at MPIH-FRANKFURT.MPG.DE (Michael Wibral) Date: Wed, 29 Nov 2006 15:11:17 +0100 Subject: Reading in data from a new CTF system with ECC Message-ID: Hi, I'm trying to read in data from a CTF 275 channel system. It is equipped with the new ECC console that now (among other things) is responsible for the triggers from presentation. These 'triggers' are written to the channel UPPT001 (indicating that they arrive on the first parallel port of the Acq computer?). We record in a 'pseudo trial'ed fashion i.e. one trigger starts the acquistion of one long trial, other triggers are written to the UPPT001 channel but do not chop the data. There is also a truly continous recording resulting in an ...aux.ds file but that's still experimental CTF said. When I use trialfun_ctf_continuous to read in the data no triggers are found and as a consequence no trials are defined - I wonder whether there is a problem with things like the 'STIM' channel and the [backpanel, frontpanel] stuff as the machine doesn't seem to have any back or frontpanel - but the ECC instead. I have also tried to trial the data inside the CTF Software (using newDs with the corresponding markers) and then to use trialfun_ctf_epoched with the same result. BESA reads the triggers however without problems, both, their values (1,2,3...) and der names. so I think the data format shouldn't have changed too much. here is the code (with variations) that I have tried so far - any suggestions?: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Reading CTF .ds data files and preprocess them %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% clear all; fclose('all'); pathname ='/home/wibral/DATA/BAM_EEGIIIRC_oldTime/'; % I used either continuous or epoched data filename='ASL30_AMMEGIIIRC_20061124_01.ds'; % filename='ASL30_AMMEGIIIRC_20061124_01_trials.ds'; FullName=strcat(pathname,filename); % build analysis configuration cfg=[]; cfg.channel={'MEG' 'UPPT001'}; % also tried 'STIM' instead cfg.dataset=FullName; cfg.trialfun='trialfun_ctf_continuous'; % also tried ..._epoched % I tried either of the following three lines cfg.trialdef.trigger=2; cfg.trialdef.stim = 2; cfg.trialdef.includeTrigger= 2; % I also tried strings given in the markers file instead... % this doesn't result in any output either...interestingly cfg.trialdef.eventtype='?'; cfg.trialdef.excludeConditions={'BAD'}; % I also tried to give a trigger file separately: % cfg.trialdef.trgfile= strcat(FullName,'/','MarkerFile.mrk'); cfg.trialdef.prestim=0.5; cfg.trialdef.poststim=1; cfg=definetrial(cfg); cfg.blc='yes'; cfg.blcwindow=[-0.2 0]; DataName=strcat('data_trigger_',num2str(cfg.trialdef.includeTrigger)); EvalStr=strcat(DataName,'=preprocessing(cfg);'); eval(EvalStr); Any help is appreciated. Thank you very much. Best Regards, Michael Wibral From r.oostenveld at FCDONDERS.RU.NL Wed Nov 29 18:14:05 2006 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Wed, 29 Nov 2006 18:14:05 +0100 Subject: Reading in data from a new CTF system with ECC In-Reply-To: <06112915111720_2800013E@mpih-frankfurt.mpg.de> Message-ID: Hi Michael On 29 Nov 2006, at 15:11, Michael Wibral wrote: > I'm trying to read in data from a CTF 275 channel system. > ... > When I use trialfun_ctf_continuous to read in the data no triggers are > found and as a consequence no trials are defined - I wonder whether > there is a problem with things like the 'STIM' channel and the > [backpanel, frontpanel] stuff as the machine doesn't seem to have any > back or frontpanel - but the ECC instead. I indeed think that the problem is that trialfun_ctf_continuous assumes back and frontpanel. The code in that trialfun predates the read_event code, and it is not maintained. You can use trialfun_general instead, or make your own trialfun. Read the help of definetrial to see what trialfun_general can do for you (not too much, but it might be enough). Alternatively, have a look at the bottom of the page http://www2.ru.nl/fcdonders/fieldtrip/doku.php? id=fieldtrip:documentation:tutorial:eventrelatedaveraging to see a straightforward example trialfun. For that, you should also look into read_fcdc_event. We also use pseudocontinuous data at the Donders. Note that you have to do cfg.datatype='continuous' in preprocessing and artifact detection. > I have also tried to trial the data inside the CTF Software (using > newDs > with the corresponding markers) and then to use trialfun_ctf_epoched > with the same result. Also the trialfun_ctf_epoched is very old. > BESA reads the triggers however without problems, both, their values > (1,2,3...) and der names. so I think the data format shouldn't have > changed too much. No, the dataformat indeed did not change that much. It is also already implemented in the read_fcdc_event code, and the general trial function (or custom trial functions) can work with it. best regards, Robert From Brian.Roach at YALE.EDU Wed Nov 29 18:20:14 2006 From: Brian.Roach at YALE.EDU (Brian Roach) Date: Wed, 29 Nov 2006 12:20:14 -0500 Subject: freqanalysis_wltconvol.m question In-Reply-To: <000f01c70d3a$f122ea50$902dae83@fcdonders.nl> Message-ID: Thanks again, I have just one last follow-up question: Why would you square the final ITC? Tallon-Baudry et al. do not do this in their j Neurosci. '97 publication. Brian At 02:02 AM 11/21/2006, Jan Mathijs Schoffelen wrote: >Dear Brian et al, > > >---------- >From: Brian Roach [mailto:Brian.Roach at yale.edu] >Sent: Monday, November 20, 2006 11:56 PM >To: Jan Mathijs Schoffelen >Subject: Re: [FIELDTRIP] freqanalysis_wltconvol.m question > >Hi, I could not get this posted to the list, and figured since you gave >most of the feedback, I would see what you think. > >thanks, >Brian > > >Date: Mon, 13 Nov 2006 12:09:00 -0500 >To: FieldTrip discussion list >From: Brian Roach >Subject: Re: [FIELDTRIP] freqanalysis_wltconvol.m question >Bcc: Daniel Mathalon > >Thanks for the advice, I am wondering if FT users would agree that this >is an acceptable way to estimate univariate phase coherence: > >In freqanalysis_wltconvol.m, line 283: > % powdum = (2.* abs(autspctrmacttap) ./ > data.fsample) .^ 2; > powdum = (2.*autspctrmacttap ./ data.fsample); > >1. I've commented out the power line and inserted basically the same thing >(but not squared) >2. As suggested, I change cfg.keeptrials = 'yes'; >3. After running freqanalysis.m, in the command prompt: > itc = > abs(mean(squeeze(freq.powspctrm)./abs(squeeze(freq.powspctrm)),1)) > >squeeze is used because freq.powspctrm is a 3 d matrix including sites, >times, and frequencies and in the above case I am just getting itc from 1 >channel. Does this method seem alright? Regarding step #1 above, it >seemed to make no difference whether I left the 2.* in that equation or >not, which seems consistent with an earlier e-mail that mentioned this >multiplication being tied into power, so it does not influence phase >angle. Is that right? Or, should it be taken out for my purposes? > >thanks, >Brian > >This looks fine to me. Indeed the factor of 2 does not affect the outcome, >because it falls out in the division (normalization) step. > >Yours, > >Jan-Mathijs > >PS: you might have to think about whether or not to square the final itc, >to make it consistent with the way it is defined in the literature. > > > >At 04:37 AM 11/9/2006, you wrote: > >Dear Brian, > >Freqanalysis_wltconvol does not support fourier as an output. However, since >wavelet-analysis and fft's in the end are about the same thingy, you could >use freqanalysis_mtmconvol to achieve your goal. >There is a tutorial on the fieldtrip-website which deals with this function, >and uses it in a way that it resembles a wavelet-analysis, in which the >time-frequency resolution is treated in the same way as with standard >wavelet-analysis. > >Phase-locking-value is defined in fieldtrip as a bivariate-measure, so that >means that it quantifies how consistent the phase-relation between two >channels is across trials. >Inter-trial coherence is a bit an odd thingy, because the term coherence >suggests something bivariate, but the way you would like to use it, is >essentially univariate. You want to estimate how consistent the phase of the >oscillations at a particular channel is across trials. >However, both measures use similar math. In fact, when you create a >dummy-fourier-channel you can use the plv-option to obtain your 'itc'. This >is because in this situation, the mathematics become identical. I would >advise it like this: > >Do your freqanalysis as Robert suggested in one of his previous mails (see >below (cfg.keeptapers = 'yes')). >Then create a dummy channel: > >dim = size(freq.fourierspctrm; >freq.fourierspctrm(:,end+1,:,:) = ones(dim([1 3 4])); >freq.label = 'dummy'; > >cfg = []; >cfg.cohmethod = 'plv'; >cfg.channelcmb = channelcombination({'dummy' 'all'}, freq.label); %should >work > >itc = freqdescriptives(cfg, freq); > >Your 'itc' now is contained in the field itc.cohspctrm; > >The check whether this is correctly done is done outside fieldtrip: > >itc2 = abs(mean(freq.fourierspctrm./abs(freq.fourierspctrm),1)); > >Yours, > >Jan-Mathijs > > >-----Original Message----- >From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf >Of Brian Roach >Sent: Wednesday, November 08, 2006 11:13 PM >To: FIELDTRIP at NIC.SURFNET.NL >Subject: Re: [FIELDTRIP] freqanalysis_wltconvol.m question > >Robert, >Thanks for your quick reply. I did not realize that >freqanalysis_wltconvol.m allowed for 'fourier' output, but maybe I need to >download the latest version. Or, do you mean I should use freqanalysis_mtm >instead? Also, how does ITC differ from phase-locking value? I thought >they were the same measure. >At 04:56 PM 11/8/2006, you wrote: > >Hi Brian > > > >On 8 Nov 2006, at 21:20, Brian Roach wrote: > >>eI would like to take this complex output and use it to calculate > >>phase-locking factor, but I am not sure what parts of the power > >>transformation need to be removed - just the abs() and the > >>squaring? Clarification of this line of code would be extremely > >>helpful to me. > > > >You can use the existing code for that: > > > >For computing the phase-locking value I suggest that you use either > > cfg.output='fourier' > > cfg.keeptrials='yes' > > cfg.keeptapers='yes' > >or > > cfg.output='fourier' > > cfg.keeptrials='yes' > > cfg.keeptapers='no' (not needed now) > > cfg.channelcmb = something, see the help > >in freqanalysis. > > > >Subsequently, use the option > > cfg.cohmethod='plv' > >in freqdescriptives. In case of fourier output in freqanalysis, you > >should specify the channel combinations here. > > > >... > >Looking back at your previous mail, I see that you mean ITC and not > >PLV. The stuff above then does not apply. You can do output=fourier > >in freqanalysis and work manually on the output freq structure. I > >think that this should work > > > >magnitude = abs(freq.fourierspctrm); > >scaled = freq.fourierspctrm ./ magnitude; > >freq.itcspctrm = mean(scaled, 1); > >freq = rmfield(freq, 'fourierspctrm'); % remove the single > >fourierspectrum, to avoid confusion > >freq.dimord = 'chan_freq_time'; % remove the rpt or rpttap > >dimension > > > >best regards, > >Robert > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From r.oostenveld at FCDONDERS.RU.NL Wed Nov 29 18:20:26 2006 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Wed, 29 Nov 2006 18:20:26 +0100 Subject: [FIELDTRIP] reading .sdq format In-Reply-To: <20061129115755.65556.qmail@web26015.mail.ukl.yahoo.com> Message-ID: Hi Jeremie On 29 Nov 2006, at 12:57, Jeremie MATTOUT wrote: > The problem is that the .zip file for that format is empty. The yokogawa zip file indeed was corrupt, but I fixed it immediately after your previous mail. So please try again. (I just checked, it is now ok) > Actually, the lst fileio...zip is empty as well! Ok, I'll remove that. > I've downloaded the most recent fileio.zip available but the > keyval.m function was missing !? Sorry. I'll include it in future versions. Please find the keyval function attached, you can put it in private. best Robert PS version and release management is quite a lot of work, and sometimes stuff breaks the different versions of the modules. Thanks for letting me know, since it is something that I would not notice myself. -------------- next part -------------- A non-text attachment was scrubbed... Name: keyval.m Type: application/octet-stream Size: 726 bytes Desc: not available URL: -------------- next part -------------- From Pascal.Fries at FCDONDERS.RU.NL Wed Nov 29 21:18:06 2006 From: Pascal.Fries at FCDONDERS.RU.NL (Pascal Fries) Date: Wed, 29 Nov 2006 21:18:06 +0100 Subject: FW: Still getting NaNs Message-ID: I used freqanalysis_mtmconvol with output= fourier and then called freqdescriptives and got this error message: > ??? Reference to non-existent field 'cumtapcnt'. > > Error in ==> fourier2crsspctrm at 79 > Nrpt = length(freq.cumtapcnt); > > Error in ==> freqdescriptives at 290 > freq = fourier2crsspctrm(tmpcfg, freq); Why didn't freqanalysis give freq.cumtapcnt? Best, Pascal From Jan.Schoffelen at FCDONDERS.RU.NL Wed Nov 29 21:58:47 2006 From: Jan.Schoffelen at FCDONDERS.RU.NL (Jan Mathijs Schoffelen) Date: Wed, 29 Nov 2006 21:58:47 +0100 Subject: freqanalysis_wltconvol.m question In-Reply-To: <6.1.2.0.2.20061129121815.04dd3ec0@email.med.yale.edu> Message-ID: Dear Brian, Then I would say not to square it. Yours, Jan-Mathijs _____ From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf Of Brian Roach Sent: Wednesday, November 29, 2006 6:20 PM To: FIELDTRIP at NIC.SURFNET.NL Subject: Re: [FIELDTRIP] freqanalysis_wltconvol.m question Thanks again, I have just one last follow-up question: Why would you square the final ITC? Tallon-Baudry et al. do not do this in their j Neurosci. '97 publication. Brian At 02:02 AM 11/21/2006, Jan Mathijs Schoffelen wrote: Dear Brian et al, _____ From: Brian Roach [mailto:Brian.Roach at yale.edu] Sent: Monday, November 20, 2006 11:56 PM To: Jan Mathijs Schoffelen Subject: Re: [FIELDTRIP] freqanalysis_wltconvol.m question Hi, I could not get this posted to the list, and figured since you gave most of the feedback, I would see what you think. thanks, Brian Date: Mon, 13 Nov 2006 12:09:00 -0500 To: FieldTrip discussion list From: Brian Roach Subject: Re: [FIELDTRIP] freqanalysis_wltconvol.m question Bcc: Daniel Mathalon Thanks for the advice, I am wondering if FT users would agree that this is an acceptable way to estimate univariate phase coherence: In freqanalysis_wltconvol.m, line 283: % powdum = (2.* abs(autspctrmacttap) ./ data.fsample) .^ 2; powdum = (2.*autspctrmacttap ./ data.fsample); 1. I've commented out the power line and inserted basically the same thing (but not squared) 2. As suggested, I change cfg.keeptrials = 'yes'; 3. After running freqanalysis.m, in the command prompt: itc = abs(mean(squeeze(freq.powspctrm)./abs(squeeze(freq.powspctrm)),1)) squeeze is used because freq.powspctrm is a 3 d matrix including sites, times, and frequencies and in the above case I am just getting itc from 1 channel. Does this method seem alright? Regarding step #1 above, it seemed to make no difference whether I left the 2.* in that equation or not, which seems consistent with an earlier e-mail that mentioned this multiplication being tied into power, so it does not influence phase angle. Is that right? Or, should it be taken out for my purposes? thanks, Brian This looks fine to me. Indeed the factor of 2 does not affect the outcome, because it falls out in the division (normalization) step. Yours, Jan-Mathijs PS: you might have to think about whether or not to square the final itc, to make it consistent with the way it is defined in the literature. At 04:37 AM 11/9/2006, you wrote: Dear Brian, Freqanalysis_wltconvol does not support fourier as an output. However, since wavelet-analysis and fft's in the end are about the same thingy, you could use freqanalysis_mtmconvol to achieve your goal. There is a tutorial on the fieldtrip-website which deals with this function, and uses it in a way that it resembles a wavelet-analysis, in which the time-frequency resolution is treated in the same way as with standard wavelet-analysis. Phase-locking-value is defined in fieldtrip as a bivariate-measure, so that means that it quantifies how consistent the phase-relation between two channels is across trials. Inter-trial coherence is a bit an odd thingy, because the term coherence suggests something bivariate, but the way you would like to use it, is essentially univariate. You want to estimate how consistent the phase of the oscillations at a particular channel is across trials. However, both measures use similar math. In fact, when you create a dummy-fourier-channel you can use the plv-option to obtain your 'itc'. This is because in this situation, the mathematics become identical. I would advise it like this: Do your freqanalysis as Robert suggested in one of his previous mails (see below (cfg.keeptapers = 'yes')). Then create a dummy channel: dim = size(freq.fourierspctrm; freq.fourierspctrm(:,end+1,:,:) = ones(dim([1 3 4])); freq.label = 'dummy'; cfg = []; cfg.cohmethod = 'plv'; cfg.channelcmb = channelcombination({'dummy' 'all'}, freq.label); %should work itc = freqdescriptives(cfg, freq); Your 'itc' now is contained in the field itc.cohspctrm; The check whether this is correctly done is done outside fieldtrip: itc2 = abs(mean(freq.fourierspctrm./abs(freq.fourierspctrm),1)); Yours, Jan-Mathijs -----Original Message----- From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf Of Brian Roach Sent: Wednesday, November 08, 2006 11:13 PM To: FIELDTRIP at NIC.SURFNET.NL Subject: Re: [FIELDTRIP] freqanalysis_wltconvol.m question Robert, Thanks for your quick reply. I did not realize that freqanalysis_wltconvol.m allowed for 'fourier' output, but maybe I need to download the latest version. Or, do you mean I should use freqanalysis_mtm instead? Also, how does ITC differ from phase-locking value? I thought they were the same measure. At 04:56 PM 11/8/2006, you wrote: >Hi Brian > >On 8 Nov 2006, at 21:20, Brian Roach wrote: >>eI would like to take this complex output and use it to calculate >>phase-locking factor, but I am not sure what parts of the power >>transformation need to be removed - just the abs() and the >>squaring? Clarification of this line of code would be extremely >>helpful to me. > >You can use the existing code for that: > >For computing the phase-locking value I suggest that you use either > cfg.output='fourier' > cfg.keeptrials='yes' > cfg.keeptapers='yes' >or > cfg.output='fourier' > cfg.keeptrials='yes' > cfg.keeptapers='no' (not needed now) > cfg.channelcmb = something, see the help >in freqanalysis. > >Subsequently, use the option > cfg.cohmethod='plv' >in freqdescriptives. In case of fourier output in freqanalysis, you >should specify the channel combinations here. > >... >Looking back at your previous mail, I see that you mean ITC and not >PLV. The stuff above then does not apply. You can do output=fourier >in freqanalysis and work manually on the output freq structure. I >think that this should work > >magnitude = abs(freq.fourierspctrm); >scaled = freq.fourierspctrm ./ magnitude; >freq.itcspctrm = mean(scaled, 1); >freq = rmfield(freq, 'fourierspctrm'); % remove the single >fourierspectrum, to avoid confusion >freq.dimord = 'chan_freq_time'; % remove the rpt or rpttap >dimension > >best regards, >Robert > -------------- next part -------------- An HTML attachment was scrubbed... URL: From Jan.Schoffelen at FCDONDERS.RU.NL Wed Nov 29 22:02:04 2006 From: Jan.Schoffelen at FCDONDERS.RU.NL (Jan Mathijs Schoffelen) Date: Wed, 29 Nov 2006 22:02:04 +0100 Subject: FW: Still getting NaNs In-Reply-To: <001501c713f3$7b140a00$6de36391@fcdonders.nl> Message-ID: Dear Pascal, This is a known problem and should be fixed. The easiest workaround is to manually add a cumtapcnt prior to calling freqdescriptives: freq.cumtapcnt = ones(size(freq.fourierspctrm,1),1); Yours, Jan-Mathijs -----Original Message----- From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf Of Pascal Fries Sent: Wednesday, November 29, 2006 9:18 PM To: FIELDTRIP at NIC.SURFNET.NL Subject: [FIELDTRIP] FW: Still getting NaNs I used freqanalysis_mtmconvol with output= fourier and then called freqdescriptives and got this error message: > ??? Reference to non-existent field 'cumtapcnt'. > > Error in ==> fourier2crsspctrm at 79 > Nrpt = length(freq.cumtapcnt); > > Error in ==> freqdescriptives at 290 > freq = fourier2crsspctrm(tmpcfg, freq); Why didn't freqanalysis give freq.cumtapcnt? Best, Pascal From Pascal.Fries at FCDONDERS.RU.NL Wed Nov 29 22:05:14 2006 From: Pascal.Fries at FCDONDERS.RU.NL (Pascal Fries) Date: Wed, 29 Nov 2006 22:05:14 +0100 Subject: FW: Still getting NaNs In-Reply-To: <001701c713f9$9fb39780$902dae83@fcdonders.nl> Message-ID: Thanks!!! > -----Original Message----- > From: FieldTrip discussion list > [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf Of Jan Mathijs Schoffelen > Sent: Wednesday, 29 November, 2006 22:02 > To: FIELDTRIP at NIC.SURFNET.NL > Subject: Re: [FIELDTRIP] FW: Still getting NaNs > > Dear Pascal, > > This is a known problem and should be fixed. The easiest > workaround is to manually add a cumtapcnt prior to calling > freqdescriptives: > > freq.cumtapcnt = ones(size(freq.fourierspctrm,1),1); > > Yours, > > Jan-Mathijs > > > -----Original Message----- > From: FieldTrip discussion list > [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf Of Pascal Fries > Sent: Wednesday, November 29, 2006 9:18 PM > To: FIELDTRIP at NIC.SURFNET.NL > Subject: [FIELDTRIP] FW: Still getting NaNs > > > > I used freqanalysis_mtmconvol with output= fourier and then > called freqdescriptives and got this error message: > > > ??? Reference to non-existent field 'cumtapcnt'. > > > > Error in ==> fourier2crsspctrm at 79 > > Nrpt = length(freq.cumtapcnt); > > > > Error in ==> freqdescriptives at 290 > > freq = fourier2crsspctrm(tmpcfg, freq); > > Why didn't freqanalysis give freq.cumtapcnt? > > Best, Pascal > From wibral at MPIH-FRANKFURT.MPG.DE Wed Nov 29 22:22:41 2006 From: wibral at MPIH-FRANKFURT.MPG.DE (Michael Wibral) Date: Wed, 29 Nov 2006 22:22:41 +0100 Subject: Reading in data from a new CTF system with ECC Message-ID: Robert, thank you very much. The trialfun_general indeed does the job (at least for my simple design). Best Regards, Michael >Hi Michael > >On 29 Nov 2006, at 15:11, Michael Wibral wrote: >> I'm trying to read in data from a CTF 275 channel system. >> ... >> When I use trialfun_ctf_continuous to read in the data no triggers are >> found and as a consequence no trials are defined - I wonder whether >> there is a problem with things like the 'STIM' channel and the >> [backpanel, frontpanel] stuff as the machine doesn't seem to have any >> back or frontpanel - but the ECC instead. > >I indeed think that the problem is that trialfun_ctf_continuous >assumes back and frontpanel. The code in that trialfun predates the >read_event code, and it is not maintained. You can use >trialfun_general instead, or make your own trialfun. Read the help of >definetrial to see what trialfun_general can do for you (not too >much, but it might be enough). > >Alternatively, have a look at the bottom of the page >http://www2.ru.nl/fcdonders/fieldtrip/doku.php? >id=fieldtrip:documentation:tutorial:eventrelatedaveraging >to see a straightforward example trialfun. For that, you should also >look into read_fcdc_event. > >We also use pseudocontinuous data at the Donders. Note that you have >to do cfg.datatype='continuous' in preprocessing and artifact detection. > >> I have also tried to trial the data inside the CTF Software (using >> newDs >> with the corresponding markers) and then to use trialfun_ctf_epoched >> with the same result. > >Also the trialfun_ctf_epoched is very old. > >> BESA reads the triggers however without problems, both, their values >> (1,2,3...) and der names. so I think the data format shouldn't have >> changed too much. > >No, the dataformat indeed did not change that much. It is also >already implemented in the read_fcdc_event code, and the general >trial function (or custom trial functions) can work with it. > >best regards, >Robert From jeremiemattout at YAHOO.FR Thu Nov 30 10:30:34 2006 From: jeremiemattout at YAHOO.FR (Jeremie MATTOUT) Date: Thu, 30 Nov 2006 09:30:34 +0000 Subject: [FIELDTRIP] Re : [FIELDTRIP] reading .sdq format Message-ID: Dear Robert, thanks very much for your help and time. I now could access and run the routines. However, the .sqd fileformat does not seem to be supported. I don't know if I missed something here but if not, could anyone advise me on some filter routine that would enable me to then read them in Matlab? Best, Jeremie ----- Message d'origine ---- De : Robert Oostenveld À : FIELDTRIP at NIC.SURFNET.NL Envoyé le : Mercredi, 29 Novembre 2006, 17h20mn 26s Objet : Re: [FIELDTRIP] Re : [FIELDTRIP] reading .sdq format Hi Jeremie On 29 Nov 2006, at 12:57, Jeremie MATTOUT wrote: > The problem is that the .zip file for that format is empty. The yokogawa zip file indeed was corrupt, but I fixed it immediately after your previous mail. So please try again. (I just checked, it is now ok) > Actually, the lst fileio...zip is empty as well! Ok, I'll remove that. > I've downloaded the most recent fileio.zip available but the > keyval.m function was missing !? Sorry. I'll include it in future versions. Please find the keyval function attached, you can put it in private. best Robert PS version and release management is quite a lot of work, and sometimes stuff breaks the different versions of the modules. Thanks for letting me know, since it is something that I would not notice myself. ___________________________________________________________________________ Découvrez une nouvelle façon d'obtenir des réponses à toutes vos questions ! Profitez des connaissances, des opinions et des expériences des internautes sur Yahoo! Questions/Réponses http://fr.answers.yahoo.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From wibral at MPIH-FRANKFURT.MPG.DE Thu Nov 30 10:40:55 2006 From: wibral at MPIH-FRANKFURT.MPG.DE (Michael Wibral) Date: Thu, 30 Nov 2006 10:40:55 +0100 Subject: Reading data with trialfun_general Message-ID: Dear Robert, as I replied yesterday, trialfun_general does indeed create trials, at least if I directly specify eventtype as a string. If I however try to use eventvalues from the trigger channel (UPPT001 in my case) I noticed that FT changes the values from what presentation send (and from what BESA reads correctly) in the following way: Stimulus CTFdisplay BESAreading FTreading 'StimUpper' 2 2 3 'StimMiddle' 3 3 5 'StimLower' 4 4 7 i.e. it changes it from the first three numbers bigger than 1 to the first three odd numbers that are bigger than one. Is it possible that there is still some frontpanel+backpanel binary addition going on - even in trialfun_general? Thank you very much for your help. Best Regards, Michael From r.oostenveld at FCDONDERS.RU.NL Thu Nov 30 11:02:01 2006 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Thu, 30 Nov 2006 11:02:01 +0100 Subject: [FIELDTRIP] Re : [FIELDTRIP] reading .sdq format In-Reply-To: <20061130093034.38442.qmail@web26002.mail.ukl.yahoo.com> Message-ID: Hu Jeremie On 30 Nov 2006, at 10:30, Jeremie MATTOUT wrote: > However, the .sqd fileformat does not seem to be supported. > I don't know if I missed something here but if not, could anyone > advise me on some filter routine that would enable me to then read > them in Matlab? I recall that the sdq format is an averaged format that is not supported any more (I could be wrong here). As suggested to me by Masahiro Shimogawara, one of the engineers at Yokogawa, I have dropped support for it. If you can, please use the *.ave file instead. See below for his message: On 24 Oct 2005, at 4:56, Masahiro.Shimogawara at jp.yokogawa.com wrote: > I have added some programs to your toolbox. Please refer the attached > files. > > 1) I have changed the code in filetype.m not to use the extension > ".sqd". > Because this extension remains for compatibility and we have not > use > one any more. It might be that it is only the extension, try renaming the file to *.ave and see whether it works with read_header and read_data. Robert From jeremiemattout at YAHOO.FR Thu Nov 30 12:20:20 2006 From: jeremiemattout at YAHOO.FR (Jeremie MATTOUT) Date: Thu, 30 Nov 2006 11:20:20 +0000 Subject: [FIELDTRIP] Re : [FIELDTRIP] Re : [FIELDTRIP] reading .sdq format Message-ID: Dear Robert, Thanks a lot, it is working now. Well I am facing a memory problem but the routine seems to do the job. FYI, I had to comment the use of hastoolbox.m function in both read_data and read_header since I could not find this function. Also I corrected a parsing error on line 226 of read_yokogawa_data.m All the best, Jeremie ___________________________________________________________________________ Découvrez une nouvelle façon d'obtenir des réponses à toutes vos questions ! Profitez des connaissances, des opinions et des expériences des internautes sur Yahoo! Questions/Réponses http://fr.answers.yahoo.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From r.oostenveld at FCDONDERS.RU.NL Thu Nov 30 14:27:52 2006 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Thu, 30 Nov 2006 14:27:52 +0100 Subject: [FIELDTRIP] Re : [FIELDTRIP] Re : [FIELDTRIP] reading .sdq format In-Reply-To: <20061130112020.47118.qmail@web26006.mail.ukl.yahoo.com> Message-ID: On 30 Nov 2006, at 12:20, Jeremie MATTOUT wrote: > FYI, I had to comment the use of hastoolbox.m function in both > read_data and read_header since I could not find this function. > Also I corrected a parsing error on line 226 of read_yokogawa_data.m thanks, I'll fix those two bugs in the next fileio version. Robert From marco.buiatti at GMAIL.COM Thu Nov 30 15:27:46 2006 From: marco.buiatti at GMAIL.COM (Marco Buiatti) Date: Thu, 30 Nov 2006 15:27:46 +0100 Subject: CRA on ERPs Message-ID: Dear FieldTrippers, I have a question on the use and interpretation of Cluster Randomization Analysis on ERPs. I analised the statistical difference between 2 conditions (9 subjects, within-subjects design), and I obtained two NON-significant clusters, one negative in the frontal lobe (p=0.24) and one positive in posterior regions (p=0.08). These clusters emerge and die at almost the same times, so they really look like reflecting the SAME process. I tested this hypothesis by performing the same analysis on the absolute value of the ERPs: now a significant positive cluster (p=0.02) emerges at the same latency of the previous two, and spatially overlapping to their topography. Do you think that this procedure is plausible, or alternatively that it is not correct and the effect is just too weak? Anyone faced a similar problem and has alternative procedures? Thanks, Marco -- Marco Buiatti - Post Doc ************************************************************** Cognitive Neuroimaging Unit - INSERM U562 Service Hospitalier Frederic Joliot, CEA/DRM/DSV 4 Place du general Leclerc, 91401 Orsay cedex, France Telephone: +33 1 69 86 77 65 Fax: +33 1 69 86 78 16 E-mail: marco.buiatti at gmail.com Web: www.unicog.org *************************************************************** From thomas at UCSD.EDU Thu Nov 30 17:42:07 2006 From: thomas at UCSD.EDU (Thomas Thesen) Date: Thu, 30 Nov 2006 11:42:07 -0500 Subject: freqbaseline & zscore Message-ID: Dear Fieldtrippers, It's been quite busy on this list lately. Nice! I have three quick questions. In version 20060605 of FT, there is an option for cf.baselinetype = zscore; but it is commented out in freqbaseline.m. Is there a specific reason for it, i.e. is the code for computing a zscore for baseline vs active not correct? Is there an inbuilt option to plot the spectrograms with multiplotTFR funcions 'as they are', i.e. without any baseline operations, just the raw values. So far I've been using imagesc on the data matrix, but would like to plot them in an arrangement specified by the .lay file. And is there a way to compute a 2D representation of the frequency spectrum of a particular channel? Like a typical FFT plot with frequency on the x axis and power on the y axis? Thanks a lot, Thomas -------------- next part -------------- An HTML attachment was scrubbed... URL: From maris at NICI.RU.NL Thu Nov 30 21:44:03 2006 From: maris at NICI.RU.NL (Eric Maris) Date: Thu, 30 Nov 2006 21:44:03 +0100 Subject: CRA on ERPs In-Reply-To: <22f732b0611300627y44f34263hd09a1cdd3582af50@mail.gmail.com> Message-ID: Hi Marco, > I have a question on the use and interpretation of Cluster > Randomization Analysis on ERPs. I analised the statistical difference > between 2 conditions (9 subjects, within-subjects design), and I > obtained two NON-significant clusters, one negative in the frontal > lobe (p=0.24) and one positive in posterior regions (p=0.08). These > clusters emerge and die at almost the same times, so they really look > like reflecting the SAME process. I tested this hypothesis by > performing the same analysis on the absolute value of the ERPs: now a > significant positive cluster (p=0.02) emerges at the same latency of > the previous two, and spatially overlapping to their topography. > > Do you think that this procedure is plausible, or alternatively that > it is not correct and the effect is just too weak? Anyone faced a > similar problem and has alternative procedures? If you had decided to run Cluster Randomizaton Analysis on the absolute value of the ERP's WITHOUT HAVING LOOKED AT YOUR DATA, then you would have controlled your Type 1 error (false alarm) rate at 0.05. This does not imply that, for your data, the null hypothesis holds. I would advise you to run Cluster Randomization Analysis on the data of each of the subjects separately. If the same significant spatiotemporal pattern shows up in the majority of the subjects, then I would be convinced that something interesting is going on here. However, in this way, you are not testing a random effects null hypothesis. Maybe you can live with this. I can live with it, and so do all monkey neuroscientists with their N=2 studies. Greetings, Eric > > Thanks, > > Marco > > > > -- > Marco Buiatti - Post Doc > > ************************************************************** > Cognitive Neuroimaging Unit - INSERM U562 > Service Hospitalier Frederic Joliot, CEA/DRM/DSV > 4 Place du general Leclerc, 91401 Orsay cedex, France > Telephone: +33 1 69 86 77 65 Fax: +33 1 69 86 78 16 > E-mail: marco.buiatti at gmail.com Web: www.unicog.org > *************************************************************** From s.debener at UKE.UNI-HAMBURG.DE Thu Nov 30 23:22:02 2006 From: s.debener at UKE.UNI-HAMBURG.DE (Stefan Debener) Date: Thu, 30 Nov 2006 23:22:02 +0100 Subject: CRA on ERPs In-Reply-To: <22f732b0611300627y44f34263hd09a1cdd3582af50@mail.gmail.com> Message-ID: Dear Marco, I have noticed the same phenomenon with other channel-wise statistics (like sample-wise ttests) before. A nose-tip recorded ERP P3, for instance, may show a significant condition effect (e.g. target vs non-target) at parietal electrodes. This condition effect often is "mirrored" to, and "shared" with, frontal sites after re-referencing the data to the common average. At these formerly "inactive" frontal electrodes, the time course and morphology of the parietal P3 now shows up, with the absolute amplitude being decreased and the polarity reversed (due to re-referencing). As a result, if you look at the spatial pattern of p values before/after re-referencing, a previously significant effect at parietal sites may now turn out to be non-significant. Probably a good argument for doing statistical analysis on the source level (which may come with other prolems). Best, Stefan Marco Buiatti wrote: > Dear FieldTrippers, > > I have a question on the use and interpretation of Cluster > Randomization Analysis on ERPs. I analised the statistical difference > between 2 conditions (9 subjects, within-subjects design), and I > obtained two NON-significant clusters, one negative in the frontal > lobe (p=0.24) and one positive in posterior regions (p=0.08). These > clusters emerge and die at almost the same times, so they really look > like reflecting the SAME process. I tested this hypothesis by > performing the same analysis on the absolute value of the ERPs: now a > significant positive cluster (p=0.02) emerges at the same latency of > the previous two, and spatially overlapping to their topography. > > Do you think that this procedure is plausible, or alternatively that > it is not correct and the effect is just too weak? Anyone faced a > similar problem and has alternative procedures? > > Thanks, > > Marco > > > From hanneke.vandijk at FCDONDERS.RU.NL Wed Nov 1 09:54:15 2006 From: hanneke.vandijk at FCDONDERS.RU.NL (Hanneke van Dijk) Date: Wed, 1 Nov 2006 09:54:15 +0100 Subject: Clusterrandanalysis In-Reply-To: <7.0.0.16.0.20061031180808.019e58a8@tiscali.it> Message-ID: Dear all, I have been working with clusterrandanalysis a while ago and started the same scripts this week, but I don't seem to be able to replicate my previous results. Has something been changed in the function? If yes, how can I solve that? Best, Hanneke _________________________________________________ Hanneke van Dijk-van de Geijn Ph. D. Student Measuring and Modeling Magnetic Brain Activity F.C. Donders Centre for Cognitive Neuroimaging. e-mail: hanneke.vandijk at fcdonders.ru.nl tel: 024-3610985 From maris at NICI.RU.NL Wed Nov 1 10:19:24 2006 From: maris at NICI.RU.NL (Eric Maris) Date: Wed, 1 Nov 2006 10:19:24 +0100 Subject: Clusterrandanalysis In-Reply-To: <000601c6fd93$4f2f5640$302dae83@fcdonders.nl> Message-ID: Dear Hanneke, > -----Original Message----- > From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf Of > Hanneke van Dijk > Sent: Wednesday, November 01, 2006 9:54 AM > To: FIELDTRIP at NIC.SURFNET.NL > Subject: [FIELDTRIP] Clusterrandanalysis > > Dear all, > > I have been working with clusterrandanalysis a while ago and started the > same scripts this week, but I don't seem to be able to replicate my previous > results. Has something been changed in the function? If yes, how can I solve > that? I have discussed this with Vladimir Litvak in a non-discussion-list-correspondence. The non-reproducibility is due to an error in the old code (not serious, however). Here is an excerpt from an email to Vladimir that may clarify things: BEGIN EXCERPT With respect to the non-reproducibility of your old result, the cause of the problem lies in the private subfunction findcluster.m. In the old version of findcluster.m (the one you used for your first analyses), the pruning of significant (sensor, frequency)-pairs, as controlled by cfg.minnbchan, was performed incorrectly. This has no consequence for false alarm rate control, because the pruning is part of the procedure for calculating the overall test statistic (i.e., the maximum cluster-level statistic), and the nonparametric test controls the false alarm rat for all test statistics. You will get your old result with the latest FT version if you replace cfg.minnbchan=2 by cfg.minnbchan=1. The error in the old version of findcluster.m was that the number of neighboring significant (sensor, frequency)-pairs was calculated incorrectly for symmetric neighbourhood structures. So, when reporting about your results, you have to change nothing, except that you may mention that the option cfg.minnbchan=1 was used. END EXCERPT Good luck, Eric From r.oostenveld at FCDONDERS.RU.NL Wed Nov 1 14:20:52 2006 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Wed, 1 Nov 2006 14:20:52 +0100 Subject: SPM integration In-Reply-To: <007b01c6fcf5$e06e7440$f0463ec1@sobell.ion.ucl.ac.uk> Message-ID: Hi Vladimir, On 31 Oct 2006, at 15:06, Vladimir Litvak wrote: > I'm starting to work on a project where I will analyze data > preprocessed in FT with SPM5 (www.fil.ion.ucl.ac.uk/spm/). For this > purpose I'd like to develop FT/SPM integration routines. It would be really nice if you could work on that. > I'll probably start with my immediate needs but I think I'm > motivated enough at the moment to eventually turn it into something > of general usefulness. If anyone has already worked in this > direction and has some code or would like to collaborate please let > me know. I am not aware of anything substantial in this direction, except that James Kilner and I have been exchanging emails about CTF dataformats (it could be that he is using snippets of our code). Furthermore, I know that Stefan Kiebel has integrated the EEG forward modelling code from FieldTrip into SPM. I have CCd this mail to them. > I'm affiliated to the methods group at FIL so I can get help from > SPM developers if necessary. Right now I'd like to be able to use > FT to read any FT supported format to SPM. I have split off the import routines (the "fileio" part) that we use in FieldTrip into a seperate package, already with the idea that other projects (SPM, EEGLAB) can reuse and contribute to the reading functions. So you can use the reading functions seperately from FieldTrip. That means that you will not be using the cfg-structure interface to the high-level FT functions, but that you will use the lower level read_header/read_data/read_event functions. See http://www2.ru.nl/fcdonders/fieldtrip/doku.php? id=fieldtrip:development:read_fcdc_xxx The download for the fileio functions is available from ftp:// ftp.fcdonders.nl/pub/fieldtrip/modules. I am considering moving the FT version control system (esp. for the fileio and forwinv module) to an external server (e.g. sourceforge) so that other people can contribute. Sofar I did not find that neccessary, and all external contributions go through email. > Additional question: how does one create low-level routines for a > new (rare) data format to be used by FT preprocessing? Is there a > template or some interface they should adhere to? I suggest that you look into read_header/read_data/read_event (in fieldtrip/private), and that you pick one of the already supported formats that you are familiar with as template. There is also some (sparse) documentation on http://www2.ru.nl/fcdonders/fieldtrip/doku.php? id=fieldtrip:documentation:dataformats#how_can_i_import_my_own_dataforma t. Furthermore, I could dig up some old emails with additional explanation (you are not the first to contribute data format specific code), but I think that the info sofar should already get you started. I will try to update the documentation on the FT wiki as well. best regards, Robert From r.oostenveld at FCDONDERS.RU.NL Wed Nov 1 15:01:17 2006 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Wed, 1 Nov 2006 15:01:17 +0100 Subject: lcmv localization In-Reply-To: <7.0.0.16.0.20061031180808.019e58a8@tiscali.it> Message-ID: Dear Luca, On 31 Oct 2006, at 18:28, Luca Ciancetta wrote: > I'm trying to localize a source with the lcmv method. I understand that you want to use simulated and SEF data. What kind of MEG system do you have? In the code below, you seem to be putting effort into construcing some details that I would not expect to be neccessary (but I might be wrong). > Following, it's the configuration I use: > > time_step = 1/h.smpfq; % the time step depends by sampling frequency > time = 0:time_step:(500*time_step); % I want to see 500 points of data this will give you 501 samples, the first sample is "0", the second is "1" etc. > data.trial{1} = data_raw(gch,0:500); % gch: list of good channels > data.time{1} = time; I suggest that you construct the "grad" seperately, and that you store it in the data (i.e. data.grad = your structure). That also helps for plotting the data. > cfg = []; > cfg.method = 'lcmv'; > cfg.grid.pos = model; % model is a matrix [number_of_sources X 3]. > This represent position of dipoles in the reference of the sphere > which contains them. > > cfg.grad.tra = zeros(nch,nch); % number of good sensors ( size of > 'gch' list ) > for i=1:nch > cfg.grad.pnt(i,: ) = h.ch(gch(i)+offset).pos(1).r_s.comp'; % > positions of MEG sensors in the reference of the spherical model > cfg.grad.ori(i,: ) = h.ch(gch(i)+offset).pos(1).u_s.comp'; % > orientations of MEG sensors in the reference of the spherical model > cfg.grad.tra(i,i) = 1; > cfg.grad.label{i} = sprintf('MZ_%d\n',gch(i)-1); > end Note that all orientation vectors should have length 1, i.e. norm (grad.ori(i,:))=1. The MEG sensors are usually given in head coordinates (i.e. related to the nose and ears in most MEG systems), and the (spherical) volume conduction model can also be defined in head coordinates. SO you don't have to express the positions of MEG sensors in the reference of the spherical model. If you do that, you should also express your dipoles in the same spherical model. All geometrical objects (sensors, dipoles, geometry of the head model) should be expressed in the same coordinates and the same units. > cfg.vol = []; > cfg.vol.r = 65; I presume that you use "mm" as units? You should also add the center of the sphere, i.e. cfg.vol.o = [0 0 0]; The center of the sphere is by default in the origin, but it is good to be explicit about it. > cfg.bpfilter = 'yes'; > cfg.bpfreq = [1 100]; These settings are _not_ used in SOURCEANALYSIS. > data.avg = squeeze(data.trial{1}); > > source = sourceanalysis(cfg,data); Probably you want to use a protocol like this preprocessing -> timelockanalysis -> sourceanalysis where the preprocessing is done manually (i.e. not in FT). You can do timelockanalysis manually as well, but it is more convenient to use FTs timelockanalysis anyway. The filter options above relate to timelockanalysis. Furthermore, you should use cfg.covariance='yes' in timelockanalysis, and you can specify a covariance latency window. > In this case I used only one trial and the result is a localization > in the center of the sphere ( the source is a dipole simulation, it > was placed on the surface of my spherical model). > Also analyzing over more trials or using different data set, for > example a median nerve stimulation, the result was the same. To me it is not clear where your data comes from (since you include only parts of your script), and therefore it is not clear where your problem stems from. See my suggestions above. Your problem may also be related to plotting the power, and not the neural activity index (source.avg.nai, obtained after SOURCEDESCRIPTIVES), the beamformer power is biuassed to deep locations, the NAI corrects that. See http://www2.ru.nl/fcdonders/fieldtrip/doku.php? id=fieldtrip:documentation:tutorial:beamformer#plot_the_result and further on that page. best regards, Robert From marie at PSY.GLA.AC.UK Tue Nov 7 18:59:48 2006 From: marie at PSY.GLA.AC.UK (Marie Smith) Date: Tue, 7 Nov 2006 17:59:48 +0000 Subject: Meg realign In-Reply-To: Message-ID: Hi, I am trying to use the megrealign function in fieldtrip and get an error from the headsurface function that it cannot find the function retriangulate. I have searched through the Fieldtrip toolbox and this does not appear to be a function that is provided. Can you tell me how to get hold of this function or how to perform the realignment without calling it. Thanks, Marie From r.oostenveld at FCDONDERS.RU.NL Tue Nov 7 20:07:13 2006 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Tue, 7 Nov 2006 20:07:13 +0100 Subject: Meg realign In-Reply-To: <7AF45CEA-EBDB-4C89-BD52-B7B613FE4618@psy.gla.ac.uk> Message-ID: Hi Marie I just checked, retriangulate is at least in the latest version of fieldtrip (in the fieldtrip/private directory, where it also should be). It may be missing from your copy if your copy is old. Please get the latest fieldtrip version from the ftp server. best regards, Robert On 7 Nov 2006, at 18:59, Marie Smith wrote: > Hi, > > I am trying to use the megrealign function in fieldtrip and get an > error from the headsurface function that it cannot find the > function retriangulate. > I have searched through the Fieldtrip toolbox and this does not > appear to be a function that is provided. > > Can you tell me how to get hold of this function or how to perform > the realignment without calling it. > > Thanks, > > Marie From p.cornelissen at PSYCH.YORK.AC.UK Wed Nov 8 15:19:00 2006 From: p.cornelissen at PSYCH.YORK.AC.UK (Piers Cornelissen) Date: Wed, 8 Nov 2006 15:19:00 +0100 Subject: Statistical comparisons in virtual electrode spectrograms Message-ID: Dear all Can anyone advise on the following: I have 6 sets of virtual electrode data (from CTF based MEG recordings) from a total of 9 subjects, each of whom carried out 4 conditions of interest. So far, for each virtual electrode I have succeeded (I hope) in computing group level spectrograms for each condition, where each spectrogram reflects either evoked or evoked+induced power changes. What I would like to do is to a) compare spectrograms, and also b)compute statistics for each group level spectrogram to ask the question whether the power changes in the active window (0 - 700ms) are significantly different from the those in the passive/baseline window (-250 - 0 ms). So far I have had alot of help from Jan, and, on his suggestion, I have copied out my query below, plus provided the matlab scripts which cause the problem: The attached script E_versus_EI.m shows the code for analysing one condition from one particular virtual electrode. This gives the evoked as well as the evoked+induced spectrograms (as far as I understand it). To carry out the comaprison between the evoked versus evoked+Induced test, I thought I should be able to modify the freqgrandaverage step for generating both iefgranfavg and efgrandavg by setting cfg.keepindividual to 'yes'. In doing so, I was hoping that this would retain the 9 separate powerspectra in each case, which it seems to have done. I was then hoping that this would be sufficient input to the second script test_clusrand.m (which is just a minor modification of E_versus_EL.m). Certainly the powspctrm field for each dataset appears as: [4-D double] which I think is correct. However, when I ran clusterrandanalysis on iefgranfavg and efgrandavg, I got the following errors: >> cfg15 = statistic: 'depsamplesT' alphathresh: 0.0500 makeclusters: 'yes' minnbchan: 2 clusterteststat: 'maxsum' onetwo: 'twosided' alpha: 0.0500 nranddraws: 100 channel: {'V0'} >> %cfg15.latency = [0 0.5] % increases sensitivity if prior temporal information is knowm >> cfg15.frequency = [5 40]; >> >> %frange = 'all_freqs'; % file addition for saving >> >> [clusrand] = clusterrandanalysis (cfg15, ind_efgrandavg, ind_iefgrandavg); Selecting and formatting the data. selected 1 channels selected 191 time bins selected 176 frequency bins Calculating the neighbourhood structure of the channels. ??? Error using ==> clusterrandanalysis (getneighbgeometry) Did not find gradiometer or electrode information. Error in ==> /home/willis/plc/matlab/clusterrandanalysis.m On line 473 ==> [cfg,data] = getneighbgeometry(cfg,data,varargin{1}); >> I noticed also that the way I used freqgrandaverage in order to compile the two datasets appeared to throw out the gradiometer information. At least there was a warning to this effect. So, I am guessing that using freqgrandaverage in this way is incorrect. Therefore please could anyone suggest how I compile my 2 sets of nine spectrograms in such a way that they provide appropriate input to clusterrandanalysis. Or, if as Jan seems to suggest, that clusterrandanalysis can't cope with virtual electrode data, does anyone have any other clever solutions. Please! Thanks in anticipation Piers C -------------- next part -------------- A non-text attachment was scrubbed... Name: test_clusrand.m Type: application/octet-stream Size: 4665 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: E_versus_EI.m Type: application/octet-stream Size: 4809 bytes Desc: not available URL: From maris at NICI.RU.NL Wed Nov 8 16:05:53 2006 From: maris at NICI.RU.NL (Eric Maris) Date: Wed, 8 Nov 2006 16:05:53 +0100 Subject: Statistical comparisons in virtual electrode spectrograms In-Reply-To: Message-ID: Hi Piers, I think this is an easy problem to solve. In fact, you are not the first person to stumble over it. The cause of the problem is that freqgrandaverage throws away the gradiometer configurations (the .grad-fields) that are present in each of the subject-specific data structures produced by freqanalysis. The solution is simple: Copy a .grad-field from one subjects (it does not matter which one) to ind_efgrandavg and rerun clusterrandanalysis. In the analysis, this .grad-field is only used to calculate the neighbourhood-structure. Good luck, Eric Maris > -----Original Message----- > From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf Of > Piers Cornelissen > Sent: Wednesday, November 08, 2006 3:19 PM > To: FIELDTRIP at NIC.SURFNET.NL > Subject: [FIELDTRIP] Statistical comparisons in virtual electrode spectrograms > > Dear all > > Can anyone advise on the following: > > I have 6 sets of virtual electrode data (from CTF based MEG recordings) > from a total of 9 subjects, each of whom carried out 4 conditions of > interest. > > So far, for each virtual electrode I have succeeded (I hope) in computing > group level spectrograms for each condition, where each spectrogram > reflects either evoked or evoked+induced power changes. > > What I would like to do is to a) compare spectrograms, and also b)compute > statistics for each group level spectrogram to ask the question whether > the power changes in the active window (0 - 700ms) are significantly > different from the those in the passive/baseline window (-250 - 0 ms). > > So far I have had alot of help from Jan, and, on his suggestion, I have > copied out my query below, plus provided the matlab scripts which cause > the problem: > > The attached script E_versus_EI.m shows the code for > analysing one condition from one particular virtual electrode. This gives > the evoked as well as the evoked+induced spectrograms (as far as I > understand it). > > To carry out the comaprison between the evoked versus evoked+Induced test, > I thought I should be able to modify the freqgrandaverage step for > generating both iefgranfavg and efgrandavg by setting cfg.keepindividual > to 'yes'. In doing so, I was hoping that this would retain the 9 separate > powerspectra in each case, which it seems to have done. I was then hoping > that this would be sufficient input to the second script test_clusrand.m > (which is just a minor modification of E_versus_EL.m). Certainly the > powspctrm field for each dataset appears as: [4-D double] which I think is > correct. > > However, when I ran clusterrandanalysis on iefgranfavg and efgrandavg, I > got the following errors: > > >> > cfg15 = > > statistic: 'depsamplesT' > alphathresh: 0.0500 > makeclusters: 'yes' > minnbchan: 2 > clusterteststat: 'maxsum' > onetwo: 'twosided' > alpha: 0.0500 > nranddraws: 100 > channel: {'V0'} > > >> %cfg15.latency = [0 0.5] % increases sensitivity if prior temporal > information is knowm > >> cfg15.frequency = [5 40]; > >> > >> %frange = 'all_freqs'; % file addition for saving > >> > >> [clusrand] = clusterrandanalysis (cfg15, ind_efgrandavg, > ind_iefgrandavg); > Selecting and formatting the data. > selected 1 channels > selected 191 time bins > selected 176 frequency bins > Calculating the neighbourhood structure of the channels. > ??? Error using ==> clusterrandanalysis (getneighbgeometry) > Did not find gradiometer or electrode information. > > Error in ==> /home/willis/plc/matlab/clusterrandanalysis.m > On line 473 ==> [cfg,data] = getneighbgeometry(cfg,data,varargin{1}); > > >> > > I noticed also that the way I used freqgrandaverage in order to compile > the two datasets appeared to throw out the gradiometer information. At > least there was a warning to this effect. So, I am guessing that using > freqgrandaverage in this way is incorrect. Therefore please could anyone > suggest how I compile my 2 sets of nine spectrograms in such a way that > they provide appropriate input to clusterrandanalysis. Or, if as Jan seems > to suggest, that clusterrandanalysis can't cope with virtual electrode > data, does anyone have any other clever solutions. > > Please! > > Thanks in anticipation > > Piers C > > > > > > From Jan.Schoffelen at FCDONDERS.RU.NL Wed Nov 8 16:15:34 2006 From: Jan.Schoffelen at FCDONDERS.RU.NL (Jan Mathijs Schoffelen) Date: Wed, 8 Nov 2006 16:15:34 +0100 Subject: Statistical comparisons in virtual electrode spectrograms In-Reply-To: <014c01c70347$62b18170$6401a8c0@fcdonders.nl> Message-ID: Hi Piers and Eric, Eric, you're absolutely right in the case one would analyze sensor-data. However, Piers is working on virtual channel data, so the actual neighbourhood structure does not exist at all, and should be defined such that none of the channels actually has a neighbour. Yours, Jan-Mathijs -----Original Message----- From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf Of Eric Maris Sent: Wednesday, November 08, 2006 4:06 PM To: FIELDTRIP at NIC.SURFNET.NL Subject: Re: [FIELDTRIP] Statistical comparisons in virtual electrode spectrograms Hi Piers, I think this is an easy problem to solve. In fact, you are not the first person to stumble over it. The cause of the problem is that freqgrandaverage throws away the gradiometer configurations (the .grad-fields) that are present in each of the subject-specific data structures produced by freqanalysis. The solution is simple: Copy a .grad-field from one subjects (it does not matter which one) to ind_efgrandavg and rerun clusterrandanalysis. In the analysis, this .grad-field is only used to calculate the neighbourhood-structure. Good luck, Eric Maris > -----Original Message----- > From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf Of > Piers Cornelissen > Sent: Wednesday, November 08, 2006 3:19 PM > To: FIELDTRIP at NIC.SURFNET.NL > Subject: [FIELDTRIP] Statistical comparisons in virtual electrode spectrograms > > Dear all > > Can anyone advise on the following: > > I have 6 sets of virtual electrode data (from CTF based MEG recordings) > from a total of 9 subjects, each of whom carried out 4 conditions of > interest. > > So far, for each virtual electrode I have succeeded (I hope) in computing > group level spectrograms for each condition, where each spectrogram > reflects either evoked or evoked+induced power changes. > > What I would like to do is to a) compare spectrograms, and also b)compute > statistics for each group level spectrogram to ask the question whether > the power changes in the active window (0 - 700ms) are significantly > different from the those in the passive/baseline window (-250 - 0 ms). > > So far I have had alot of help from Jan, and, on his suggestion, I have > copied out my query below, plus provided the matlab scripts which cause > the problem: > > The attached script E_versus_EI.m shows the code for > analysing one condition from one particular virtual electrode. This gives > the evoked as well as the evoked+induced spectrograms (as far as I > understand it). > > To carry out the comaprison between the evoked versus evoked+Induced test, > I thought I should be able to modify the freqgrandaverage step for > generating both iefgranfavg and efgrandavg by setting cfg.keepindividual > to 'yes'. In doing so, I was hoping that this would retain the 9 separate > powerspectra in each case, which it seems to have done. I was then hoping > that this would be sufficient input to the second script test_clusrand.m > (which is just a minor modification of E_versus_EL.m). Certainly the > powspctrm field for each dataset appears as: [4-D double] which I think is > correct. > > However, when I ran clusterrandanalysis on iefgranfavg and efgrandavg, I > got the following errors: > > >> > cfg15 = > > statistic: 'depsamplesT' > alphathresh: 0.0500 > makeclusters: 'yes' > minnbchan: 2 > clusterteststat: 'maxsum' > onetwo: 'twosided' > alpha: 0.0500 > nranddraws: 100 > channel: {'V0'} > > >> %cfg15.latency = [0 0.5] % increases sensitivity if prior temporal > information is knowm > >> cfg15.frequency = [5 40]; > >> > >> %frange = 'all_freqs'; % file addition for saving > >> > >> [clusrand] = clusterrandanalysis (cfg15, ind_efgrandavg, > ind_iefgrandavg); > Selecting and formatting the data. > selected 1 channels > selected 191 time bins > selected 176 frequency bins > Calculating the neighbourhood structure of the channels. > ??? Error using ==> clusterrandanalysis (getneighbgeometry) > Did not find gradiometer or electrode information. > > Error in ==> /home/willis/plc/matlab/clusterrandanalysis.m > On line 473 ==> [cfg,data] = getneighbgeometry(cfg,data,varargin{1}); > > >> > > I noticed also that the way I used freqgrandaverage in order to compile > the two datasets appeared to throw out the gradiometer information. At > least there was a warning to this effect. So, I am guessing that using > freqgrandaverage in this way is incorrect. Therefore please could anyone > suggest how I compile my 2 sets of nine spectrograms in such a way that > they provide appropriate input to clusterrandanalysis. Or, if as Jan seems > to suggest, that clusterrandanalysis can't cope with virtual electrode > data, does anyone have any other clever solutions. > > Please! > > Thanks in anticipation > > Piers C > > > > > > From maris at NICI.RU.NL Wed Nov 8 16:26:28 2006 From: maris at NICI.RU.NL (Eric Maris) Date: Wed, 8 Nov 2006 16:26:28 +0100 Subject: Statistical comparisons in virtual electrode spectrograms In-Reply-To: Message-ID: Hi Piers, In my first reply to your email, I didn't notice that you were analyzing virtual channels. In that case, the suggestion in my previous email will not work. As I see it now, you have only a single virtual channel. In other words, you do not have a spatial dimension in your data. Nevertheless, clusterrandanalysis wants a spatial neighbourhood structure. In the case of virtual channels, you have to construct this neighbourhood structure by hand. Read the help info of clusterrandanalysis, and you will find out how to specify a neighbourhood structure as a cell array (in your case, of length 1) of structs. I also read that you want to compare evoked and (evoked + induced) power spectra. Are these power spectra calculated on the same raw data? If this is the case, does it make sense to test the null hypothesis that they come from the same probability distribution (which is what clusterrandanalysis tests)? This null hypothesis would imply that the pure induced power spectra are zero. Do I see this correctly? Greetings, Eric > -----Original Message----- > From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf Of > Piers Cornelissen > Sent: Wednesday, November 08, 2006 3:19 PM > To: FIELDTRIP at NIC.SURFNET.NL > Subject: [FIELDTRIP] Statistical comparisons in virtual electrode spectrograms > > Dear all > > Can anyone advise on the following: > > I have 6 sets of virtual electrode data (from CTF based MEG recordings) > from a total of 9 subjects, each of whom carried out 4 conditions of > interest. > > So far, for each virtual electrode I have succeeded (I hope) in computing > group level spectrograms for each condition, where each spectrogram > reflects either evoked or evoked+induced power changes. > > What I would like to do is to a) compare spectrograms, and also b)compute > statistics for each group level spectrogram to ask the question whether > the power changes in the active window (0 - 700ms) are significantly > different from the those in the passive/baseline window (-250 - 0 ms). > > So far I have had alot of help from Jan, and, on his suggestion, I have > copied out my query below, plus provided the matlab scripts which cause > the problem: > > The attached script E_versus_EI.m shows the code for > analysing one condition from one particular virtual electrode. This gives > the evoked as well as the evoked+induced spectrograms (as far as I > understand it). > > To carry out the comaprison between the evoked versus evoked+Induced test, > I thought I should be able to modify the freqgrandaverage step for > generating both iefgranfavg and efgrandavg by setting cfg.keepindividual > to 'yes'. In doing so, I was hoping that this would retain the 9 separate > powerspectra in each case, which it seems to have done. I was then hoping > that this would be sufficient input to the second script test_clusrand.m > (which is just a minor modification of E_versus_EL.m). Certainly the > powspctrm field for each dataset appears as: [4-D double] which I think is > correct. > > However, when I ran clusterrandanalysis on iefgranfavg and efgrandavg, I > got the following errors: > > >> > cfg15 = > > statistic: 'depsamplesT' > alphathresh: 0.0500 > makeclusters: 'yes' > minnbchan: 2 > clusterteststat: 'maxsum' > onetwo: 'twosided' > alpha: 0.0500 > nranddraws: 100 > channel: {'V0'} > > >> %cfg15.latency = [0 0.5] % increases sensitivity if prior temporal > information is knowm > >> cfg15.frequency = [5 40]; > >> > >> %frange = 'all_freqs'; % file addition for saving > >> > >> [clusrand] = clusterrandanalysis (cfg15, ind_efgrandavg, > ind_iefgrandavg); > Selecting and formatting the data. > selected 1 channels > selected 191 time bins > selected 176 frequency bins > Calculating the neighbourhood structure of the channels. > ??? Error using ==> clusterrandanalysis (getneighbgeometry) > Did not find gradiometer or electrode information. > > Error in ==> /home/willis/plc/matlab/clusterrandanalysis.m > On line 473 ==> [cfg,data] = getneighbgeometry(cfg,data,varargin{1}); > > >> > > I noticed also that the way I used freqgrandaverage in order to compile > the two datasets appeared to throw out the gradiometer information. At > least there was a warning to this effect. So, I am guessing that using > freqgrandaverage in this way is incorrect. Therefore please could anyone > suggest how I compile my 2 sets of nine spectrograms in such a way that > they provide appropriate input to clusterrandanalysis. Or, if as Jan seems > to suggest, that clusterrandanalysis can't cope with virtual electrode > data, does anyone have any other clever solutions. > > Please! > > Thanks in anticipation > > Piers C > > > > > > From p.cornelissen at PSYCH.YORK.AC.UK Wed Nov 8 16:42:51 2006 From: p.cornelissen at PSYCH.YORK.AC.UK (Piers Cornelissen) Date: Wed, 8 Nov 2006 15:42:51 +0000 Subject: Statistical comparisons in virtual electrode spectrograms In-Reply-To: <015001c7034a$42919990$6401a8c0@fcdonders.nl> Message-ID: Dear Eric thanks for your thoughts. I would like to try: "a neighbourhood structure as a cell array (in your case, of length 1) of structs". But could you clarify a little more what the syntax would be for this cfg? Re- the hypothesis tests, when I put the script together I hadn't really thought through the hypothesis testing carefully. I was just trying to get something to work at all. But you are quite right, it doesn't make sense to statistically compare E versus E+I However, I do want to apply a test, separately, for E baseline v E active, *and* E+I baseline versus E+I active. Might it make sense, do you think, to compare ([E+I]-E) baseline versus ([E+I]-E) active, to try to work out whether there is indeed any significant induced activity? Best regards Piers > Hi Piers, > > > > In my first reply to your email, I didn't notice that you were analyzing > virtual channels. In that case, the suggestion in my previous email will not > work. As I see it now, you have only a single virtual channel. In other > words, you do not have a spatial dimension in your data. Nevertheless, > clusterrandanalysis wants a spatial neighbourhood structure. In the case of > virtual channels, you have to construct this neighbourhood structure by > hand. Read the help info of clusterrandanalysis, and you will find out how > to specify a neighbourhood structure as a cell array (in your case, of > length 1) of structs. > > I also read that you want to compare evoked and (evoked + induced) power > spectra. Are these power spectra calculated on the same raw data? If this is > the case, does it make sense to test the null hypothesis that they come from > the same probability distribution (which is what clusterrandanalysis tests)? > This null hypothesis would imply that the pure induced power spectra are > zero. Do I see this correctly? > > > Greetings, > > Eric > > > > >> -----Original Message----- >> From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On >> > Behalf Of > >> Piers Cornelissen >> Sent: Wednesday, November 08, 2006 3:19 PM >> To: FIELDTRIP at NIC.SURFNET.NL >> Subject: [FIELDTRIP] Statistical comparisons in virtual electrode >> > spectrograms > >> Dear all >> >> Can anyone advise on the following: >> >> I have 6 sets of virtual electrode data (from CTF based MEG recordings) >> from a total of 9 subjects, each of whom carried out 4 conditions of >> interest. >> >> So far, for each virtual electrode I have succeeded (I hope) in computing >> group level spectrograms for each condition, where each spectrogram >> reflects either evoked or evoked+induced power changes. >> >> What I would like to do is to a) compare spectrograms, and also b)compute >> statistics for each group level spectrogram to ask the question whether >> the power changes in the active window (0 - 700ms) are significantly >> different from the those in the passive/baseline window (-250 - 0 ms). >> >> So far I have had alot of help from Jan, and, on his suggestion, I have >> copied out my query below, plus provided the matlab scripts which cause >> the problem: >> >> The attached script E_versus_EI.m shows the code for >> analysing one condition from one particular virtual electrode. This gives >> the evoked as well as the evoked+induced spectrograms (as far as I >> understand it). >> >> To carry out the comaprison between the evoked versus evoked+Induced test, >> I thought I should be able to modify the freqgrandaverage step for >> generating both iefgranfavg and efgrandavg by setting cfg.keepindividual >> to 'yes'. In doing so, I was hoping that this would retain the 9 separate >> powerspectra in each case, which it seems to have done. I was then hoping >> that this would be sufficient input to the second script test_clusrand.m >> (which is just a minor modification of E_versus_EL.m). Certainly the >> powspctrm field for each dataset appears as: [4-D double] which I think is >> correct. >> >> However, when I ran clusterrandanalysis on iefgranfavg and efgrandavg, I >> got the following errors: >> >> >> cfg15 = >> >> statistic: 'depsamplesT' >> alphathresh: 0.0500 >> makeclusters: 'yes' >> minnbchan: 2 >> clusterteststat: 'maxsum' >> onetwo: 'twosided' >> alpha: 0.0500 >> nranddraws: 100 >> channel: {'V0'} >> >> >>>> %cfg15.latency = [0 0.5] % increases sensitivity if prior temporal >>>> >> information is knowm >> >>>> cfg15.frequency = [5 40]; >>>> >>>> %frange = 'all_freqs'; % file addition for saving >>>> >>>> [clusrand] = clusterrandanalysis (cfg15, ind_efgrandavg, >>>> >> ind_iefgrandavg); >> Selecting and formatting the data. >> selected 1 channels >> selected 191 time bins >> selected 176 frequency bins >> Calculating the neighbourhood structure of the channels. >> ??? Error using ==> clusterrandanalysis (getneighbgeometry) >> Did not find gradiometer or electrode information. >> >> Error in ==> /home/willis/plc/matlab/clusterrandanalysis.m >> On line 473 ==> [cfg,data] = getneighbgeometry(cfg,data,varargin{1}); >> >> >> I noticed also that the way I used freqgrandaverage in order to compile >> the two datasets appeared to throw out the gradiometer information. At >> least there was a warning to this effect. So, I am guessing that using >> freqgrandaverage in this way is incorrect. Therefore please could anyone >> suggest how I compile my 2 sets of nine spectrograms in such a way that >> they provide appropriate input to clusterrandanalysis. Or, if as Jan seems >> to suggest, that clusterrandanalysis can't cope with virtual electrode >> data, does anyone have any other clever solutions. >> >> Please! >> >> Thanks in anticipation >> >> Piers C >> >> >> >> >> >> >> > > > > From maris at NICI.RU.NL Wed Nov 8 16:54:58 2006 From: maris at NICI.RU.NL (Eric Maris) Date: Wed, 8 Nov 2006 16:54:58 +0100 Subject: Statistical comparisons in virtual electrode spectrograms In-Reply-To: <4551FAFB.5070801@psych.york.ac.uk> Message-ID: Hi Piers, > I would like to try: "a neighbourhood structure as a cell array (in your > case, of length 1) of structs". But could you clarify a little more what > the syntax would be for this cfg? Type "Help clusterrandanalysis" on the Matlab command line. > Re- the hypothesis tests, when I put the script together I hadn't really > thought through the hypothesis testing carefully. I was just trying to > get something to work at all. > > But you are quite right, it doesn't make sense to statistically compare > E versus E+I > > However, I do want to apply a test, separately, for E baseline v E > active, *and* E+I baseline versus E+I active. > > Might it make sense, do you think, to compare ([E+I]-E) baseline versus > ([E+I]-E) active, to try to work out whether there is indeed any > significant induced activity? I think this makes sense. For activation-versus-baseline testing, you better use the activation-versus-baseline t-statistic instead of the dependent-samples t-statistic. Greetings, Eric > > Best regards > > Piers > > Hi Piers, > > > > > > > > In my first reply to your email, I didn't notice that you were analyzing > > virtual channels. In that case, the suggestion in my previous email will not > > work. As I see it now, you have only a single virtual channel. In other > > words, you do not have a spatial dimension in your data. Nevertheless, > > clusterrandanalysis wants a spatial neighbourhood structure. In the case of > > virtual channels, you have to construct this neighbourhood structure by > > hand. Read the help info of clusterrandanalysis, and you will find out how > > to specify a neighbourhood structure as a cell array (in your case, of > > length 1) of structs. > > > > I also read that you want to compare evoked and (evoked + induced) power > > spectra. Are these power spectra calculated on the same raw data? If this is > > the case, does it make sense to test the null hypothesis that they come from > > the same probability distribution (which is what clusterrandanalysis tests)? > > This null hypothesis would imply that the pure induced power spectra are > > zero. Do I see this correctly? > > > > > > Greetings, > > > > Eric > > > > > > > > > >> -----Original Message----- > >> From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On > >> > > Behalf Of > > > >> Piers Cornelissen > >> Sent: Wednesday, November 08, 2006 3:19 PM > >> To: FIELDTRIP at NIC.SURFNET.NL > >> Subject: [FIELDTRIP] Statistical comparisons in virtual electrode > >> > > spectrograms > > > >> Dear all > >> > >> Can anyone advise on the following: > >> > >> I have 6 sets of virtual electrode data (from CTF based MEG recordings) > >> from a total of 9 subjects, each of whom carried out 4 conditions of > >> interest. > >> > >> So far, for each virtual electrode I have succeeded (I hope) in computing > >> group level spectrograms for each condition, where each spectrogram > >> reflects either evoked or evoked+induced power changes. > >> > >> What I would like to do is to a) compare spectrograms, and also b)compute > >> statistics for each group level spectrogram to ask the question whether > >> the power changes in the active window (0 - 700ms) are significantly > >> different from the those in the passive/baseline window (-250 - 0 ms). > >> > >> So far I have had alot of help from Jan, and, on his suggestion, I have > >> copied out my query below, plus provided the matlab scripts which cause > >> the problem: > >> > >> The attached script E_versus_EI.m shows the code for > >> analysing one condition from one particular virtual electrode. This gives > >> the evoked as well as the evoked+induced spectrograms (as far as I > >> understand it). > >> > >> To carry out the comaprison between the evoked versus evoked+Induced test, > >> I thought I should be able to modify the freqgrandaverage step for > >> generating both iefgranfavg and efgrandavg by setting cfg.keepindividual > >> to 'yes'. In doing so, I was hoping that this would retain the 9 separate > >> powerspectra in each case, which it seems to have done. I was then hoping > >> that this would be sufficient input to the second script test_clusrand.m > >> (which is just a minor modification of E_versus_EL.m). Certainly the > >> powspctrm field for each dataset appears as: [4-D double] which I think is > >> correct. > >> > >> However, when I ran clusterrandanalysis on iefgranfavg and efgrandavg, I > >> got the following errors: > >> > >> > >> cfg15 = > >> > >> statistic: 'depsamplesT' > >> alphathresh: 0.0500 > >> makeclusters: 'yes' > >> minnbchan: 2 > >> clusterteststat: 'maxsum' > >> onetwo: 'twosided' > >> alpha: 0.0500 > >> nranddraws: 100 > >> channel: {'V0'} > >> > >> > >>>> %cfg15.latency = [0 0.5] % increases sensitivity if prior temporal > >>>> > >> information is knowm > >> > >>>> cfg15.frequency = [5 40]; > >>>> > >>>> %frange = 'all_freqs'; % file addition for saving > >>>> > >>>> [clusrand] = clusterrandanalysis (cfg15, ind_efgrandavg, > >>>> > >> ind_iefgrandavg); > >> Selecting and formatting the data. > >> selected 1 channels > >> selected 191 time bins > >> selected 176 frequency bins > >> Calculating the neighbourhood structure of the channels. > >> ??? Error using ==> clusterrandanalysis (getneighbgeometry) > >> Did not find gradiometer or electrode information. > >> > >> Error in ==> /home/willis/plc/matlab/clusterrandanalysis.m > >> On line 473 ==> [cfg,data] = getneighbgeometry(cfg,data,varargin{1}); > >> > >> > >> I noticed also that the way I used freqgrandaverage in order to compile > >> the two datasets appeared to throw out the gradiometer information. At > >> least there was a warning to this effect. So, I am guessing that using > >> freqgrandaverage in this way is incorrect. Therefore please could anyone > >> suggest how I compile my 2 sets of nine spectrograms in such a way that > >> they provide appropriate input to clusterrandanalysis. Or, if as Jan seems > >> to suggest, that clusterrandanalysis can't cope with virtual electrode > >> data, does anyone have any other clever solutions. > >> > >> Please! > >> > >> Thanks in anticipation > >> > >> Piers C > >> > >> > >> > >> > >> > >> > >> > > > > > > > > From lorina_naci at YAHOO.CO.UK Wed Nov 8 20:00:27 2006 From: lorina_naci at YAHOO.CO.UK (Lorina Naci) Date: Wed, 8 Nov 2006 19:00:27 +0000 Subject: Within-subject coherence statististics for virtual sources In-Reply-To: <004601c6f770$c7297aa0$902dae83@fcdonders.nl> Message-ID: Dear Jan-Mathijs, Thank you for the detailed help in your previous message. >For the time being, I assume that you have your data imported into a fieldtrip-like >format, using besa2fieldtrip. I am not familiar with this function, but when I read the >help of besa2fieldtrip I guess that your besa file was a .tfc file. So probably your >data-object looks like what fieldtrip considers to be a frequency-structure, containing >a TFR for each ROI. I guess you have two data-objects for each subject. One clarification: yes, i do have two data-object (or .tfc files) for each subject, one for each condition, but there are two types of .tfc files that I could use: either the raw time-frequency data for each condition, or the statistically analysed time-frequency data for that condition. BESA saves both of these as .tfc files. At the moment I am using the raw TFR data. I tried to run the script as you suggested but it did not work. The error message I get is to do with [stat] = statistics_wrapper(cfg, varargin{:}). It just gives me an error message pointing to this line,saying: error using fieldtrip-20061003/private/statistics_wrapper, could not determine the type of input data. Also, the function 'cfg.numrandomization' requires a number, but I am not sure what the choice of the number depends on? I've inputed 500 as in the documentation example. Finally, at risk making my ignorance of how Fieldtrip works entirely transparent, I am not quite sure how the function you send me 'statfun_diff.m' links with the 'freqstatistics.m,' and whether I do need to use it? I would greatly appreciate any help with this, Many thanks, Lorina Jan Mathijs Schoffelen wrote: v\:* {behavior:url(#default#VML);} o\:* {behavior:url(#default#VML);} w\:* {behavior:url(#default#VML);} .shape {behavior:url(#default#VML);} st1\:*{behavior:url(#default#ieooui) } Dear Lorina, For the time being, I assume that you have your data imported into a fieldtrip-like format, using besa2fieldtrip. I am not familiar with this function, but when I read the help of besa2fieldtrip I guess that your besa file was a .tfc file. So probably your data-object looks like what fieldtrip considers to be a frequency-structure, containing a TFR for each ROI. I guess you have two data-objects for each subject. What you would like to do is possible within fieldtrip, but I would advise you not to use clusterrandanalysis to get there. Quite some correspondence has been devoted to the new statistical interface, you can read about it on the discussion list’s website (follow the appropriate links on the fieldtrip website), concerning Re: clusterrandanalysis on scalar values + problem with topoplotER during the past month, but which started in August. In a nutshell: instead of using clusterrandanalysis you could use freqstatistics (under the above assumption that your data resembles a fieldtrip-frequency structure) with the appropriate settings to get your statistics done. Freqstatistics relies on statistics_montecarlo, when you specify cfg.method = ‘montecarlo’. Please have a try following the thread on the discussion list, and the following configuration settings, as well as the information in statistics_montecarlo and other dependent functions. You’ll probably need the attached function as well, which computes your statistic of interest. Cfg = []; Cfg.method = ‘montecarlo’; Cfg.statistic = ‘diff’; Cfg.parameter = ‘cohspctrm’; %This is at least what I expect your data objects to contain! Cfg.numrandomization = a number; Cfg.design = [1 1 2 2 3 3 with all the numbers in between 14 14; 1 2 1 2 1 2 with all the numbers in between 1 2]; %this specifies how the data has to be interpreted Cfg.ivar = 2; %row-index of independent variable, which is the condition in your case Cfg.uvar = 1; %row-index of the ‘unit’-variable, your unit of observation, which are your individual subjects. %the design-matrix will be shuffled, by swapping the 1 and 2’s in the ivar-row, while keeping the uvar-doublets together. Cfg.correctm = ‘yes’; %keep it at this for the time being, we have to develop a cunning strategy to incorporate something about the neighbourhood structure of your ROIs %as soon as you get your script running, you can try to incorporate fancy multiple-comparison correction strategies, such as clustering in time and frequency. Stat = freqstatistics(cfg, subj1cond1, subj1cond2, subj2cond1, subj2cond2 .); %take care that this corresponds with how you specified your design. Subjxconx should then be the data-structure containing your TFRs in a field called cohspctrm. I hope this puts you on track, Yours, Jan-Mathijs --------------------------------- From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf Of Lorina Naci Sent: Monday, October 23, 2006 7:18 PM To: FIELDTRIP at NIC.SURFNET.NL Subject: [FIELDTRIP] Within-subject coherence statististics for virtual sources Dear FIELDTRIP members, I have used BESA to perform source coherence calculations for a multiple-subject/multiple-condition experiment. I have 14 subjects, and 2 conditions for which I’d like to compare coherence values. I have calculated coherence values in the Time-Frequency domain for each person. Given that BESA cannot calculate statistics in a multiple-subject study, their support personnel directed me towards FieldTrip. I would like to use your existing script ‘clusterrandanalysis on TFRs of power that were computed with BESA,’ but I cannot relate this to my data as the coherence values have been calculated for ROI sources, (8 per hemisphere - 16 sources total), and not for electrodes (I had 128). Do you have any advice regarding how I may adopt the script to for source coherence as opposed to electrode coherence? How do I import the source locations? Many thanks is advance for your help, Lorina Send instant messages to your online friends http://uk.messenger.yahoo.com --------------------------------- The all-new Yahoo! Mail goes wherever you go - free your email address from your Internet provider. -------------- next part -------------- An HTML attachment was scrubbed... URL: From r.oostenveld at FCDONDERS.RU.NL Wed Nov 8 21:17:53 2006 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Wed, 8 Nov 2006 21:17:53 +0100 Subject: Within-subject coherence statististics for virtual sources In-Reply-To: <20061108190027.45562.qmail@web28110.mail.ukl.yahoo.com> Message-ID: Hi Lorina On 8 Nov 2006, at 20:00, Lorina Naci wrote: > I tried to run the script as you suggested but it did not work. The > error message I get is to do with > [stat] = statistics_wrapper(cfg, varargin{:}). It just gives me an > error message pointing to this line,saying: error using > fieldtrip-20061003/private/statistics_wrapper, could not determine > the type of input data. Then it means that the data structure that you have obtained from besa2fieldtrip is not recognized. It is also not clear to me how your data looks like (i.e. as a Matlab structure). It is virtual channel data, time-frequency analyzed, and then single trial coherences computed? Could you show the output that you get on screen after dataA = besa2fieldtrip('filenameA.tfc') % i.e. without semicolon, to show the output on screen dataB = besa2fieldtrip('filenameB.tfc') % i.e. without semicolon, to show the output on screen > Also, the function 'cfg.numrandomization' requires a number, but I > am not sure what the choice of the number depends on? I've inputed > 500 as in the documentation example. That is the number of resamplings that is used to construct the reference distribution, 500 should be fine. > Finally, at risk making my ignorance of how Fieldtrip works > entirely transparent, I am not quite sure how the function you send > me 'statfun_diff.m' links with the 'freqstatistics.m,' and whether > I do need to use it? You just have to put it on your Matlab path somewhere, and you specify cfg.statistic ='diff' in freqstatistics. In general by specifying cfg.statistic='xxx', the function statfun_xxx will be called. Please look in the function statfun_diff.m to see how the statistic for each sample (=time- frequency-channel point) is computed. best regards, Robert From Brian.Roach at YALE.EDU Wed Nov 8 21:20:10 2006 From: Brian.Roach at YALE.EDU (Brian Roach) Date: Wed, 8 Nov 2006 15:20:10 -0500 Subject: freqanalysis_wltconvol.m question Message-ID: Hi, In the freqanalysis_wltconvol.m function, the FFT of zero-padded eeg or MEG data and the FFT of the wavelets at various frequencies of interest are convolved and the inverse FFT of that result is used to calculate power in this manner on line 283: powdum = (2.* abs(autspctrmacttap) ./ data.fsample) .^ 2; here, autspctrmacttap corresponds to the complex output from the call to ifft. In previous e-mail Jan-Mathijs has mentioned that the abs of the complex data gets you amplitude, so I am wondering why it gets multiplied by 2 and divided by the sampling rate before being squared since power = amplitude^2. I am wondering how important it is to multiply by 2 and divide by the AD rate because I would like to take this complex output and use it to calculate phase-locking factor, but I am not sure what parts of the power transformation need to be removed - just the abs() and the squaring? Clarification of this line of code would be extremely helpful to me. Thanks, Brian -------------- next part -------------- An HTML attachment was scrubbed... URL: From r.oostenveld at FCDONDERS.RU.NL Wed Nov 8 22:56:46 2006 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Wed, 8 Nov 2006 22:56:46 +0100 Subject: freqanalysis_wltconvol.m question In-Reply-To: <6.1.2.0.2.20061108143858.05b15ec0@email.med.yale.edu> Message-ID: Hi Brian On 8 Nov 2006, at 21:20, Brian Roach wrote: > eI would like to take this complex output and use it to calculate > phase-locking factor, but I am not sure what parts of the power > transformation need to be removed - just the abs() and the > squaring? Clarification of this line of code would be extremely > helpful to me. You can use the existing code for that: For computing the phase-locking value I suggest that you use either cfg.output='fourier' cfg.keeptrials='yes' cfg.keeptapers='yes' or cfg.output='fourier' cfg.keeptrials='yes' cfg.keeptapers='no' (not needed now) cfg.channelcmb = something, see the help in freqanalysis. Subsequently, use the option cfg.cohmethod='plv' in freqdescriptives. In case of fourier output in freqanalysis, you should specify the channel combinations here. ... Looking back at your previous mail, I see that you mean ITC and not PLV. The stuff above then does not apply. You can do output=fourier in freqanalysis and work manually on the output freq structure. I think that this should work magnitude = abs(freq.fourierspctrm); scaled = freq.fourierspctrm ./ magnitude; freq.itcspctrm = mean(scaled, 1); freq = rmfield(freq, 'fourierspctrm'); % remove the single fourierspectrum, to avoid confusion freq.dimord = 'chan_freq_time'; % remove the rpt or rpttap dimension best regards, Robert From Brian.Roach at YALE.EDU Wed Nov 8 23:12:49 2006 From: Brian.Roach at YALE.EDU (Brian Roach) Date: Wed, 8 Nov 2006 17:12:49 -0500 Subject: freqanalysis_wltconvol.m question In-Reply-To: <48D89F70-A97D-48F6-800A-2FE2A854C0D9@fcdonders.ru.nl> Message-ID: Robert, Thanks for your quick reply. I did not realize that freqanalysis_wltconvol.m allowed for 'fourier' output, but maybe I need to download the latest version. Or, do you mean I should use freqanalysis_mtm instead? Also, how does ITC differ from phase-locking value? I thought they were the same measure. At 04:56 PM 11/8/2006, you wrote: >Hi Brian > >On 8 Nov 2006, at 21:20, Brian Roach wrote: >>eI would like to take this complex output and use it to calculate >>phase-locking factor, but I am not sure what parts of the power >>transformation need to be removed - just the abs() and the >>squaring? Clarification of this line of code would be extremely >>helpful to me. > >You can use the existing code for that: > >For computing the phase-locking value I suggest that you use either > cfg.output='fourier' > cfg.keeptrials='yes' > cfg.keeptapers='yes' >or > cfg.output='fourier' > cfg.keeptrials='yes' > cfg.keeptapers='no' (not needed now) > cfg.channelcmb = something, see the help >in freqanalysis. > >Subsequently, use the option > cfg.cohmethod='plv' >in freqdescriptives. In case of fourier output in freqanalysis, you >should specify the channel combinations here. > >... >Looking back at your previous mail, I see that you mean ITC and not >PLV. The stuff above then does not apply. You can do output=fourier >in freqanalysis and work manually on the output freq structure. I >think that this should work > >magnitude = abs(freq.fourierspctrm); >scaled = freq.fourierspctrm ./ magnitude; >freq.itcspctrm = mean(scaled, 1); >freq = rmfield(freq, 'fourierspctrm'); % remove the single >fourierspectrum, to avoid confusion >freq.dimord = 'chan_freq_time'; % remove the rpt or rpttap >dimension > >best regards, >Robert > From abastos at BERKELEY.EDU Wed Nov 8 23:11:04 2006 From: abastos at BERKELEY.EDU (Andre Bastos) Date: Wed, 8 Nov 2006 14:11:04 -0800 Subject: another coherence question In-Reply-To: <006a01c70348$bd278180$902dae83@fcdonders.nl> Message-ID: Hello Everyone, So I am trying to do a simple coherence measure between a single electrode pair, PO3 and Cz. It seems like the computations are running, fine, the problem is in trying to use singleplotER to visualize the results, which always fails with the following error: Error using ==> plot, Vectors must be the same lengths. Error in ==> singleplotER at 287 plot(varargin{k-1}.(cfg.xparam), P, style); My cfg structure looks like this: cfg = zparam = 'plvspctrm'; xlim = [5 100]; cohrefchannel = 'Cz'; channel = 'PO3'; The data were first run through the scalpcurrentdensity function using the 'finite' method, then time frequency analysis was compute in frequencies 1-100 using the 'mtmconvol' method with 'powandcsd' output, using the channel = {'PO3' 'PO4' 'Cz'}, with channelcmb set to {'PO3' 'Cz'; 'PO4' 'Cz'}. Then I called freqdescriptives using cohmethod = 'plv'. The returned data structure definetly has coherence data in it, and has a .plvspctrm field which is 2x100x61, channelcmb x freqs x time. Ive looked at the data and it seems to make sense, it has numbers that range from 0 to 0.5, so it seems like the plot function is really whats giving me trouble. Any words of wisdom? Thank You in advance, Andre Bastos Robertson Lab, UC Berkeley From Jan.Schoffelen at FCDONDERS.RU.NL Thu Nov 9 10:10:53 2006 From: Jan.Schoffelen at FCDONDERS.RU.NL (Jan Mathijs Schoffelen) Date: Thu, 9 Nov 2006 10:10:53 +0100 Subject: freqanalysis_wltconvol.m question In-Reply-To: <6.1.2.0.2.20061108143858.05b15ec0@email.med.yale.edu> Message-ID: Hi Brian, The multiplication with 2 and the division by the sampling rate achieves a proper normalization and should be included. The factor 2 is coming from the fact that the power at a specific frequency is estimated at both the frequency itself and its negative counterpart. The division by the number of samples ensures that the total power (summed across all computable frequencies, so between 0 and Nyquist) will be equal to the total variance of the time-domain signal. Yours, Jan-Mathijs _____ From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf Of Brian Roach Sent: Wednesday, November 08, 2006 9:20 PM To: FIELDTRIP at NIC.SURFNET.NL Subject: [FIELDTRIP] freqanalysis_wltconvol.m question Hi, In the freqanalysis_wltconvol.m function, the FFT of zero-padded eeg or MEG data and the FFT of the wavelets at various frequencies of interest are convolved and the inverse FFT of that result is used to calculate power in this manner on line 283: powdum = (2.* abs(autspctrmacttap) ./ data.fsample) .^ 2; here, autspctrmacttap corresponds to the complex output from the call to ifft. In previous e-mail Jan-Mathijs has mentioned that the abs of the complex data gets you amplitude, so I am wondering why it gets multiplied by 2 and divided by the sampling rate before being squared since power = amplitude^2. I am wondering how important it is to multiply by 2 and divide by the AD rate because I would like to take this complex output and use it to calculate phase-locking factor, but I am not sure what parts of the power transformation need to be removed - just the abs() and the squaring? Clarification of this line of code would be extremely helpful to me. Thanks, Brian -------------- next part -------------- An HTML attachment was scrubbed... URL: From Jan.Schoffelen at FCDONDERS.RU.NL Thu Nov 9 10:37:50 2006 From: Jan.Schoffelen at FCDONDERS.RU.NL (Jan Mathijs Schoffelen) Date: Thu, 9 Nov 2006 10:37:50 +0100 Subject: freqanalysis_wltconvol.m question In-Reply-To: <6.1.2.0.2.20061108170420.05a7e2d8@email.med.yale.edu> Message-ID: Dear Brian, Freqanalysis_wltconvol does not support fourier as an output. However, since wavelet-analysis and fft's in the end are about the same thingy, you could use freqanalysis_mtmconvol to achieve your goal. There is a tutorial on the fieldtrip-website which deals with this function, and uses it in a way that it resembles a wavelet-analysis, in which the time-frequency resolution is treated in the same way as with standard wavelet-analysis. Phase-locking-value is defined in fieldtrip as a bivariate-measure, so that means that it quantifies how consistent the phase-relation between two channels is across trials. Inter-trial coherence is a bit an odd thingy, because the term coherence suggests something bivariate, but the way you would like to use it, is essentially univariate. You want to estimate how consistent the phase of the oscillations at a particular channel is across trials. However, both measures use similar math. In fact, when you create a dummy-fourier-channel you can use the plv-option to obtain your 'itc'. This is because in this situation, the mathematics become identical. I would advise it like this: Do your freqanalysis as Robert suggested in one of his previous mails (see below (cfg.keeptapers = 'yes')). Then create a dummy channel: dim = size(freq.fourierspctrm; freq.fourierspctrm(:,end+1,:,:) = ones(dim([1 3 4])); freq.label = 'dummy'; cfg = []; cfg.cohmethod = 'plv'; cfg.channelcmb = channelcombination({'dummy' 'all'}, freq.label); %should work itc = freqdescriptives(cfg, freq); Your 'itc' now is contained in the field itc.cohspctrm; The check whether this is correctly done is done outside fieldtrip: itc2 = abs(mean(freq.fourierspctrm./abs(freq.fourierspctrm),1)); Yours, Jan-Mathijs -----Original Message----- From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf Of Brian Roach Sent: Wednesday, November 08, 2006 11:13 PM To: FIELDTRIP at NIC.SURFNET.NL Subject: Re: [FIELDTRIP] freqanalysis_wltconvol.m question Robert, Thanks for your quick reply. I did not realize that freqanalysis_wltconvol.m allowed for 'fourier' output, but maybe I need to download the latest version. Or, do you mean I should use freqanalysis_mtm instead? Also, how does ITC differ from phase-locking value? I thought they were the same measure. At 04:56 PM 11/8/2006, you wrote: >Hi Brian > >On 8 Nov 2006, at 21:20, Brian Roach wrote: >>eI would like to take this complex output and use it to calculate >>phase-locking factor, but I am not sure what parts of the power >>transformation need to be removed - just the abs() and the >>squaring? Clarification of this line of code would be extremely >>helpful to me. > >You can use the existing code for that: > >For computing the phase-locking value I suggest that you use either > cfg.output='fourier' > cfg.keeptrials='yes' > cfg.keeptapers='yes' >or > cfg.output='fourier' > cfg.keeptrials='yes' > cfg.keeptapers='no' (not needed now) > cfg.channelcmb = something, see the help >in freqanalysis. > >Subsequently, use the option > cfg.cohmethod='plv' >in freqdescriptives. In case of fourier output in freqanalysis, you >should specify the channel combinations here. > >... >Looking back at your previous mail, I see that you mean ITC and not >PLV. The stuff above then does not apply. You can do output=fourier >in freqanalysis and work manually on the output freq structure. I >think that this should work > >magnitude = abs(freq.fourierspctrm); >scaled = freq.fourierspctrm ./ magnitude; >freq.itcspctrm = mean(scaled, 1); >freq = rmfield(freq, 'fourierspctrm'); % remove the single >fourierspectrum, to avoid confusion >freq.dimord = 'chan_freq_time'; % remove the rpt or rpttap >dimension > >best regards, >Robert > From Jan.Schoffelen at FCDONDERS.RU.NL Thu Nov 9 10:41:53 2006 From: Jan.Schoffelen at FCDONDERS.RU.NL (Jan Mathijs Schoffelen) Date: Thu, 9 Nov 2006 10:41:53 +0100 Subject: another coherence question In-Reply-To: <38381.128.32.103.8.1163023864.squirrel@calmail.berkeley.edu> Message-ID: Dear Andre, The xparam, yparam end zparam should be: time, freq, plvspctrm. I guess the time and freq part are taken care of by the default settings. However, your xlim seems to refer to frequencies, true? Try cfg.ylim = [5 100] instead. Yours, Jan-Mathijs -----Original Message----- From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf Of Andre Bastos Sent: Wednesday, November 08, 2006 11:11 PM To: FIELDTRIP at NIC.SURFNET.NL Subject: [FIELDTRIP] another coherence question Hello Everyone, So I am trying to do a simple coherence measure between a single electrode pair, PO3 and Cz. It seems like the computations are running, fine, the problem is in trying to use singleplotER to visualize the results, which always fails with the following error: Error using ==> plot, Vectors must be the same lengths. Error in ==> singleplotER at 287 plot(varargin{k-1}.(cfg.xparam), P, style); My cfg structure looks like this: cfg = zparam = 'plvspctrm'; xlim = [5 100]; cohrefchannel = 'Cz'; channel = 'PO3'; The data were first run through the scalpcurrentdensity function using the 'finite' method, then time frequency analysis was compute in frequencies 1-100 using the 'mtmconvol' method with 'powandcsd' output, using the channel = {'PO3' 'PO4' 'Cz'}, with channelcmb set to {'PO3' 'Cz'; 'PO4' 'Cz'}. Then I called freqdescriptives using cohmethod = 'plv'. The returned data structure definetly has coherence data in it, and has a .plvspctrm field which is 2x100x61, channelcmb x freqs x time. Ive looked at the data and it seems to make sense, it has numbers that range from 0 to 0.5, so it seems like the plot function is really whats giving me trouble. Any words of wisdom? Thank You in advance, Andre Bastos Robertson Lab, UC Berkeley From lorina_naci at YAHOO.CO.UK Fri Nov 10 18:41:24 2006 From: lorina_naci at YAHOO.CO.UK (Lorina Naci) Date: Fri, 10 Nov 2006 17:41:24 +0000 Subject: Within-subject coherence statististics for virtual sources In-Reply-To: Message-ID: Hi Robert, Thank you very much for your help, I was wondering whether I could trouble you with a couple more questions. I converted my besa data to fieldtrip format and this seemed to work fine. I got no error messages and the data structures look like they contain all my data in them (I am attaching an example mat file with the output structures from a few subjects). However, I am still having problems with running freqstatistics. The cfg options are defined OK but the matlab script crushes when it comes to calling statistics_wrapper. The error message I get is as follows: "Could not determine type of input data" which leads me to believe there is a problem with the converted data. I am also attaching my script for freqstatistics in case you need to see this file. Very many thanks for your help, Lorina Robert Oostenveld wrote: Hi Lorina On 8 Nov 2006, at 20:00, Lorina Naci wrote: > I tried to run the script as you suggested but it did not work. The > error message I get is to do with > [stat] = statistics_wrapper(cfg, varargin{:}). It just gives me an > error message pointing to this line,saying: error using > fieldtrip-20061003/private/statistics_wrapper, could not determine > the type of input data. Then it means that the data structure that you have obtained from besa2fieldtrip is not recognized. It is also not clear to me how your data looks like (i.e. as a Matlab structure). It is virtual channel data, time-frequency analyzed, and then single trial coherences computed? Could you show the output that you get on screen after dataA = besa2fieldtrip('filenameA.tfc') % i.e. without semicolon, to show the output on screen dataB = besa2fieldtrip('filenameB.tfc') % i.e. without semicolon, to show the output on screen > Also, the function 'cfg.numrandomization' requires a number, but I > am not sure what the choice of the number depends on? I've inputed > 500 as in the documentation example. That is the number of resamplings that is used to construct the reference distribution, 500 should be fine. > Finally, at risk making my ignorance of how Fieldtrip works > entirely transparent, I am not quite sure how the function you send > me 'statfun_diff.m' links with the 'freqstatistics.m,' and whether > I do need to use it? You just have to put it on your Matlab path somewhere, and you specify cfg.statistic ='diff' in freqstatistics. In general by specifying cfg.statistic='xxx', the function statfun_xxx will be called. Please look in the function statfun_diff.m to see how the statistic for each sample (=time- frequency-channel point) is computed. best regards, Robert Send instant messages to your online friends http://uk.messenger.yahoo.com -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: allsubjects.mat Type: application/octet-stream Size: 769060 bytes Desc: 2990736193-allsubjects.mat URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: freqstatistics_test.m Type: application/octet-stream Size: 3768 bytes Desc: 669505844-freqstatistics_test.m URL: From Jan.Schoffelen at FCDONDERS.RU.NL Fri Nov 10 21:56:21 2006 From: Jan.Schoffelen at FCDONDERS.RU.NL (Jan Mathijs Schoffelen) Date: Fri, 10 Nov 2006 21:56:21 +0100 Subject: Within-subject coherence statististics for virtual sources In-Reply-To: <20061110174125.16585.qmail@web28113.mail.ukl.yahoo.com> Message-ID: Dear Lorina, Even though my name is not Robert, I hope that is OK. I do not really understand why you use freqstatistics_test function the way you do, but this is the way I get it going in your case (so not using the function you sent along: and I think what went wrong is how you configured your input-data): Cfg.method = 'montecarlo'; Cfg.statistic = 'diff'; Cfg.parameter = 'powerspctrm'; %these contain coherences in reality, right? Cfg.numrandomization = something; Cfg.design = dependent on your input data; Cfg.ivar = 1; %put condition in the first row of your desing-matrix Cfg.uvar = 2; %put the subject-index on the second row And now comes the trick, and I guess that's why you tried it the way you did, at least so that you would not run into problems with neighbourselection anymore. For j = 1:length(dataBlabla.label) Cfg.neighbours{j}.label = dataBlabla.label{j}; Cfg.neighbours{j}.neighblabel = {}; End You have virtual channel data, so the neighbourhood-structure is irrelevant for clustering (you don't want to cluster in space, but only in time and frequency perhaps) At least it should run through if you call: Stat = freqstatistics(cfg, dataS1C1, dataS1C2, dataS2C1 etc) Yours, Jan-Mathijs _____ From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf Of Lorina Naci Sent: Friday, November 10, 2006 6:41 PM To: FIELDTRIP at NIC.SURFNET.NL Subject: Re: [FIELDTRIP] Within-subject coherence statististics for virtual sources Hi Robert, Thank you very much for your help, I was wondering whether I could trouble you with a couple more questions. I converted my besa data to fieldtrip format and this seemed to work fine. I got no error messages and the data structures look like they contain all my data in them (I am attaching an example mat file with the output structures from a few subjects). However, I am still having problems with running freqstatistics. The cfg options are defined OK but the matlab script crushes when it comes to calling statistics_wrapper. The error message I get is as follows: "Could not determine type of input data" which leads me to believe there is a problem with the converted data. I am also attaching my script for freqstatistics in case you need to see this file. Very many thanks for your help, Lorina Robert Oostenveld wrote: Hi Lorina On 8 Nov 2006, at 20:00, Lorina Naci wrote: > I tried to run the script as you suggested but it did not work. The > error message I get is to do with > [stat] = statistics_wrapper(cfg, varargin{:}). It just gives me an > error message pointing to this line,saying: error using > fieldtrip-20061003/private/statistics_wrapper, could not determine > the type of input data. Then it means that the data structure that you have obtained from besa2fieldtrip is not recognized. It is also not clear to me how your data looks like (i.e. as a Matlab structure). It is virtual channel data, time-frequency analyzed, and then single trial coherences computed? Could you show the output that you get on screen after dataA = besa2fieldtrip('filenameA.tfc') % i.e. without semicolon, to show the output on screen dataB = besa2fieldtrip('filenameB.tfc') % i.e. without semicolon, to show the output on screen > Also, the function 'cfg.numrandomization' requires a number, but I > am not sure what the choice of the number depends on? I've inputed > 500 as in the documentation example. That is the number of resamplings that is used to construct the reference distribution, 500 should be fine. > Finally, at risk making my ignorance of how Fieldtrip works > entirely transparent, I am not quite sure how the function you send > me 'statfun_diff.m' links with the 'freqstatistics.m,' and whether > I do need to use it? You just have to put it on your Matlab path somewhere, and you specify cfg.statistic ='diff' in freqstatistics. In general by specifying cfg.statistic='xxx', the function statfun_xxx will be called. Please look in the function statfun_diff.m to see how the statistic for each sample (=time- frequency-channel point) is computed. best regards, Robert Send instant messages to your online friends http://uk.messenger.yahoo.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From Jan.Schoffelen at FCDONDERS.RU.NL Fri Nov 10 22:06:51 2006 From: Jan.Schoffelen at FCDONDERS.RU.NL (Jan Mathijs Schoffelen) Date: Fri, 10 Nov 2006 22:06:51 +0100 Subject: Statistical comparisons in virtual electrode spectrograms In-Reply-To: <45548DEA.4000605@psych.york.ac.uk> Message-ID: Dear Piers, As a matter of fact, I have very little hands on experience with the clusterrandanalysis myself, and to be honest I'd prefer to use the new implementation of the statistics-routine, which has the same functionality as the clusterrandanalysis-function, and which was the subject of the last activity on this mailing-list, as well as a thread I pointed you to lately. In any way it is nice to hear that there is progress, and I forward your questions to the mailing list, so that people more experienced in clusterrandanalysis can join the discussion and vent their insights. Yours, Jan-Mathijs -----Original Message----- From: Piers Cornelissen [mailto:p.cornelissen at psych.york.ac.uk] Sent: Friday, November 10, 2006 3:34 PM To: Jan Mathijs Schoffelen Subject: Re: [FIELDTRIP] Statistical comparisons in virtual electrode spectrograms Dear Jan I think I may finally have got somewhere! However, I would be grateful if you or one of the Fieldtrip team could look at the clusrand_test.m script, in which I have tried to compare equal sized baseline with active windows for the group average spectrogram for one virtual electrode. As you can see, I have tried to 'borrow' back a .grad field, which the freqgrandaverage threw away, and then tried to cheat the neighbood problem in clsterrandanalysis by setting minnbchan to zero. At least these manipulations allow clusterrandanalysis to run on the virtual electrode data, and the attached powerpoint file illustrates some plots of what I get. Therefore, the first question is - are these manipulations legitimate, or have I just generated garbage? Secondly, if the output is not garbage, then I would appreciate some pointers at to what the numbers in the fields that I have *ed below actually represent, please >> clusrand clusrand = stats: [196x51 double] * raweffect: [196x51 double] * posclusters: [1x3 struct] * negclusters: [1x2 struct] * posclusterslabelmat: [1x196x51 double] * negclusterslabelmat: [1x196x51 double] * critvals: [-785.1538 785.1538] presumably interpretable when I understand the previous numbers ?* label: {'V0'} freq: [1x196 double] time: [1x51 double] cfg: [1x1 struct] As ever, I deeply appreciate your and the teams support (it is genuinely extraordinary!) Best Piers From maris at NICI.RU.NL Fri Nov 10 22:30:11 2006 From: maris at NICI.RU.NL (Eric Maris) Date: Fri, 10 Nov 2006 22:30:11 +0100 Subject: Statistical comparisons in virtual electrode spectrograms In-Reply-To: <000801c7050c$24569930$902dae83@fcdonders.nl> Message-ID: Hi Piers, > As you can see, I have tried to 'borrow' back a .grad field, which the > freqgrandaverage threw away, and then tried to cheat the neighbood > problem in clsterrandanalysis by setting minnbchan to zero. If you supply a hand-made neighbourhood-structure for your virtual channel(s) then you don't have to borrow back the grad field. > clusrand = > > stats: [196x51 double] * > raweffect: [196x51 double] * > posclusters: [1x3 struct] * If the elements of this array (structs) have value in the pval-field that is less than 0.05, then you have found a significant positive cluster. > negclusters: [1x2 struct] * If the elements of this array (structs) have value in the pval-field that is less than 0.05, then you have found a significant negative cluster.> Have a look at the clusterrandanalysis tutorial to find out how you can plot your significant clusters. Good luck, Eric Maris From Daria.Osipova at FCDONDERS.RU.NL Wed Nov 15 17:31:52 2006 From: Daria.Osipova at FCDONDERS.RU.NL (Daria Osipova) Date: Wed, 15 Nov 2006 17:31:52 +0100 Subject: Beamformer time course In-Reply-To: <78E05DBA-BC4C-469B-A508-5653CF799233@fcdonders.ru.nl> Message-ID: Hi In continuation of this discussion... I would like to use the lcmv method to localize sources of (band-pass filtered) ongoing alpha which I can use as spatial filters for my (unfiltered) data. >>From the previous discussions on lcmv it seems that most people try to estimate covariance matrix from the average since they are doing ERFs. In my case data is not time-locked so I have to estimate it from single trials and not from the average (I would think). But judging from your response, Robert, it seems that cfg.rawtrial = 'yes' (which uses covariance matrix from single trials and applies it to single trials) produces a noisy estimate. Is there a workaround then? Thanks in advance Best regards, Dasha PS I need time-domain data -----Original Message----- From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf Of Robert Oostenveld Sent: Tuesday, May 23, 2006 12:13 PM To: FIELDTRIP at NIC.SURFNET.NL Subject: Re: [FIELDTRIP] Beamformer time course Hi Marie, On 22 May 2006, at 17:18, Marie Smith wrote: > I have been trying out the various methods as discussed and have > come across a problem. > > When I select cfg.singletrials = 'yes' I get a number of error > messages saying > error('this option contains a bug, and is therefore not supported > at the moment'); > > I am using the toolbox fieldtrip-20060516. > > I noticed however, if I select cfg.rawtrials = 'yes' the function > will run. I recall disabling this functionality, since it was rarely used and since I was concerned that it would not be correct. I now had a more detailled look at the code. If you do rawtrial=yes, beamformer uses the single-trial covariance to construct the filter and also applies it to the single trial covariance/csd. That results in a very poorly estimated filter in each trial, hence projecting large amounts of noise and a lot of variance over trials. Therefore we found it not to be very usefull on real data, although conceptually and in the code it is correct. The idea behind singletrial=yes is that beamformer uses the average covariance to construct the filter and applies it to the single trial covariance/csd. The problem in the code however is that beamformer would use the averaged covariance/csd to estimate the power and not the single trial covariance/csd. The estimated single-trial timecourse would be correct, but the power would not be correct. Therefore I disabled that option in the code. The solution is something that you can do yourself in two subsequent runs of sourceanalysis: you can do sourceanalysis on the average (i.e. do not specify any of singletrial/rawtrial options) and specify keepfilter=yes. That will give you the filter, computed on the average covariance. Subsequently do cfg.grid=source2grid(source), and use the resulting grid (including the filters) in the second run of sourceanalysis, in which you specify cfg.rawtrial=yes. In the second run, the previous (based on average covariance) filters will be applied to the unaveraged data, resulting in the desired single-trial power and dipole moment. best regards, Robert From c.hesse at FCDONDERS.RU.NL Wed Nov 15 17:59:02 2006 From: c.hesse at FCDONDERS.RU.NL (Christian Hesse) Date: Wed, 15 Nov 2006 17:59:02 +0100 Subject: Beamformer time course In-Reply-To: <000701c708d3$8e8e4a80$032dae83@fcdonders.nl> Message-ID: Hi Dasha, you could try averaging the single trial covariance matrices (preserving the spatial correlation structure of both time-locked and non-time-locked activity). Then replace the single-trial covariance matrices in your timelock data structure with that average and call lcmv with cfg.rawtrial = 'yes'; However don't expect miracles, because: a) single trial estimates will always be noisy b) if there is significant head-movement between trials, then using the average covaraiance matrix may not do much better than single trial covariance estimates (because you effectively havve moving sources) Hope this helps. Christian On 15 Nov 2006, at 17:31, Daria Osipova wrote: > Hi > > In continuation of this discussion... > > I would like to use the lcmv method to localize sources of (band-pass > filtered) ongoing alpha which I can use as spatial filters for my > (unfiltered) data. > From the previous discussions on lcmv it seems that most people try to > estimate covariance matrix from the average since they are doing ERFs. > In my case data is not time-locked so I have to estimate it from > single > trials and not from the average (I would think). > But judging from your response, Robert, it seems that cfg.rawtrial > = 'yes' > (which uses covariance matrix from single trials and applies it to > single > trials) produces a noisy estimate. > Is there a workaround then? > Thanks in advance > Best regards, > Dasha > PS I need time-domain data > > > > -----Original Message----- > From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] > On Behalf > Of Robert Oostenveld > Sent: Tuesday, May 23, 2006 12:13 PM > To: FIELDTRIP at NIC.SURFNET.NL > Subject: Re: [FIELDTRIP] Beamformer time course > > Hi Marie, > > On 22 May 2006, at 17:18, Marie Smith wrote: >> I have been trying out the various methods as discussed and have >> come across a problem. >> >> When I select cfg.singletrials = 'yes' I get a number of error >> messages saying >> error('this option contains a bug, and is therefore not supported >> at the moment'); >> >> I am using the toolbox fieldtrip-20060516. >> >> I noticed however, if I select cfg.rawtrials = 'yes' the function >> will run. > > I recall disabling this functionality, since it was rarely used and > since I was concerned that it would not be correct. I now had a more > detailled look at the code. > > If you do rawtrial=yes, beamformer uses the single-trial covariance > to construct the filter and also applies it to the single trial > covariance/csd. That results in a very poorly estimated filter in > each trial, hence projecting large amounts of noise and a lot of > variance over trials. Therefore we found it not to be very usefull on > real data, although conceptually and in the code it is correct. > > The idea behind singletrial=yes is that beamformer uses the average > covariance to construct the filter and applies it to the single trial > covariance/csd. The problem in the code however is that beamformer > would use the averaged covariance/csd to estimate the power and not > the single trial covariance/csd. The estimated single-trial > timecourse would be correct, but the power would not be correct. > Therefore I disabled that option in the code. > > The solution is something that you can do yourself in two subsequent > runs of sourceanalysis: you can do sourceanalysis on the average > (i.e. do not specify any of singletrial/rawtrial options) and specify > keepfilter=yes. That will give you the filter, computed on the > average covariance. Subsequently do cfg.grid=source2grid(source), and > use the resulting grid (including the filters) in the second run of > sourceanalysis, in which you specify cfg.rawtrial=yes. In the second > run, the previous (based on average covariance) filters will be > applied to the unaveraged data, resulting in the desired single-trial > power and dipole moment. > > best regards, > Robert > ---------------------------------------------------------------------- Christian Hesse, PhD, MIEEE F.C. Donders Centre for Cognitive Neuroimaging P.O. Box 9101 NL-6500 HB Nijmegen The Netherlands Tel.: +31 (0)24 36 68293 Fax: +31 (0)24 36 10989 Email: c.hesse at fcdonders.ru.nl Web: www.fcdonders.ru.nl ---------------------------------------------------------------------- -------------- next part -------------- An HTML attachment was scrubbed... URL: From c.hesse at FCDONDERS.RU.NL Wed Nov 15 18:07:50 2006 From: c.hesse at FCDONDERS.RU.NL (Christian Hesse) Date: Wed, 15 Nov 2006 18:07:50 +0100 Subject: Beamformer time course In-Reply-To: <6E2E8326-EBD6-4565-9CC7-B58E9FD54F70@fcdonders.ru.nl> Message-ID: Ooops, didn't read all the way through the previous discussion ... source analysis does that anyway, and as Robert points out the power estimate is not correct, either (however, depending on the analysis that need not be a problem). Please disregard my previous comment. Christian On 15 Nov 2006, at 17:59, Christian Hesse wrote: > Hi Dasha, > > you could try averaging the single trial covariance matrices > (preserving the spatial correlation structure of both time-locked > and non-time-locked activity). Then replace the single-trial > covariance matrices in your timelock data structure with that > average and call lcmv with cfg.rawtrial = 'yes'; > > However don't expect miracles, because: > a) single trial estimates will always be noisy > b) if there is significant head-movement between trials, then using > the average covaraiance matrix may not do much better than single > trial covariance estimates (because you effectively havve moving > sources) > > Hope this helps. > Christian > > > > On 15 Nov 2006, at 17:31, Daria Osipova wrote: > >> Hi >> >> In continuation of this discussion... >> >> I would like to use the lcmv method to localize sources of (band-pass >> filtered) ongoing alpha which I can use as spatial filters for my >> (unfiltered) data. >> From the previous discussions on lcmv it seems that most people >> try to >> estimate covariance matrix from the average since they are doing >> ERFs. >> In my case data is not time-locked so I have to estimate it from >> single >> trials and not from the average (I would think). >> But judging from your response, Robert, it seems that cfg.rawtrial >> = 'yes' >> (which uses covariance matrix from single trials and applies it to >> single >> trials) produces a noisy estimate. >> Is there a workaround then? >> Thanks in advance >> Best regards, >> Dasha >> PS I need time-domain data >> >> >> >> -----Original Message----- >> From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] >> On Behalf >> Of Robert Oostenveld >> Sent: Tuesday, May 23, 2006 12:13 PM >> To: FIELDTRIP at NIC.SURFNET.NL >> Subject: Re: [FIELDTRIP] Beamformer time course >> >> Hi Marie, >> >> On 22 May 2006, at 17:18, Marie Smith wrote: >>> I have been trying out the various methods as discussed and have >>> come across a problem. >>> >>> When I select cfg.singletrials = 'yes' I get a number of error >>> messages saying >>> error('this option contains a bug, and is therefore not supported >>> at the moment'); >>> >>> I am using the toolbox fieldtrip-20060516. >>> >>> I noticed however, if I select cfg.rawtrials = 'yes' the function >>> will run. >> >> I recall disabling this functionality, since it was rarely used and >> since I was concerned that it would not be correct. I now had a more >> detailled look at the code. >> >> If you do rawtrial=yes, beamformer uses the single-trial covariance >> to construct the filter and also applies it to the single trial >> covariance/csd. That results in a very poorly estimated filter in >> each trial, hence projecting large amounts of noise and a lot of >> variance over trials. Therefore we found it not to be very usefull on >> real data, although conceptually and in the code it is correct. >> >> The idea behind singletrial=yes is that beamformer uses the average >> covariance to construct the filter and applies it to the single trial >> covariance/csd. The problem in the code however is that beamformer >> would use the averaged covariance/csd to estimate the power and not >> the single trial covariance/csd. The estimated single-trial >> timecourse would be correct, but the power would not be correct. >> Therefore I disabled that option in the code. >> >> The solution is something that you can do yourself in two subsequent >> runs of sourceanalysis: you can do sourceanalysis on the average >> (i.e. do not specify any of singletrial/rawtrial options) and specify >> keepfilter=yes. That will give you the filter, computed on the >> average covariance. Subsequently do cfg.grid=source2grid(source), and >> use the resulting grid (including the filters) in the second run of >> sourceanalysis, in which you specify cfg.rawtrial=yes. In the second >> run, the previous (based on average covariance) filters will be >> applied to the unaveraged data, resulting in the desired single-trial >> power and dipole moment. >> >> best regards, >> Robert >> > > ---------------------------------------------------------------------- > Christian Hesse, PhD, MIEEE > > F.C. Donders Centre for Cognitive Neuroimaging > P.O. Box 9101 > NL-6500 HB Nijmegen > The Netherlands > > Tel.: +31 (0)24 36 68293 > Fax: +31 (0)24 36 10989 > > Email: c.hesse at fcdonders.ru.nl > Web: www.fcdonders.ru.nl > ---------------------------------------------------------------------- > > > > ---------------------------------------------------------------------- Christian Hesse, PhD, MIEEE F.C. Donders Centre for Cognitive Neuroimaging P.O. Box 9101 NL-6500 HB Nijmegen The Netherlands Tel.: +31 (0)24 36 68293 Fax: +31 (0)24 36 10989 Email: c.hesse at fcdonders.ru.nl Web: www.fcdonders.ru.nl ---------------------------------------------------------------------- -------------- next part -------------- An HTML attachment was scrubbed... URL: From anderman at MIT.EDU Wed Nov 15 18:54:39 2006 From: anderman at MIT.EDU (Mark Andermann) Date: Wed, 15 Nov 2006 12:54:39 -0500 Subject: How do you load Neuromag Averaged files into Fieldtrip? Message-ID: Greetings, My name is Mark Andermann, I'm working at the Low Temperature Lab and Lab for Computational Engineering in Helsinki. I'd like to use Fieldtrip to fit dipoles to data acquired on a 306 channel neuromag MEG system. While Fieldtrip offers instructions for loading raw data, I have not found a simple script to load in Neuromag data that's already been averaged in MATLAB, and converted back to an averaged .fif file. Also, can MEG dipole fitting (and time-series estimation) in Fieldtrip be done with a spherical head model in the absence of any subject MRI data? Thank you for your help, Dr. Mark Andermann From lorina_naci at YAHOO.CO.UK Mon Nov 20 19:32:50 2006 From: lorina_naci at YAHOO.CO.UK (Lorina Naci) Date: Mon, 20 Nov 2006 18:32:50 +0000 Subject: Within-subject coherence statististics for virtual sources In-Reply-To: <000301c7050a$ad618610$902dae83@fcdonders.nl> Message-ID: Dear Jan-Mathijs, thanks so much for your message. I am sorry I did not respond any earlier – the message ended up misclassified in my mailbox and I did not notice it. Thank you for sending me the modified script. I’ve defined the cfg.neighbours{j}.label by entering one of my data structures. Also, I’ve loaded all my subjects’ data structures which are saved in the file ‘allsubjects.m’ I ran it but again it crashes, giving the same error pointing to the statistics_wrapper, saying that the input data could not be determined. I am attaching here my scrip and ‘allsubjects.m’ Sorry to keep bothering you with this. Many thanks for your help, Lorina Jan Mathijs Schoffelen wrote: v\:* {behavior:url(#default#VML);} o\:* {behavior:url(#default#VML);} w\:* {behavior:url(#default#VML);} .shape {behavior:url(#default#VML);} st1\:*{behavior:url(#default#ieooui) } Dear Lorina, Even though my name is not Robert, I hope that is OK. I do not really understand why you use freqstatistics_test function the way you do, but this is the way I get it going in your case (so not using the function you sent along: and I think what went wrong is how you configured your input-data): Cfg.method = ‘montecarlo’; Cfg.statistic = ‘diff’; Cfg.parameter = ‘powerspctrm’; %these contain coherences in reality, right? Cfg.numrandomization = something; Cfg.design = dependent on your input data; Cfg.ivar = 1; %put condition in the first row of your desing-matrix Cfg.uvar = 2; %put the subject-index on the second row And now comes the trick, and I guess that’s why you tried it the way you did, at least so that you would not run into problems with neighbourselection anymore. For j = 1:length(dataBlabla.label) Cfg.neighbours{j}.label = dataBlabla.label{j}; Cfg.neighbours{j}.neighblabel = {}; End You have virtual channel data, so the neighbourhood-structure is irrelevant for clustering (you don’t want to cluster in space, but only in time and frequency perhaps) At least it should run through if you call: Stat = freqstatistics(cfg, dataS1C1, dataS1C2, dataS2C1 etc) Yours, Jan-Mathijs --------------------------------- From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf Of Lorina Naci Sent: Friday, November 10, 2006 6:41 PM To: FIELDTRIP at NIC.SURFNET.NL Subject: Re: [FIELDTRIP] Within-subject coherence statististics for virtual sources Hi Robert, Thank you very much for your help, I was wondering whether I could trouble you with a couple more questions. I converted my besa data to fieldtrip format and this seemed to work fine. I got no error messages and the data structures look like they contain all my data in them (I am attaching an example mat file with the output structures from a few subjects). However, I am still having problems with running freqstatistics. The cfg options are defined OK but the matlab script crushes when it comes to calling statistics_wrapper. The error message I get is as follows: "Could not determine type of input data" which leads me to believe there is a problem with the converted data. I am also attaching my script for freqstatistics in case you need to see this file. Very many thanks for your help, Lorina Robert Oostenveld wrote: Hi Lorina On 8 Nov 2006, at 20:00, Lorina Naci wrote: > I tried to run the script as you suggested but it did not work. The > error message I get is to do with > [stat] = statistics_wrapper(cfg, varargin{:}). It just gives me an > error message pointing to this line,saying: error using > fieldtrip-20061003/private/statistics_wrapper, could not determine > the type of input data. Then it means that the data structure that you have obtained from besa2fieldtrip is not recognized. It is also not clear to me how your data looks like (i.e. as a Matlab structure). It is virtual channel data, time-frequency analyzed, and then single trial coherences computed? Could you show the output that you get on screen after dataA = besa2fieldtrip('filenameA.tfc') % i.e. without semicolon, to show the output on screen dataB = besa2fieldtrip('filenameB.tfc') % i.e. without semicolon, to show the output on screen > Also, the function 'cfg.numrandomization' requires a number, but I > am not sure what the choice of the number depends on? I've inputed > 500 as in the documentation example. That is the number of resamplings that is used to construct the reference distribution, 500 should be fine. > Finally, at risk making my ignorance of how Fieldtrip works > entirely transparent, I am not quite sure how the function you send > me 'statfun_diff.m' links with the 'freqstatistics.m,' and whether > I do need to use it? You just have to put it on your Matlab path somewhere, and you specify cfg.statistic ='diff' in freqstatistics. In general by specifying cfg.statistic='xxx', the function statfun_xxx will be called. Please look in the function statfun_diff.m to see how the statistic for each sample (=time- frequency-channel point) is computed. best regards, Robert Send instant messages to your online friends http://uk.messenger.yahoo.com --------------------------------- Inbox full of spam? Get leading spam protection and 1GB storage with All New Yahoo! Mail. -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: allsubjects.mat Type: application/octet-stream Size: 769060 bytes Desc: 2990736193-allsubjects.mat URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: freqstatistics_test.m Type: application/octet-stream Size: 3928 bytes Desc: 669505844-freqstatistics_test.m URL: From Jan.Schoffelen at FCDONDERS.RU.NL Tue Nov 21 08:02:00 2006 From: Jan.Schoffelen at FCDONDERS.RU.NL (Jan Mathijs Schoffelen) Date: Tue, 21 Nov 2006 08:02:00 +0100 Subject: freqanalysis_wltconvol.m question In-Reply-To: <6.1.2.0.2.20061120134916.01cb9ec0@email.med.yale.edu> Message-ID: Dear Brian et al, _____ From: Brian Roach [mailto:Brian.Roach at yale.edu] Sent: Monday, November 20, 2006 11:56 PM To: Jan Mathijs Schoffelen Subject: Re: [FIELDTRIP] freqanalysis_wltconvol.m question Hi, I could not get this posted to the list, and figured since you gave most of the feedback, I would see what you think. thanks, Brian Date: Mon, 13 Nov 2006 12:09:00 -0500 To: FieldTrip discussion list From: Brian Roach Subject: Re: [FIELDTRIP] freqanalysis_wltconvol.m question Bcc: Daniel Mathalon Thanks for the advice, I am wondering if FT users would agree that this is an acceptable way to estimate univariate phase coherence: In freqanalysis_wltconvol.m, line 283: % powdum = (2.* abs(autspctrmacttap) ./ data.fsample) .^ 2; powdum = (2.*autspctrmacttap ./ data.fsample); 1. I've commented out the power line and inserted basically the same thing (but not squared) 2. As suggested, I change cfg.keeptrials = 'yes'; 3. After running freqanalysis.m, in the command prompt: itc = abs(mean(squeeze(freq.powspctrm)./abs(squeeze(freq.powspctrm)),1)) squeeze is used because freq.powspctrm is a 3 d matrix including sites, times, and frequencies and in the above case I am just getting itc from 1 channel. Does this method seem alright? Regarding step #1 above, it seemed to make no difference whether I left the 2.* in that equation or not, which seems consistent with an earlier e-mail that mentioned this multiplication being tied into power, so it does not influence phase angle. Is that right? Or, should it be taken out for my purposes? thanks, Brian This looks fine to me. Indeed the factor of 2 does not affect the outcome, because it falls out in the division (normalization) step. Yours, Jan-Mathijs PS: you might have to think about whether or not to square the final itc, to make it consistent with the way it is defined in the literature. At 04:37 AM 11/9/2006, you wrote: Dear Brian, Freqanalysis_wltconvol does not support fourier as an output. However, since wavelet-analysis and fft's in the end are about the same thingy, you could use freqanalysis_mtmconvol to achieve your goal. There is a tutorial on the fieldtrip-website which deals with this function, and uses it in a way that it resembles a wavelet-analysis, in which the time-frequency resolution is treated in the same way as with standard wavelet-analysis. Phase-locking-value is defined in fieldtrip as a bivariate-measure, so that means that it quantifies how consistent the phase-relation between two channels is across trials. Inter-trial coherence is a bit an odd thingy, because the term coherence suggests something bivariate, but the way you would like to use it, is essentially univariate. You want to estimate how consistent the phase of the oscillations at a particular channel is across trials. However, both measures use similar math. In fact, when you create a dummy-fourier-channel you can use the plv-option to obtain your 'itc'. This is because in this situation, the mathematics become identical. I would advise it like this: Do your freqanalysis as Robert suggested in one of his previous mails (see below (cfg.keeptapers = 'yes')). Then create a dummy channel: dim = size(freq.fourierspctrm; freq.fourierspctrm(:,end+1,:,:) = ones(dim([1 3 4])); freq.label = 'dummy'; cfg = []; cfg.cohmethod = 'plv'; cfg.channelcmb = channelcombination({'dummy' 'all'}, freq.label); %should work itc = freqdescriptives(cfg, freq); Your 'itc' now is contained in the field itc.cohspctrm; The check whether this is correctly done is done outside fieldtrip: itc2 = abs(mean(freq.fourierspctrm./abs(freq.fourierspctrm),1)); Yours, Jan-Mathijs -----Original Message----- From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf Of Brian Roach Sent: Wednesday, November 08, 2006 11:13 PM To: FIELDTRIP at NIC.SURFNET.NL Subject: Re: [FIELDTRIP] freqanalysis_wltconvol.m question Robert, Thanks for your quick reply. I did not realize that freqanalysis_wltconvol.m allowed for 'fourier' output, but maybe I need to download the latest version. Or, do you mean I should use freqanalysis_mtm instead? Also, how does ITC differ from phase-locking value? I thought they were the same measure. At 04:56 PM 11/8/2006, you wrote: >Hi Brian > >On 8 Nov 2006, at 21:20, Brian Roach wrote: >>eI would like to take this complex output and use it to calculate >>phase-locking factor, but I am not sure what parts of the power >>transformation need to be removed - just the abs() and the >>squaring? Clarification of this line of code would be extremely >>helpful to me. > >You can use the existing code for that: > >For computing the phase-locking value I suggest that you use either > cfg.output='fourier' > cfg.keeptrials='yes' > cfg.keeptapers='yes' >or > cfg.output='fourier' > cfg.keeptrials='yes' > cfg.keeptapers='no' (not needed now) > cfg.channelcmb = something, see the help >in freqanalysis. > >Subsequently, use the option > cfg.cohmethod='plv' >in freqdescriptives. In case of fourier output in freqanalysis, you >should specify the channel combinations here. > >... >Looking back at your previous mail, I see that you mean ITC and not >PLV. The stuff above then does not apply. You can do output=fourier >in freqanalysis and work manually on the output freq structure. I >think that this should work > >magnitude = abs(freq.fourierspctrm); >scaled = freq.fourierspctrm ./ magnitude; >freq.itcspctrm = mean(scaled, 1); >freq = rmfield(freq, 'fourierspctrm'); % remove the single >fourierspectrum, to avoid confusion >freq.dimord = 'chan_freq_time'; % remove the rpt or rpttap >dimension > >best regards, >Robert > -------------- next part -------------- An HTML attachment was scrubbed... URL: From r.oostenveld at FCDONDERS.RU.NL Tue Nov 21 09:42:02 2006 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Tue, 21 Nov 2006 09:42:02 +0100 Subject: How do you load Neuromag Averaged files into Fieldtrip? In-Reply-To: Message-ID: Dear Mark On 16 Nov 2006, at 1:54, Mark Andermann wrote: > I'd like to use Fieldtrip to fit dipoles to data acquired on a 306 > channel neuromag MEG system. While Fieldtrip offers instructions > for loading raw data, I have not found a simple script to load in > Neuromag data that's already been averaged in MATLAB, and converted > back to an averaged .fif file. Fieldtrip usually reads the data from disk itself, since the data is accopanied with auxiliary information (e.g. events and channel locations). So there is no default option to read in data from a matlab file, or from a matlab variable. The fif reading functions are nott included by default in fieldtrip (since they are closed source), but if you have the meg_pd toolbox on your matlab path then fieldtrip will detect that and use those functions (seee http://www2.ru.nl/fcdonders/fieldtrip/doku.php? id=fieldtrip:documentation:dataformats). The only issue with Neuromag data that I am aware about is that the stimulus channel is noisy, and hence the event detection might not be flawless. The alternative is to take the variables that you already have in your matlab session and convert them (manually) into a data structure taht is compatible with fieldtrip. You can find instructions on how to do that in the frequently asked questions list (see http:// www2.ru.nl/fcdonders/fieldtrip/doku.php? id=fieldtrip:documentation:frequently_asked_questions#how_can_i_import_m y_own_dataformat). > Also, can MEG dipole fitting (and time-series estimation) in > Fieldtrip be done with a spherical head model in the absence of any > subject MRI data? Yes, but then you have to define the spherical head model yourself. For the DIPOLEFITTING function you would specify cfg.vol.r = radius, single number cfg.vol.o = origin, [x y z] Both these values should be expressed in the same units (e.g. meters, centimeters or milimeters) as the channel locations. At the moment I do not recall what the default units are for Neuromag, but you can have a look at the "grad.pnt" field (i.e. the position of all the gradiometer coils) and you will probably easily recognize the units. best regards, Robert From jedmeltzer at YAHOO.COM Wed Nov 22 19:34:21 2006 From: jedmeltzer at YAHOO.COM (Jed Meltzer) Date: Wed, 22 Nov 2006 19:34:21 +0100 Subject: matlab crashes upon running fieldtrip - glibc error Message-ID: Hi, I am just trying to get fieldtrip running on my computer, which is brand new along with my matlab installation. I am trying to run the code in the first tutorial. The computer is a fancy 64-bit dual- xeon workstation, with RHEL 4.0, EM64T processors, and the newest Matlab 7.3 (R2006b). Here is some info about the system that might be relevant: uname -a Linux gemara.nidcd.nih.gov 2.6.9-42.ELsmp #1 SMP Wed Jul 12 23:32:02 EDT 2006 x86_64 x86_64 x86_64 GNU/Linux rpm -q glibc glibc-2.3.4-2.25 glibc-2.3.4-2.25 Now my problem: as soon as I run this line in the tutorial: dataFIC = preprocessing(cfg); matlab crashes and I get the following error message in the shell: *** glibc detected *** free(): invalid pointer: 0x0000002af5fd5dd0 *** Abort Any ideas about how to fix this? Thanks! -Jed Meltzer From jedmeltzer at YAHOO.COM Wed Nov 22 22:16:00 2006 From: jedmeltzer at YAHOO.COM (Jed Meltzer) Date: Wed, 22 Nov 2006 22:16:00 +0100 Subject: matlab crashes upon running fieldtrip - glibc error Message-ID: Just some further details here about my problem - I used the matlab debugger to try to find where preprocessing.m was crashing, and found that it was in the calling of "progress.m" If I comment out that call, the function works. Of course, I don't want to have to do that on every single field trip function that calls progress.m. Upon examining the code for progress.m, I see that there is this little workaround "to prevent matlab 2006b (7.3) from crashing" So I guess I am reporting that the workaround does not work! I have matlab 7.3 and it crashes anyway. However if I just type "feature accel off" at the beginning of my matlab session it works ok. I don't know why, but in the meantime this is working. Maybe you can fix this in the future? Thanks. -Jed From ali.mazaheri at FCDONDERS.RU.NL Thu Nov 23 14:39:52 2006 From: ali.mazaheri at FCDONDERS.RU.NL (Ali Mazaheri) Date: Thu, 23 Nov 2006 14:39:52 +0100 Subject: 64 bit.. detrending... Message-ID: Dear fieldtrippers... I've noticed that when I run some scripts on my pc I get quite diffrent results than when I run them on the 64 bit linux clusters. I initially thought perhaps it had to do with the matlab version.. and specifically the detrend function and specific toolboxes.. but that does not appear to be case since puting the toolboxes of matlab 7.0.1 (the matlab on my pc) on the path of the matlab7.1.0 ( the one on the 64 bit clusters) still gives different results. If any one has experience with this.. or suggestions please let me know..... bests ali From jeremiemattout at YAHOO.FR Thu Nov 23 17:06:40 2006 From: jeremiemattout at YAHOO.FR (Jeremie MATTOUT) Date: Thu, 23 Nov 2006 16:06:40 +0000 Subject: reading .sdq format Message-ID: Dear Fieldtrip users and developers, I need to read Yokogawa MEG data (*.sdq files). I saw on the fieldtrip web site that some functions should be available from the fieldtrip FTP server. However I have not been able to download them. Any help would be most welcome. To be a bit more precise, I am looking for a filter that would import those data format directly into Matlab or, alternatively, that would enable me to produce binary (.bin) files that I should then be able to convert into Matlab. Many Thanks, Jeremie Mattout INSERM U562 Service Hospitalier Frédéric Joliot CEA 4 pl. du Général Leclerc Orsay, F91401 FRANCE ___________________________________________________________________________ Découvrez une nouvelle façon d'obtenir des réponses à toutes vos questions ! Profitez des connaissances, des opinions et des expériences des internautes sur Yahoo! Questions/Réponses http://fr.answers.yahoo.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From r.oostenveld at FCDONDERS.RU.NL Mon Nov 27 15:38:32 2006 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Mon, 27 Nov 2006 15:38:32 +0100 Subject: reading .sdq format In-Reply-To: <20061123160640.62770.qmail@web26009.mail.ukl.yahoo.com> Message-ID: Dear Jeremie On 23 Nov 2006, at 17:06, Jeremie MATTOUT wrote: > I need to read Yokogawa MEG data (*.sdq files). > > I saw on the fieldtrip web site that some functions should be > available from the fieldtrip FTP server. > However I have not been able to download them. Any help would be > most welcome. The documentatino and a link to the ftp server is given here http:// www2.ru.nl/fcdonders/fieldtrip/doku.php? id=fieldtrip:documentation:dataformats#support_for_yokogawa_meg_data > To be a bit more precise, I am looking for a filter that would > import those data format directly into Matlab or, alternatively, > that would enable me to produce binary (.bin) files that I should > then be able to convert into Matlab. I suggest that you download the fileio module and use the Matlab interface described here http://www2.ru.nl/fcdonders/fieldtrip/ doku.php?id=fieldtrip:development:fileio That requires that you drop the yokogawa specific functions in the "private" directory. best regards, Robert From r.oostenveld at FCDONDERS.RU.NL Mon Nov 27 15:46:23 2006 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Mon, 27 Nov 2006 15:46:23 +0100 Subject: matlab crashes upon running fieldtrip - glibc error In-Reply-To: Message-ID: Hi Jed, On 22 Nov 2006, at 22:16, Jed Meltzer wrote: > Just some further details here about my problem - > > I used the matlab debugger to try to find where preprocessing.m was > crashing, and found that it was > in the calling of "progress.m" > ... > So I guess I am reporting that the workaround does not work! I > have matlab 7.3 and it crashes > anyway. Yes, that is also what I have observed. I have contacted Mathworks with this, and they confirmed that that is a bug in Matlab 7.3. It has something to do with acceleration and persistent variables. It turns out that "feature accel off" should be given prior to calling the "progress" function, so therefore it does not work when included in the progress function itself. > However if I just type "feature accel off" at the beginning of my > matlab session it works ok. I don't > know why, but in the meantime this is working. > Maybe you can fix this in the future? Thanks. I have no idea how to fix this myself, I hope that Mathworks will fix it in the next Matlab version. I suggest that you include the "feature accel off" in yur matlab startup.m file. E.g. this is what I have in my ~/matlab/startup.m if strcmp(getfield(ver('MATLAB'), 'Version'), '7.3') feature accel off end best regards Robert From r.oostenveld at FCDONDERS.RU.NL Mon Nov 27 16:37:17 2006 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Mon, 27 Nov 2006 16:37:17 +0100 Subject: Within-subject coherence statististics for virtual sources In-Reply-To: <20061120183250.77617.qmail@web28104.mail.ukl.yahoo.com> Message-ID: Hi Lornia, On 20 Nov 2006, at 19:32, Lorina Naci wrote: > Thank you for sending me the modified script. I’ve defined the > cfg.neighbours{j}.label by entering one of my data structures. > Also, I’ve loaded all my subjects’ data structures which are saved > in the file ‘allsubjects.m’ > > I ran it but again it crashes, giving the same error pointing to > the statistics_wrapper, saying that the input data could not be > determined. I am attaching here my scrip and ‘allsubjects.m’ > Sorry to keep bothering you with this. I found one small bug in your attached script for j = 1:length(data1257Vis.label); cfg.neighbours{j}.label = data1257Vis.label{j}; cgf.neighbours{j}.neighblabel = {}; <========== TYPO cgf->cfg end Furthermore, I do not understand why your attached script is a mixture of fieldtrip code and your own code. You should put your own code in a script (which does NOT start with "function"), and call that script from the command line. The script should call the freqstatistics function. If I do the following using your data, it seems to work for me. best regards, Robert %-------------------- script starts here -------------------- load allsubjects cfg = []; cfg.method = 'montecarlo'; cfg.statistic = 'diff'; % cfg.parameter = 'cohspctrm'; <==== it will always use powspctrm, regardless of this parameter cfg.numrandomization = 500; cfg.design = [1 1 2 2 3 3 4 4 5 5 6 6; 1 2 1 2 1 2 1 2 1 2 1 2]; cfg.ivar = 2; cfg.uvar = 1; cfg.correctm = 'yes'; for j = 1:length(data1257Vis.label); cfg.neighbours{j}.label = data1257Vis.label{j}; cfg.neighbours{j}.neighblabel = {}; end stat = freqstatistics(cfg, data1257XM, data1257Vis, data1299XM, data1299Vis, data349XM, data349Vis, data449XM, data449Vis, data732XM, data732Vis, data868XM, data868Vis); From ali.mazaheri at FCDONDERS.RU.NL Tue Nov 28 13:55:05 2006 From: ali.mazaheri at FCDONDERS.RU.NL (Ali Mazaheri) Date: Tue, 28 Nov 2006 13:55:05 +0100 Subject: operations on single precision numbers unstable in matlab 7.1 (64bit ) vesions and higher In-Reply-To: <20061123160640.62770.qmail@web26009.mail.ukl.yahoo.com> Message-ID: Dear all, The long subject captions says it all. I just recently discovered that solutions to the low level functions in matlab7.1 and higher run on a 64 bit platform become unstable when using single precision. This problem does not appear to be present on matlabs running on a 32 bit platform. . A simple example of this problem is as follows a=[1 2] b=[1 2]; >> a/b ans = 1 NOW in single precision a=single(a); b=single(b); >> a/b ans = 1.9074 e-05 the problem of course become much more compounded when doing more higher level functions such as detrend. I am completely unable to do a linear detrend on single precious data. regards Ali From Jan.Schoffelen at FCDONDERS.RU.NL Tue Nov 28 14:12:28 2006 From: Jan.Schoffelen at FCDONDERS.RU.NL (Jan Mathijs Schoffelen) Date: Tue, 28 Nov 2006 14:12:28 +0100 Subject: operations on single precision numbers unstable in matlab 7.1 (64bit ) vesions and higher In-Reply-To: <456C31A9.9080300@fcdonders.ru.nl> Message-ID: Dear Ali, What about temporarily converting your data into double precision, and doing your stuff? data = struct2double(data); DO YOUR STUFF HERE data = struct2single(data); Yours, JM -----Original Message----- From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf Of Ali Mazaheri Sent: Tuesday, November 28, 2006 1:55 PM To: FIELDTRIP at NIC.SURFNET.NL Subject: [FIELDTRIP] operations on single precision numbers unstable in matlab 7.1 (64bit ) vesions and higher Dear all, The long subject captions says it all. I just recently discovered that solutions to the low level functions in matlab7.1 and higher run on a 64 bit platform become unstable when using single precision. This problem does not appear to be present on matlabs running on a 32 bit platform. . A simple example of this problem is as follows a=[1 2] b=[1 2]; >> a/b ans = 1 NOW in single precision a=single(a); b=single(b); >> a/b ans = 1.9074 e-05 the problem of course become much more compounded when doing more higher level functions such as detrend. I am completely unable to do a linear detrend on single precious data. regards Ali From r.oostenveld at FCDONDERS.RU.NL Tue Nov 28 16:47:03 2006 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Tue, 28 Nov 2006 16:47:03 +0100 Subject: operations on single precision numbers unstable in matlab 7.1 (64bit ) vesions and higher In-Reply-To: <456C31A9.9080300@fcdonders.ru.nl> Message-ID: Dear all, Ali quite convincingly demonstrated this bug in Matlab. Sofar, we have only seen it on the 64 bit linux machines running 64 bit matlab, which means all the nodes in the FCDC mentat cluster. Desktop PCs running a 32 bit version of Windows+matlab are not affected. Also 32 bit linux machines (e.g. loke and odin in the FCDC) are unaffected. I don't know about 64 bit Mac OS X versions, but the 32 bit Mac OS X does not have a problem either. We are not yet running 64 bit Windows at the FCDC, so we do not have experience with those yet. Regarding fieldtrip: if you want to use single precision (to save memory/quota), I suggest that you only store the data on disk in single precision, and that you do struct2double (as JM suggested) as soon as you read the data from disk. I will contact Mathworks about this serious bug. best regards Robert On 28 Nov 2006, at 13:55, Ali Mazaheri wrote: > Dear all, > The long subject captions says it all. > I just recently discovered that solutions to the low level > functions in matlab7.1 and higher run on a 64 bit platform become > unstable when using single precision. > This problem does not appear to be present on matlabs running on a > 32 bit platform. > > . > A simple example of this problem is as follows > > a=[1 2] > b=[1 2]; > > >> a/b > ans = 1 > > NOW in single precision > > a=single(a); > b=single(b); > >> a/b > ans = 1.9074 e-05 > > > the problem of course become much more compounded when doing more > higher level functions such as detrend. I am completely unable to > do a linear detrend on > single precious data. > > > regards > Ali > From sdim14hg at T2.TECHNION.AC.IL Tue Nov 28 20:05:50 2006 From: sdim14hg at T2.TECHNION.AC.IL (Hanukaev Dmitri) Date: Tue, 28 Nov 2006 20:05:50 +0100 Subject: sourcestatistics_randcluster Message-ID: Hello We want to perform a T-dependent statistics test and to find the time- space clusters. The data has two condition and N replication (12 patient) and was acquired using the Loreta software. We used the loreta2fieldtrip.m function convert it to a fieldtrip structure. Now after the conversion we want to perform the test but we aren't sure which sourcestatistics function to use. We think that we need to use the sourcestatistics_randcluster function but don’t sure how to arrange the data and how to perform it on all the replications. sincerely From litvak at TX.TECHNION.AC.IL Tue Nov 28 20:33:02 2006 From: litvak at TX.TECHNION.AC.IL (Vladimir Litvak) Date: Tue, 28 Nov 2006 19:33:02 -0000 Subject: Some issues in freqanalysis Message-ID: Dear Robert and all, I'm writing a new script for analysis of MEG data and I encountered some problems with FT (I'm using 20061029 version): 1) In freqdescriptives the lines 494 and 515 seem to be redundant and also don't work and cause a crash. 2) there are some missing functions: inputlabel2outputlabel called by freqdescriptives, line 234 fourier2crsspctrm called by freqdescriptives, line 290 Can you please explain to me what cfg.combinechan in freqdescriptives does (I'm new to MEG which might explain my ignorance)? Finally, I would like to compute coherence from data of a single subject with 300 trials and check whether it is significant (i.e. not random). I don't think I can use any of the nonparametric stuff because I don't have a baseline. It seems to me that I should use the jackknife SEMs. How exactly? Should I use the bias correction? Should I take 2*SEM as the threshold? Thanks, Vladimir -------------- next part -------------- An HTML attachment was scrubbed... URL: From Jan.Schoffelen at FCDONDERS.RU.NL Tue Nov 28 23:24:19 2006 From: Jan.Schoffelen at FCDONDERS.RU.NL (Jan Mathijs Schoffelen) Date: Tue, 28 Nov 2006 23:24:19 +0100 Subject: Some issues in freqanalysis In-Reply-To: <009301c71324$055adde0$f0463ec1@sobell.ion.ucl.ac.uk> Message-ID: Dear Vladimir, Regarding the missing functions: you are absolutely right. The functions will be added to the latest release. Regarding the crash: I don't know what is happening there, and I do not have any experience with the option biascorrect. You'll have to ask Eric about this. Does it still crash when you use cfg.biascorrect = 'no'? This might already solve your problem. cfg.combinechan is a rather obscure option (and is set to 'no' by default) in freqdescriptives which is (as far as I know) undocumented. It has to do with combining planar gradiometer representation back into an axial gradiometer representation in order to be able to compute coherence between sensor-combinations (in their original axial representation). As a matter of fact, it is an option which has a high 'don't try this at home'-content. At least a correct behavior is not guaranteed. Anyhow, it should run through even when it is not specified. If you want to test coherence against 0, the jack-knife estimate of the variance is not going to help you too much. Rather, you could use some kind of Z-transformation as proposed by Jarvis & Mitra Neural computation 2001, or the Z-transformation that is described in James Kilner's papers, or from the Rosenberg group. In this context, the coherence can be parametrically evaluated. Another possibility is using a 'shiftpredictor' to estimate the bias, meaning that you shuffle the trial order of one of the two channels in your channel-combination (only works when taking fourier as an output of freqanalysis). In my experience this only works if you use an external reference signal, such as the EMG. Hope this gives some handles, Jan-Mathijs _____ From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf Of Vladimir Litvak Sent: Tuesday, November 28, 2006 8:33 PM To: FIELDTRIP at NIC.SURFNET.NL Subject: [FIELDTRIP] Some issues in freqanalysis Dear Robert and all, I'm writing a new script for analysis of MEG data and I encountered some problems with FT (I'm using 20061029 version): 1) In freqdescriptives the lines 494 and 515 seem to be redundant and also don't work and cause a crash. 2) there are some missing functions: inputlabel2outputlabel called by freqdescriptives, line 234 fourier2crsspctrm called by freqdescriptives, line 290 Can you please explain to me what cfg.combinechan in freqdescriptives does (I'm new to MEG which might explain my ignorance)? Finally, I would like to compute coherence from data of a single subject with 300 trials and check whether it is significant (i.e. not random). I don't think I can use any of the nonparametric stuff because I don't have a baseline. It seems to me that I should use the jackknife SEMs. How exactly? Should I use the bias correction? Should I take 2*SEM as the threshold? Thanks, Vladimir -------------- next part -------------- An HTML attachment was scrubbed... URL: From r.oostenveld at FCDONDERS.RU.NL Wed Nov 29 09:08:47 2006 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Wed, 29 Nov 2006 09:08:47 +0100 Subject: sourcestatistics_randcluster In-Reply-To: Message-ID: On 28 Nov 2006, at 20:05, Hanukaev Dmitri wrote: > We want to perform a T-dependent statistics test and to find the time- > space clusters. > The data has two condition and N replication (12 patient) and was > acquired using the Loreta software. We used the loreta2fieldtrip.m > function convert it to a fieldtrip structure. > Now after the conversion we want to perform the test but we aren't > sure > which sourcestatistics function to use. For statistical testing with space-time clusters, you have to use a non-parametric randomization test. The single sample (voxel/ timepoint) statistic can be a dependent-T value, which then will be clustered over neighbouring voxels and timepoints. So you should use sourcestatistics itself, with cfg.method=montecarlo and cfg.correctm=cluster. The functions sourcestatistics_randomization and sourcestatistics_randcluster are implemented to test a hypothesis for single subject source reconstructions in which the data was randomized between two conditions prior to computing the source reconstruction. In your case, you want to randomize between conditions over subjects so these functions do not apply. Note that 4D clustering (x,y,z,time) is rather experimental, and I am not sure whether the bookkeeping aspects of the code will work smoothly. Please read the help of sourcestatistics and of statistics_montecarlo. Keep us posted on whether it works, and please do report it if you encounter problems. I suggest that you use the feature "dbstop if error" in Matlab together with the matlab debugger. best regards, Robert From maris at NICI.RU.NL Wed Nov 29 11:13:00 2006 From: maris at NICI.RU.NL (Eric Maris) Date: Wed, 29 Nov 2006 11:13:00 +0100 Subject: Some issues in freqanalysis In-Reply-To: <009301c71324$055adde0$f0463ec1@sobell.ion.ucl.ac.uk> Message-ID: Dear Vladimir, 1) In freqdescriptives the lines 494 and 515 seem to be redundant and also don't work and cause a crash. This is a stupid bug due to an erroneous copy-paste. It is corrected now. I would always set the biascorrect-option to 'yes' because it produces less biased coherence estimates. However, in practice it only makes a substantial difference if the number of trials is small. Try it out for yourself. Greetings, Eric -------------- next part -------------- An HTML attachment was scrubbed... URL: From litvak at TX.TECHNION.AC.IL Wed Nov 29 11:33:51 2006 From: litvak at TX.TECHNION.AC.IL (Vladimir Litvak) Date: Wed, 29 Nov 2006 10:33:51 -0000 Subject: Some issues in freqanalysis In-Reply-To: <010d01c7133b$f2c6c6e0$902dae83@fcdonders.nl> Message-ID: Dear Eric and Jan-Mathijs, My reference channel is indeed EMG. I thought about this trial shuffling idea myself over night. It can actually be combined with clustering in channel/frequency space. Is there a way to do it with the current version of statistics routines or should it be programmed by hand? Thanks, Vladimir _____ From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf Of Jan Mathijs Schoffelen Sent: Tuesday, November 28, 2006 10:24 PM To: FIELDTRIP at NIC.SURFNET.NL Subject: Re: [FIELDTRIP] Some issues in freqanalysis Dear Vladimir, Regarding the missing functions: you are absolutely right. The functions will be added to the latest release. Regarding the crash: I don't know what is happening there, and I do not have any experience with the option biascorrect. You'll have to ask Eric about this. Does it still crash when you use cfg.biascorrect = 'no'? This might already solve your problem. cfg.combinechan is a rather obscure option (and is set to 'no' by default) in freqdescriptives which is (as far as I know) undocumented. It has to do with combining planar gradiometer representation back into an axial gradiometer representation in order to be able to compute coherence between sensor-combinations (in their original axial representation). As a matter of fact, it is an option which has a high 'don't try this at home'-content. At least a correct behavior is not guaranteed. Anyhow, it should run through even when it is not specified. If you want to test coherence against 0, the jack-knife estimate of the variance is not going to help you too much. Rather, you could use some kind of Z-transformation as proposed by Jarvis & Mitra Neural computation 2001, or the Z-transformation that is described in James Kilner's papers, or from the Rosenberg group. In this context, the coherence can be parametrically evaluated. Another possibility is using a 'shiftpredictor' to estimate the bias, meaning that you shuffle the trial order of one of the two channels in your channel-combination (only works when taking fourier as an output of freqanalysis). In my experience this only works if you use an external reference signal, such as the EMG. Hope this gives some handles, Jan-Mathijs _____ From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf Of Vladimir Litvak Sent: Tuesday, November 28, 2006 8:33 PM To: FIELDTRIP at NIC.SURFNET.NL Subject: [FIELDTRIP] Some issues in freqanalysis Dear Robert and all, I'm writing a new script for analysis of MEG data and I encountered some problems with FT (I'm using 20061029 version): 1) In freqdescriptives the lines 494 and 515 seem to be redundant and also don't work and cause a crash. 2) there are some missing functions: inputlabel2outputlabel called by freqdescriptives, line 234 fourier2crsspctrm called by freqdescriptives, line 290 Can you please explain to me what cfg.combinechan in freqdescriptives does (I'm new to MEG which might explain my ignorance)? Finally, I would like to compute coherence from data of a single subject with 300 trials and check whether it is significant (i.e. not random). I don't think I can use any of the nonparametric stuff because I don't have a baseline. It seems to me that I should use the jackknife SEMs. How exactly? Should I use the bias correction? Should I take 2*SEM as the threshold? Thanks, Vladimir -------------- next part -------------- An HTML attachment was scrubbed... URL: From jeremiemattout at YAHOO.FR Wed Nov 29 12:57:55 2006 From: jeremiemattout at YAHOO.FR (Jeremie MATTOUT) Date: Wed, 29 Nov 2006 11:57:55 +0000 Subject: [FIELDTRIP] reading .sdq format Message-ID: Dear Robert, > I saw on the fieldtrip web site that some functions should be > available from the fieldtrip FTP server. > However I have not been able to download them. Any help would be > most welcome. The documentatino and a link to the ftp server is given here http:// www2.ru.nl/fcdonders/fieldtrip/doku.php? id=fieldtrip:documentation:dataformats#support_for_yokogawa_meg_data The problem is that the .zip file for that format is empty. Actually, the lst fileio...zip is empty as well! > To be a bit more precise, I am looking for a filter that would > import those data format directly into Matlab or, alternatively, > that would enable me to produce binary (.bin) files that I should > then be able to convert into Matlab. I suggest that you download the fileio module and use the Matlab interface described here http://www2.ru.nl/fcdonders/fieldtrip/ doku.php?id=fieldtrip:development:fileio That requires that you drop the yokogawa specific functions in the "private" directory. I've downloaded the most recent fileio.zip available but the keyval.m function was missing !? Thanks very much for your help. Best, Jeremie ___________________________________________________________________________ Yahoo! Mail réinvente le mail ! Découvrez le nouveau Yahoo! Mail et son interface révolutionnaire. http://fr.mail.yahoo.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From Jan.Schoffelen at FCDONDERS.RU.NL Wed Nov 29 13:01:01 2006 From: Jan.Schoffelen at FCDONDERS.RU.NL (Jan Mathijs Schoffelen) Date: Wed, 29 Nov 2006 13:01:01 +0100 Subject: Some issues in freqanalysis In-Reply-To: <00a801c713a1$dcb1f120$f0463ec1@sobell.ion.ucl.ac.uk> Message-ID: Dear Vladimir, You can do it when you create a clever statfun_blabla. I assume you are familiar with the new statistics-framework in fieldtrip. What you now can do, is to put your reshaped EMG-fourierdata into your design such that it is "Nvox" (=reshaped channel*freq*time) x Ntapers (do you use multitapering?). Important is to append a row to the design which specifies the trial-number from which the taper was coming from. I guess you should then define this row-number as the the corresponding cfg.cvar, or uvar, or something. What your statfun_blabla then should output is the coherence, computed between the input-data dat (which is the reshaped MEG-fourierspectra), and the "design". To this end, I would reshape the data back into the original TFR-dimensions (there should be a dim in the cfg which is passed to the statfun), and extract the EMG-data from the design, which will be shuffled in the taper-dimension when running the randomization, which is exactly what you want, and write some for-loops around the critical computation, which involves some cross-spectral density computations, according to fft1*ctranspose(fft2) and power-spectral density computations, according to diag(fft1*ctranspose(fft1)). In short, the usual business. Do you have some handles to proceed? Yours, Jan-Mathijs _____ From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf Of Vladimir Litvak Sent: Wednesday, November 29, 2006 11:34 AM To: FIELDTRIP at NIC.SURFNET.NL Subject: Re: [FIELDTRIP] Some issues in freqanalysis Dear Eric and Jan-Mathijs, My reference channel is indeed EMG. I thought about this trial shuffling idea myself over night. It can actually be combined with clustering in channel/frequency space. Is there a way to do it with the current version of statistics routines or should it be programmed by hand? Thanks, Vladimir _____ From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf Of Jan Mathijs Schoffelen Sent: Tuesday, November 28, 2006 10:24 PM To: FIELDTRIP at NIC.SURFNET.NL Subject: Re: [FIELDTRIP] Some issues in freqanalysis Dear Vladimir, Regarding the missing functions: you are absolutely right. The functions will be added to the latest release. Regarding the crash: I don't know what is happening there, and I do not have any experience with the option biascorrect. You'll have to ask Eric about this. Does it still crash when you use cfg.biascorrect = 'no'? This might already solve your problem. cfg.combinechan is a rather obscure option (and is set to 'no' by default) in freqdescriptives which is (as far as I know) undocumented. It has to do with combining planar gradiometer representation back into an axial gradiometer representation in order to be able to compute coherence between sensor-combinations (in their original axial representation). As a matter of fact, it is an option which has a high 'don't try this at home'-content. At least a correct behavior is not guaranteed. Anyhow, it should run through even when it is not specified. If you want to test coherence against 0, the jack-knife estimate of the variance is not going to help you too much. Rather, you could use some kind of Z-transformation as proposed by Jarvis & Mitra Neural computation 2001, or the Z-transformation that is described in James Kilner's papers, or from the Rosenberg group. In this context, the coherence can be parametrically evaluated. Another possibility is using a 'shiftpredictor' to estimate the bias, meaning that you shuffle the trial order of one of the two channels in your channel-combination (only works when taking fourier as an output of freqanalysis). In my experience this only works if you use an external reference signal, such as the EMG. Hope this gives some handles, Jan-Mathijs _____ From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf Of Vladimir Litvak Sent: Tuesday, November 28, 2006 8:33 PM To: FIELDTRIP at NIC.SURFNET.NL Subject: [FIELDTRIP] Some issues in freqanalysis Dear Robert and all, I'm writing a new script for analysis of MEG data and I encountered some problems with FT (I'm using 20061029 version): 1) In freqdescriptives the lines 494 and 515 seem to be redundant and also don't work and cause a crash. 2) there are some missing functions: inputlabel2outputlabel called by freqdescriptives, line 234 fourier2crsspctrm called by freqdescriptives, line 290 Can you please explain to me what cfg.combinechan in freqdescriptives does (I'm new to MEG which might explain my ignorance)? Finally, I would like to compute coherence from data of a single subject with 300 trials and check whether it is significant (i.e. not random). I don't think I can use any of the nonparametric stuff because I don't have a baseline. It seems to me that I should use the jackknife SEMs. How exactly? Should I use the bias correction? Should I take 2*SEM as the threshold? Thanks, Vladimir -------------- next part -------------- An HTML attachment was scrubbed... URL: From litvak at TX.TECHNION.AC.IL Wed Nov 29 14:16:26 2006 From: litvak at TX.TECHNION.AC.IL (Vladimir Litvak) Date: Wed, 29 Nov 2006 13:16:26 -0000 Subject: Some issues in freqanalysis In-Reply-To: <013101c713ae$09bdf630$902dae83@fcdonders.nl> Message-ID: This sounds like a lot of work and I don't have much experience yet with the new statistics framework since I've used the old one until now. I think at this stage I'm not motivated enough to get into this and I'll try to find a simpler way to put some sensible error bars on the coherence. If you are planning to implement this anyway at a later stage I might be interested in contributing. Best, Vladimir _____ From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf Of Jan Mathijs Schoffelen Sent: Wednesday, November 29, 2006 12:01 PM To: FIELDTRIP at NIC.SURFNET.NL Subject: Re: [FIELDTRIP] Some issues in freqanalysis Dear Vladimir, You can do it when you create a clever statfun_blabla. I assume you are familiar with the new statistics-framework in fieldtrip. What you now can do, is to put your reshaped EMG-fourierdata into your design such that it is "Nvox" (=reshaped channel*freq*time) x Ntapers (do you use multitapering?). Important is to append a row to the design which specifies the trial-number from which the taper was coming from. I guess you should then define this row-number as the the corresponding cfg.cvar, or uvar, or something. What your statfun_blabla then should output is the coherence, computed between the input-data dat (which is the reshaped MEG-fourierspectra), and the "design". To this end, I would reshape the data back into the original TFR-dimensions (there should be a dim in the cfg which is passed to the statfun), and extract the EMG-data from the design, which will be shuffled in the taper-dimension when running the randomization, which is exactly what you want, and write some for-loops around the critical computation, which involves some cross-spectral density computations, according to fft1*ctranspose(fft2) and power-spectral density computations, according to diag(fft1*ctranspose(fft1)). In short, the usual business. Do you have some handles to proceed? Yours, Jan-Mathijs _____ From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf Of Vladimir Litvak Sent: Wednesday, November 29, 2006 11:34 AM To: FIELDTRIP at NIC.SURFNET.NL Subject: Re: [FIELDTRIP] Some issues in freqanalysis Dear Eric and Jan-Mathijs, My reference channel is indeed EMG. I thought about this trial shuffling idea myself over night. It can actually be combined with clustering in channel/frequency space. Is there a way to do it with the current version of statistics routines or should it be programmed by hand? Thanks, Vladimir _____ From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf Of Jan Mathijs Schoffelen Sent: Tuesday, November 28, 2006 10:24 PM To: FIELDTRIP at NIC.SURFNET.NL Subject: Re: [FIELDTRIP] Some issues in freqanalysis Dear Vladimir, Regarding the missing functions: you are absolutely right. The functions will be added to the latest release. Regarding the crash: I don't know what is happening there, and I do not have any experience with the option biascorrect. You'll have to ask Eric about this. Does it still crash when you use cfg.biascorrect = 'no'? This might already solve your problem. cfg.combinechan is a rather obscure option (and is set to 'no' by default) in freqdescriptives which is (as far as I know) undocumented. It has to do with combining planar gradiometer representation back into an axial gradiometer representation in order to be able to compute coherence between sensor-combinations (in their original axial representation). As a matter of fact, it is an option which has a high 'don't try this at home'-content. At least a correct behavior is not guaranteed. Anyhow, it should run through even when it is not specified. If you want to test coherence against 0, the jack-knife estimate of the variance is not going to help you too much. Rather, you could use some kind of Z-transformation as proposed by Jarvis & Mitra Neural computation 2001, or the Z-transformation that is described in James Kilner's papers, or from the Rosenberg group. In this context, the coherence can be parametrically evaluated. Another possibility is using a 'shiftpredictor' to estimate the bias, meaning that you shuffle the trial order of one of the two channels in your channel-combination (only works when taking fourier as an output of freqanalysis). In my experience this only works if you use an external reference signal, such as the EMG. Hope this gives some handles, Jan-Mathijs _____ From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf Of Vladimir Litvak Sent: Tuesday, November 28, 2006 8:33 PM To: FIELDTRIP at NIC.SURFNET.NL Subject: [FIELDTRIP] Some issues in freqanalysis Dear Robert and all, I'm writing a new script for analysis of MEG data and I encountered some problems with FT (I'm using 20061029 version): 1) In freqdescriptives the lines 494 and 515 seem to be redundant and also don't work and cause a crash. 2) there are some missing functions: inputlabel2outputlabel called by freqdescriptives, line 234 fourier2crsspctrm called by freqdescriptives, line 290 Can you please explain to me what cfg.combinechan in freqdescriptives does (I'm new to MEG which might explain my ignorance)? Finally, I would like to compute coherence from data of a single subject with 300 trials and check whether it is significant (i.e. not random). I don't think I can use any of the nonparametric stuff because I don't have a baseline. It seems to me that I should use the jackknife SEMs. How exactly? Should I use the bias correction? Should I take 2*SEM as the threshold? Thanks, Vladimir -------------- next part -------------- An HTML attachment was scrubbed... URL: From wibral at MPIH-FRANKFURT.MPG.DE Wed Nov 29 15:11:17 2006 From: wibral at MPIH-FRANKFURT.MPG.DE (Michael Wibral) Date: Wed, 29 Nov 2006 15:11:17 +0100 Subject: Reading in data from a new CTF system with ECC Message-ID: Hi, I'm trying to read in data from a CTF 275 channel system. It is equipped with the new ECC console that now (among other things) is responsible for the triggers from presentation. These 'triggers' are written to the channel UPPT001 (indicating that they arrive on the first parallel port of the Acq computer?). We record in a 'pseudo trial'ed fashion i.e. one trigger starts the acquistion of one long trial, other triggers are written to the UPPT001 channel but do not chop the data. There is also a truly continous recording resulting in an ...aux.ds file but that's still experimental CTF said. When I use trialfun_ctf_continuous to read in the data no triggers are found and as a consequence no trials are defined - I wonder whether there is a problem with things like the 'STIM' channel and the [backpanel, frontpanel] stuff as the machine doesn't seem to have any back or frontpanel - but the ECC instead. I have also tried to trial the data inside the CTF Software (using newDs with the corresponding markers) and then to use trialfun_ctf_epoched with the same result. BESA reads the triggers however without problems, both, their values (1,2,3...) and der names. so I think the data format shouldn't have changed too much. here is the code (with variations) that I have tried so far - any suggestions?: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Reading CTF .ds data files and preprocess them %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% clear all; fclose('all'); pathname ='/home/wibral/DATA/BAM_EEGIIIRC_oldTime/'; % I used either continuous or epoched data filename='ASL30_AMMEGIIIRC_20061124_01.ds'; % filename='ASL30_AMMEGIIIRC_20061124_01_trials.ds'; FullName=strcat(pathname,filename); % build analysis configuration cfg=[]; cfg.channel={'MEG' 'UPPT001'}; % also tried 'STIM' instead cfg.dataset=FullName; cfg.trialfun='trialfun_ctf_continuous'; % also tried ..._epoched % I tried either of the following three lines cfg.trialdef.trigger=2; cfg.trialdef.stim = 2; cfg.trialdef.includeTrigger= 2; % I also tried strings given in the markers file instead... % this doesn't result in any output either...interestingly cfg.trialdef.eventtype='?'; cfg.trialdef.excludeConditions={'BAD'}; % I also tried to give a trigger file separately: % cfg.trialdef.trgfile= strcat(FullName,'/','MarkerFile.mrk'); cfg.trialdef.prestim=0.5; cfg.trialdef.poststim=1; cfg=definetrial(cfg); cfg.blc='yes'; cfg.blcwindow=[-0.2 0]; DataName=strcat('data_trigger_',num2str(cfg.trialdef.includeTrigger)); EvalStr=strcat(DataName,'=preprocessing(cfg);'); eval(EvalStr); Any help is appreciated. Thank you very much. Best Regards, Michael Wibral From r.oostenveld at FCDONDERS.RU.NL Wed Nov 29 18:14:05 2006 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Wed, 29 Nov 2006 18:14:05 +0100 Subject: Reading in data from a new CTF system with ECC In-Reply-To: <06112915111720_2800013E@mpih-frankfurt.mpg.de> Message-ID: Hi Michael On 29 Nov 2006, at 15:11, Michael Wibral wrote: > I'm trying to read in data from a CTF 275 channel system. > ... > When I use trialfun_ctf_continuous to read in the data no triggers are > found and as a consequence no trials are defined - I wonder whether > there is a problem with things like the 'STIM' channel and the > [backpanel, frontpanel] stuff as the machine doesn't seem to have any > back or frontpanel - but the ECC instead. I indeed think that the problem is that trialfun_ctf_continuous assumes back and frontpanel. The code in that trialfun predates the read_event code, and it is not maintained. You can use trialfun_general instead, or make your own trialfun. Read the help of definetrial to see what trialfun_general can do for you (not too much, but it might be enough). Alternatively, have a look at the bottom of the page http://www2.ru.nl/fcdonders/fieldtrip/doku.php? id=fieldtrip:documentation:tutorial:eventrelatedaveraging to see a straightforward example trialfun. For that, you should also look into read_fcdc_event. We also use pseudocontinuous data at the Donders. Note that you have to do cfg.datatype='continuous' in preprocessing and artifact detection. > I have also tried to trial the data inside the CTF Software (using > newDs > with the corresponding markers) and then to use trialfun_ctf_epoched > with the same result. Also the trialfun_ctf_epoched is very old. > BESA reads the triggers however without problems, both, their values > (1,2,3...) and der names. so I think the data format shouldn't have > changed too much. No, the dataformat indeed did not change that much. It is also already implemented in the read_fcdc_event code, and the general trial function (or custom trial functions) can work with it. best regards, Robert From Brian.Roach at YALE.EDU Wed Nov 29 18:20:14 2006 From: Brian.Roach at YALE.EDU (Brian Roach) Date: Wed, 29 Nov 2006 12:20:14 -0500 Subject: freqanalysis_wltconvol.m question In-Reply-To: <000f01c70d3a$f122ea50$902dae83@fcdonders.nl> Message-ID: Thanks again, I have just one last follow-up question: Why would you square the final ITC? Tallon-Baudry et al. do not do this in their j Neurosci. '97 publication. Brian At 02:02 AM 11/21/2006, Jan Mathijs Schoffelen wrote: >Dear Brian et al, > > >---------- >From: Brian Roach [mailto:Brian.Roach at yale.edu] >Sent: Monday, November 20, 2006 11:56 PM >To: Jan Mathijs Schoffelen >Subject: Re: [FIELDTRIP] freqanalysis_wltconvol.m question > >Hi, I could not get this posted to the list, and figured since you gave >most of the feedback, I would see what you think. > >thanks, >Brian > > >Date: Mon, 13 Nov 2006 12:09:00 -0500 >To: FieldTrip discussion list >From: Brian Roach >Subject: Re: [FIELDTRIP] freqanalysis_wltconvol.m question >Bcc: Daniel Mathalon > >Thanks for the advice, I am wondering if FT users would agree that this >is an acceptable way to estimate univariate phase coherence: > >In freqanalysis_wltconvol.m, line 283: > % powdum = (2.* abs(autspctrmacttap) ./ > data.fsample) .^ 2; > powdum = (2.*autspctrmacttap ./ data.fsample); > >1. I've commented out the power line and inserted basically the same thing >(but not squared) >2. As suggested, I change cfg.keeptrials = 'yes'; >3. After running freqanalysis.m, in the command prompt: > itc = > abs(mean(squeeze(freq.powspctrm)./abs(squeeze(freq.powspctrm)),1)) > >squeeze is used because freq.powspctrm is a 3 d matrix including sites, >times, and frequencies and in the above case I am just getting itc from 1 >channel. Does this method seem alright? Regarding step #1 above, it >seemed to make no difference whether I left the 2.* in that equation or >not, which seems consistent with an earlier e-mail that mentioned this >multiplication being tied into power, so it does not influence phase >angle. Is that right? Or, should it be taken out for my purposes? > >thanks, >Brian > >This looks fine to me. Indeed the factor of 2 does not affect the outcome, >because it falls out in the division (normalization) step. > >Yours, > >Jan-Mathijs > >PS: you might have to think about whether or not to square the final itc, >to make it consistent with the way it is defined in the literature. > > > >At 04:37 AM 11/9/2006, you wrote: > >Dear Brian, > >Freqanalysis_wltconvol does not support fourier as an output. However, since >wavelet-analysis and fft's in the end are about the same thingy, you could >use freqanalysis_mtmconvol to achieve your goal. >There is a tutorial on the fieldtrip-website which deals with this function, >and uses it in a way that it resembles a wavelet-analysis, in which the >time-frequency resolution is treated in the same way as with standard >wavelet-analysis. > >Phase-locking-value is defined in fieldtrip as a bivariate-measure, so that >means that it quantifies how consistent the phase-relation between two >channels is across trials. >Inter-trial coherence is a bit an odd thingy, because the term coherence >suggests something bivariate, but the way you would like to use it, is >essentially univariate. You want to estimate how consistent the phase of the >oscillations at a particular channel is across trials. >However, both measures use similar math. In fact, when you create a >dummy-fourier-channel you can use the plv-option to obtain your 'itc'. This >is because in this situation, the mathematics become identical. I would >advise it like this: > >Do your freqanalysis as Robert suggested in one of his previous mails (see >below (cfg.keeptapers = 'yes')). >Then create a dummy channel: > >dim = size(freq.fourierspctrm; >freq.fourierspctrm(:,end+1,:,:) = ones(dim([1 3 4])); >freq.label = 'dummy'; > >cfg = []; >cfg.cohmethod = 'plv'; >cfg.channelcmb = channelcombination({'dummy' 'all'}, freq.label); %should >work > >itc = freqdescriptives(cfg, freq); > >Your 'itc' now is contained in the field itc.cohspctrm; > >The check whether this is correctly done is done outside fieldtrip: > >itc2 = abs(mean(freq.fourierspctrm./abs(freq.fourierspctrm),1)); > >Yours, > >Jan-Mathijs > > >-----Original Message----- >From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf >Of Brian Roach >Sent: Wednesday, November 08, 2006 11:13 PM >To: FIELDTRIP at NIC.SURFNET.NL >Subject: Re: [FIELDTRIP] freqanalysis_wltconvol.m question > >Robert, >Thanks for your quick reply. I did not realize that >freqanalysis_wltconvol.m allowed for 'fourier' output, but maybe I need to >download the latest version. Or, do you mean I should use freqanalysis_mtm >instead? Also, how does ITC differ from phase-locking value? I thought >they were the same measure. >At 04:56 PM 11/8/2006, you wrote: > >Hi Brian > > > >On 8 Nov 2006, at 21:20, Brian Roach wrote: > >>eI would like to take this complex output and use it to calculate > >>phase-locking factor, but I am not sure what parts of the power > >>transformation need to be removed - just the abs() and the > >>squaring? Clarification of this line of code would be extremely > >>helpful to me. > > > >You can use the existing code for that: > > > >For computing the phase-locking value I suggest that you use either > > cfg.output='fourier' > > cfg.keeptrials='yes' > > cfg.keeptapers='yes' > >or > > cfg.output='fourier' > > cfg.keeptrials='yes' > > cfg.keeptapers='no' (not needed now) > > cfg.channelcmb = something, see the help > >in freqanalysis. > > > >Subsequently, use the option > > cfg.cohmethod='plv' > >in freqdescriptives. In case of fourier output in freqanalysis, you > >should specify the channel combinations here. > > > >... > >Looking back at your previous mail, I see that you mean ITC and not > >PLV. The stuff above then does not apply. You can do output=fourier > >in freqanalysis and work manually on the output freq structure. I > >think that this should work > > > >magnitude = abs(freq.fourierspctrm); > >scaled = freq.fourierspctrm ./ magnitude; > >freq.itcspctrm = mean(scaled, 1); > >freq = rmfield(freq, 'fourierspctrm'); % remove the single > >fourierspectrum, to avoid confusion > >freq.dimord = 'chan_freq_time'; % remove the rpt or rpttap > >dimension > > > >best regards, > >Robert > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From r.oostenveld at FCDONDERS.RU.NL Wed Nov 29 18:20:26 2006 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Wed, 29 Nov 2006 18:20:26 +0100 Subject: [FIELDTRIP] reading .sdq format In-Reply-To: <20061129115755.65556.qmail@web26015.mail.ukl.yahoo.com> Message-ID: Hi Jeremie On 29 Nov 2006, at 12:57, Jeremie MATTOUT wrote: > The problem is that the .zip file for that format is empty. The yokogawa zip file indeed was corrupt, but I fixed it immediately after your previous mail. So please try again. (I just checked, it is now ok) > Actually, the lst fileio...zip is empty as well! Ok, I'll remove that. > I've downloaded the most recent fileio.zip available but the > keyval.m function was missing !? Sorry. I'll include it in future versions. Please find the keyval function attached, you can put it in private. best Robert PS version and release management is quite a lot of work, and sometimes stuff breaks the different versions of the modules. Thanks for letting me know, since it is something that I would not notice myself. -------------- next part -------------- A non-text attachment was scrubbed... Name: keyval.m Type: application/octet-stream Size: 726 bytes Desc: not available URL: -------------- next part -------------- From Pascal.Fries at FCDONDERS.RU.NL Wed Nov 29 21:18:06 2006 From: Pascal.Fries at FCDONDERS.RU.NL (Pascal Fries) Date: Wed, 29 Nov 2006 21:18:06 +0100 Subject: FW: Still getting NaNs Message-ID: I used freqanalysis_mtmconvol with output= fourier and then called freqdescriptives and got this error message: > ??? Reference to non-existent field 'cumtapcnt'. > > Error in ==> fourier2crsspctrm at 79 > Nrpt = length(freq.cumtapcnt); > > Error in ==> freqdescriptives at 290 > freq = fourier2crsspctrm(tmpcfg, freq); Why didn't freqanalysis give freq.cumtapcnt? Best, Pascal From Jan.Schoffelen at FCDONDERS.RU.NL Wed Nov 29 21:58:47 2006 From: Jan.Schoffelen at FCDONDERS.RU.NL (Jan Mathijs Schoffelen) Date: Wed, 29 Nov 2006 21:58:47 +0100 Subject: freqanalysis_wltconvol.m question In-Reply-To: <6.1.2.0.2.20061129121815.04dd3ec0@email.med.yale.edu> Message-ID: Dear Brian, Then I would say not to square it. Yours, Jan-Mathijs _____ From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf Of Brian Roach Sent: Wednesday, November 29, 2006 6:20 PM To: FIELDTRIP at NIC.SURFNET.NL Subject: Re: [FIELDTRIP] freqanalysis_wltconvol.m question Thanks again, I have just one last follow-up question: Why would you square the final ITC? Tallon-Baudry et al. do not do this in their j Neurosci. '97 publication. Brian At 02:02 AM 11/21/2006, Jan Mathijs Schoffelen wrote: Dear Brian et al, _____ From: Brian Roach [mailto:Brian.Roach at yale.edu] Sent: Monday, November 20, 2006 11:56 PM To: Jan Mathijs Schoffelen Subject: Re: [FIELDTRIP] freqanalysis_wltconvol.m question Hi, I could not get this posted to the list, and figured since you gave most of the feedback, I would see what you think. thanks, Brian Date: Mon, 13 Nov 2006 12:09:00 -0500 To: FieldTrip discussion list From: Brian Roach Subject: Re: [FIELDTRIP] freqanalysis_wltconvol.m question Bcc: Daniel Mathalon Thanks for the advice, I am wondering if FT users would agree that this is an acceptable way to estimate univariate phase coherence: In freqanalysis_wltconvol.m, line 283: % powdum = (2.* abs(autspctrmacttap) ./ data.fsample) .^ 2; powdum = (2.*autspctrmacttap ./ data.fsample); 1. I've commented out the power line and inserted basically the same thing (but not squared) 2. As suggested, I change cfg.keeptrials = 'yes'; 3. After running freqanalysis.m, in the command prompt: itc = abs(mean(squeeze(freq.powspctrm)./abs(squeeze(freq.powspctrm)),1)) squeeze is used because freq.powspctrm is a 3 d matrix including sites, times, and frequencies and in the above case I am just getting itc from 1 channel. Does this method seem alright? Regarding step #1 above, it seemed to make no difference whether I left the 2.* in that equation or not, which seems consistent with an earlier e-mail that mentioned this multiplication being tied into power, so it does not influence phase angle. Is that right? Or, should it be taken out for my purposes? thanks, Brian This looks fine to me. Indeed the factor of 2 does not affect the outcome, because it falls out in the division (normalization) step. Yours, Jan-Mathijs PS: you might have to think about whether or not to square the final itc, to make it consistent with the way it is defined in the literature. At 04:37 AM 11/9/2006, you wrote: Dear Brian, Freqanalysis_wltconvol does not support fourier as an output. However, since wavelet-analysis and fft's in the end are about the same thingy, you could use freqanalysis_mtmconvol to achieve your goal. There is a tutorial on the fieldtrip-website which deals with this function, and uses it in a way that it resembles a wavelet-analysis, in which the time-frequency resolution is treated in the same way as with standard wavelet-analysis. Phase-locking-value is defined in fieldtrip as a bivariate-measure, so that means that it quantifies how consistent the phase-relation between two channels is across trials. Inter-trial coherence is a bit an odd thingy, because the term coherence suggests something bivariate, but the way you would like to use it, is essentially univariate. You want to estimate how consistent the phase of the oscillations at a particular channel is across trials. However, both measures use similar math. In fact, when you create a dummy-fourier-channel you can use the plv-option to obtain your 'itc'. This is because in this situation, the mathematics become identical. I would advise it like this: Do your freqanalysis as Robert suggested in one of his previous mails (see below (cfg.keeptapers = 'yes')). Then create a dummy channel: dim = size(freq.fourierspctrm; freq.fourierspctrm(:,end+1,:,:) = ones(dim([1 3 4])); freq.label = 'dummy'; cfg = []; cfg.cohmethod = 'plv'; cfg.channelcmb = channelcombination({'dummy' 'all'}, freq.label); %should work itc = freqdescriptives(cfg, freq); Your 'itc' now is contained in the field itc.cohspctrm; The check whether this is correctly done is done outside fieldtrip: itc2 = abs(mean(freq.fourierspctrm./abs(freq.fourierspctrm),1)); Yours, Jan-Mathijs -----Original Message----- From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf Of Brian Roach Sent: Wednesday, November 08, 2006 11:13 PM To: FIELDTRIP at NIC.SURFNET.NL Subject: Re: [FIELDTRIP] freqanalysis_wltconvol.m question Robert, Thanks for your quick reply. I did not realize that freqanalysis_wltconvol.m allowed for 'fourier' output, but maybe I need to download the latest version. Or, do you mean I should use freqanalysis_mtm instead? Also, how does ITC differ from phase-locking value? I thought they were the same measure. At 04:56 PM 11/8/2006, you wrote: >Hi Brian > >On 8 Nov 2006, at 21:20, Brian Roach wrote: >>eI would like to take this complex output and use it to calculate >>phase-locking factor, but I am not sure what parts of the power >>transformation need to be removed - just the abs() and the >>squaring? Clarification of this line of code would be extremely >>helpful to me. > >You can use the existing code for that: > >For computing the phase-locking value I suggest that you use either > cfg.output='fourier' > cfg.keeptrials='yes' > cfg.keeptapers='yes' >or > cfg.output='fourier' > cfg.keeptrials='yes' > cfg.keeptapers='no' (not needed now) > cfg.channelcmb = something, see the help >in freqanalysis. > >Subsequently, use the option > cfg.cohmethod='plv' >in freqdescriptives. In case of fourier output in freqanalysis, you >should specify the channel combinations here. > >... >Looking back at your previous mail, I see that you mean ITC and not >PLV. The stuff above then does not apply. You can do output=fourier >in freqanalysis and work manually on the output freq structure. I >think that this should work > >magnitude = abs(freq.fourierspctrm); >scaled = freq.fourierspctrm ./ magnitude; >freq.itcspctrm = mean(scaled, 1); >freq = rmfield(freq, 'fourierspctrm'); % remove the single >fourierspectrum, to avoid confusion >freq.dimord = 'chan_freq_time'; % remove the rpt or rpttap >dimension > >best regards, >Robert > -------------- next part -------------- An HTML attachment was scrubbed... URL: From Jan.Schoffelen at FCDONDERS.RU.NL Wed Nov 29 22:02:04 2006 From: Jan.Schoffelen at FCDONDERS.RU.NL (Jan Mathijs Schoffelen) Date: Wed, 29 Nov 2006 22:02:04 +0100 Subject: FW: Still getting NaNs In-Reply-To: <001501c713f3$7b140a00$6de36391@fcdonders.nl> Message-ID: Dear Pascal, This is a known problem and should be fixed. The easiest workaround is to manually add a cumtapcnt prior to calling freqdescriptives: freq.cumtapcnt = ones(size(freq.fourierspctrm,1),1); Yours, Jan-Mathijs -----Original Message----- From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf Of Pascal Fries Sent: Wednesday, November 29, 2006 9:18 PM To: FIELDTRIP at NIC.SURFNET.NL Subject: [FIELDTRIP] FW: Still getting NaNs I used freqanalysis_mtmconvol with output= fourier and then called freqdescriptives and got this error message: > ??? Reference to non-existent field 'cumtapcnt'. > > Error in ==> fourier2crsspctrm at 79 > Nrpt = length(freq.cumtapcnt); > > Error in ==> freqdescriptives at 290 > freq = fourier2crsspctrm(tmpcfg, freq); Why didn't freqanalysis give freq.cumtapcnt? Best, Pascal From Pascal.Fries at FCDONDERS.RU.NL Wed Nov 29 22:05:14 2006 From: Pascal.Fries at FCDONDERS.RU.NL (Pascal Fries) Date: Wed, 29 Nov 2006 22:05:14 +0100 Subject: FW: Still getting NaNs In-Reply-To: <001701c713f9$9fb39780$902dae83@fcdonders.nl> Message-ID: Thanks!!! > -----Original Message----- > From: FieldTrip discussion list > [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf Of Jan Mathijs Schoffelen > Sent: Wednesday, 29 November, 2006 22:02 > To: FIELDTRIP at NIC.SURFNET.NL > Subject: Re: [FIELDTRIP] FW: Still getting NaNs > > Dear Pascal, > > This is a known problem and should be fixed. The easiest > workaround is to manually add a cumtapcnt prior to calling > freqdescriptives: > > freq.cumtapcnt = ones(size(freq.fourierspctrm,1),1); > > Yours, > > Jan-Mathijs > > > -----Original Message----- > From: FieldTrip discussion list > [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf Of Pascal Fries > Sent: Wednesday, November 29, 2006 9:18 PM > To: FIELDTRIP at NIC.SURFNET.NL > Subject: [FIELDTRIP] FW: Still getting NaNs > > > > I used freqanalysis_mtmconvol with output= fourier and then > called freqdescriptives and got this error message: > > > ??? Reference to non-existent field 'cumtapcnt'. > > > > Error in ==> fourier2crsspctrm at 79 > > Nrpt = length(freq.cumtapcnt); > > > > Error in ==> freqdescriptives at 290 > > freq = fourier2crsspctrm(tmpcfg, freq); > > Why didn't freqanalysis give freq.cumtapcnt? > > Best, Pascal > From wibral at MPIH-FRANKFURT.MPG.DE Wed Nov 29 22:22:41 2006 From: wibral at MPIH-FRANKFURT.MPG.DE (Michael Wibral) Date: Wed, 29 Nov 2006 22:22:41 +0100 Subject: Reading in data from a new CTF system with ECC Message-ID: Robert, thank you very much. The trialfun_general indeed does the job (at least for my simple design). Best Regards, Michael >Hi Michael > >On 29 Nov 2006, at 15:11, Michael Wibral wrote: >> I'm trying to read in data from a CTF 275 channel system. >> ... >> When I use trialfun_ctf_continuous to read in the data no triggers are >> found and as a consequence no trials are defined - I wonder whether >> there is a problem with things like the 'STIM' channel and the >> [backpanel, frontpanel] stuff as the machine doesn't seem to have any >> back or frontpanel - but the ECC instead. > >I indeed think that the problem is that trialfun_ctf_continuous >assumes back and frontpanel. The code in that trialfun predates the >read_event code, and it is not maintained. You can use >trialfun_general instead, or make your own trialfun. Read the help of >definetrial to see what trialfun_general can do for you (not too >much, but it might be enough). > >Alternatively, have a look at the bottom of the page >http://www2.ru.nl/fcdonders/fieldtrip/doku.php? >id=fieldtrip:documentation:tutorial:eventrelatedaveraging >to see a straightforward example trialfun. For that, you should also >look into read_fcdc_event. > >We also use pseudocontinuous data at the Donders. Note that you have >to do cfg.datatype='continuous' in preprocessing and artifact detection. > >> I have also tried to trial the data inside the CTF Software (using >> newDs >> with the corresponding markers) and then to use trialfun_ctf_epoched >> with the same result. > >Also the trialfun_ctf_epoched is very old. > >> BESA reads the triggers however without problems, both, their values >> (1,2,3...) and der names. so I think the data format shouldn't have >> changed too much. > >No, the dataformat indeed did not change that much. It is also >already implemented in the read_fcdc_event code, and the general >trial function (or custom trial functions) can work with it. > >best regards, >Robert From jeremiemattout at YAHOO.FR Thu Nov 30 10:30:34 2006 From: jeremiemattout at YAHOO.FR (Jeremie MATTOUT) Date: Thu, 30 Nov 2006 09:30:34 +0000 Subject: [FIELDTRIP] Re : [FIELDTRIP] reading .sdq format Message-ID: Dear Robert, thanks very much for your help and time. I now could access and run the routines. However, the .sqd fileformat does not seem to be supported. I don't know if I missed something here but if not, could anyone advise me on some filter routine that would enable me to then read them in Matlab? Best, Jeremie ----- Message d'origine ---- De : Robert Oostenveld À : FIELDTRIP at NIC.SURFNET.NL Envoyé le : Mercredi, 29 Novembre 2006, 17h20mn 26s Objet : Re: [FIELDTRIP] Re : [FIELDTRIP] reading .sdq format Hi Jeremie On 29 Nov 2006, at 12:57, Jeremie MATTOUT wrote: > The problem is that the .zip file for that format is empty. The yokogawa zip file indeed was corrupt, but I fixed it immediately after your previous mail. So please try again. (I just checked, it is now ok) > Actually, the lst fileio...zip is empty as well! Ok, I'll remove that. > I've downloaded the most recent fileio.zip available but the > keyval.m function was missing !? Sorry. I'll include it in future versions. Please find the keyval function attached, you can put it in private. best Robert PS version and release management is quite a lot of work, and sometimes stuff breaks the different versions of the modules. Thanks for letting me know, since it is something that I would not notice myself. ___________________________________________________________________________ Découvrez une nouvelle façon d'obtenir des réponses à toutes vos questions ! Profitez des connaissances, des opinions et des expériences des internautes sur Yahoo! Questions/Réponses http://fr.answers.yahoo.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From wibral at MPIH-FRANKFURT.MPG.DE Thu Nov 30 10:40:55 2006 From: wibral at MPIH-FRANKFURT.MPG.DE (Michael Wibral) Date: Thu, 30 Nov 2006 10:40:55 +0100 Subject: Reading data with trialfun_general Message-ID: Dear Robert, as I replied yesterday, trialfun_general does indeed create trials, at least if I directly specify eventtype as a string. If I however try to use eventvalues from the trigger channel (UPPT001 in my case) I noticed that FT changes the values from what presentation send (and from what BESA reads correctly) in the following way: Stimulus CTFdisplay BESAreading FTreading 'StimUpper' 2 2 3 'StimMiddle' 3 3 5 'StimLower' 4 4 7 i.e. it changes it from the first three numbers bigger than 1 to the first three odd numbers that are bigger than one. Is it possible that there is still some frontpanel+backpanel binary addition going on - even in trialfun_general? Thank you very much for your help. Best Regards, Michael From r.oostenveld at FCDONDERS.RU.NL Thu Nov 30 11:02:01 2006 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Thu, 30 Nov 2006 11:02:01 +0100 Subject: [FIELDTRIP] Re : [FIELDTRIP] reading .sdq format In-Reply-To: <20061130093034.38442.qmail@web26002.mail.ukl.yahoo.com> Message-ID: Hu Jeremie On 30 Nov 2006, at 10:30, Jeremie MATTOUT wrote: > However, the .sqd fileformat does not seem to be supported. > I don't know if I missed something here but if not, could anyone > advise me on some filter routine that would enable me to then read > them in Matlab? I recall that the sdq format is an averaged format that is not supported any more (I could be wrong here). As suggested to me by Masahiro Shimogawara, one of the engineers at Yokogawa, I have dropped support for it. If you can, please use the *.ave file instead. See below for his message: On 24 Oct 2005, at 4:56, Masahiro.Shimogawara at jp.yokogawa.com wrote: > I have added some programs to your toolbox. Please refer the attached > files. > > 1) I have changed the code in filetype.m not to use the extension > ".sqd". > Because this extension remains for compatibility and we have not > use > one any more. It might be that it is only the extension, try renaming the file to *.ave and see whether it works with read_header and read_data. Robert From jeremiemattout at YAHOO.FR Thu Nov 30 12:20:20 2006 From: jeremiemattout at YAHOO.FR (Jeremie MATTOUT) Date: Thu, 30 Nov 2006 11:20:20 +0000 Subject: [FIELDTRIP] Re : [FIELDTRIP] Re : [FIELDTRIP] reading .sdq format Message-ID: Dear Robert, Thanks a lot, it is working now. Well I am facing a memory problem but the routine seems to do the job. FYI, I had to comment the use of hastoolbox.m function in both read_data and read_header since I could not find this function. Also I corrected a parsing error on line 226 of read_yokogawa_data.m All the best, Jeremie ___________________________________________________________________________ Découvrez une nouvelle façon d'obtenir des réponses à toutes vos questions ! Profitez des connaissances, des opinions et des expériences des internautes sur Yahoo! Questions/Réponses http://fr.answers.yahoo.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From r.oostenveld at FCDONDERS.RU.NL Thu Nov 30 14:27:52 2006 From: r.oostenveld at FCDONDERS.RU.NL (Robert Oostenveld) Date: Thu, 30 Nov 2006 14:27:52 +0100 Subject: [FIELDTRIP] Re : [FIELDTRIP] Re : [FIELDTRIP] reading .sdq format In-Reply-To: <20061130112020.47118.qmail@web26006.mail.ukl.yahoo.com> Message-ID: On 30 Nov 2006, at 12:20, Jeremie MATTOUT wrote: > FYI, I had to comment the use of hastoolbox.m function in both > read_data and read_header since I could not find this function. > Also I corrected a parsing error on line 226 of read_yokogawa_data.m thanks, I'll fix those two bugs in the next fileio version. Robert From marco.buiatti at GMAIL.COM Thu Nov 30 15:27:46 2006 From: marco.buiatti at GMAIL.COM (Marco Buiatti) Date: Thu, 30 Nov 2006 15:27:46 +0100 Subject: CRA on ERPs Message-ID: Dear FieldTrippers, I have a question on the use and interpretation of Cluster Randomization Analysis on ERPs. I analised the statistical difference between 2 conditions (9 subjects, within-subjects design), and I obtained two NON-significant clusters, one negative in the frontal lobe (p=0.24) and one positive in posterior regions (p=0.08). These clusters emerge and die at almost the same times, so they really look like reflecting the SAME process. I tested this hypothesis by performing the same analysis on the absolute value of the ERPs: now a significant positive cluster (p=0.02) emerges at the same latency of the previous two, and spatially overlapping to their topography. Do you think that this procedure is plausible, or alternatively that it is not correct and the effect is just too weak? Anyone faced a similar problem and has alternative procedures? Thanks, Marco -- Marco Buiatti - Post Doc ************************************************************** Cognitive Neuroimaging Unit - INSERM U562 Service Hospitalier Frederic Joliot, CEA/DRM/DSV 4 Place du general Leclerc, 91401 Orsay cedex, France Telephone: +33 1 69 86 77 65 Fax: +33 1 69 86 78 16 E-mail: marco.buiatti at gmail.com Web: www.unicog.org *************************************************************** From thomas at UCSD.EDU Thu Nov 30 17:42:07 2006 From: thomas at UCSD.EDU (Thomas Thesen) Date: Thu, 30 Nov 2006 11:42:07 -0500 Subject: freqbaseline & zscore Message-ID: Dear Fieldtrippers, It's been quite busy on this list lately. Nice! I have three quick questions. In version 20060605 of FT, there is an option for cf.baselinetype = zscore; but it is commented out in freqbaseline.m. Is there a specific reason for it, i.e. is the code for computing a zscore for baseline vs active not correct? Is there an inbuilt option to plot the spectrograms with multiplotTFR funcions 'as they are', i.e. without any baseline operations, just the raw values. So far I've been using imagesc on the data matrix, but would like to plot them in an arrangement specified by the .lay file. And is there a way to compute a 2D representation of the frequency spectrum of a particular channel? Like a typical FFT plot with frequency on the x axis and power on the y axis? Thanks a lot, Thomas -------------- next part -------------- An HTML attachment was scrubbed... URL: From maris at NICI.RU.NL Thu Nov 30 21:44:03 2006 From: maris at NICI.RU.NL (Eric Maris) Date: Thu, 30 Nov 2006 21:44:03 +0100 Subject: CRA on ERPs In-Reply-To: <22f732b0611300627y44f34263hd09a1cdd3582af50@mail.gmail.com> Message-ID: Hi Marco, > I have a question on the use and interpretation of Cluster > Randomization Analysis on ERPs. I analised the statistical difference > between 2 conditions (9 subjects, within-subjects design), and I > obtained two NON-significant clusters, one negative in the frontal > lobe (p=0.24) and one positive in posterior regions (p=0.08). These > clusters emerge and die at almost the same times, so they really look > like reflecting the SAME process. I tested this hypothesis by > performing the same analysis on the absolute value of the ERPs: now a > significant positive cluster (p=0.02) emerges at the same latency of > the previous two, and spatially overlapping to their topography. > > Do you think that this procedure is plausible, or alternatively that > it is not correct and the effect is just too weak? Anyone faced a > similar problem and has alternative procedures? If you had decided to run Cluster Randomizaton Analysis on the absolute value of the ERP's WITHOUT HAVING LOOKED AT YOUR DATA, then you would have controlled your Type 1 error (false alarm) rate at 0.05. This does not imply that, for your data, the null hypothesis holds. I would advise you to run Cluster Randomization Analysis on the data of each of the subjects separately. If the same significant spatiotemporal pattern shows up in the majority of the subjects, then I would be convinced that something interesting is going on here. However, in this way, you are not testing a random effects null hypothesis. Maybe you can live with this. I can live with it, and so do all monkey neuroscientists with their N=2 studies. Greetings, Eric > > Thanks, > > Marco > > > > -- > Marco Buiatti - Post Doc > > ************************************************************** > Cognitive Neuroimaging Unit - INSERM U562 > Service Hospitalier Frederic Joliot, CEA/DRM/DSV > 4 Place du general Leclerc, 91401 Orsay cedex, France > Telephone: +33 1 69 86 77 65 Fax: +33 1 69 86 78 16 > E-mail: marco.buiatti at gmail.com Web: www.unicog.org > *************************************************************** From s.debener at UKE.UNI-HAMBURG.DE Thu Nov 30 23:22:02 2006 From: s.debener at UKE.UNI-HAMBURG.DE (Stefan Debener) Date: Thu, 30 Nov 2006 23:22:02 +0100 Subject: CRA on ERPs In-Reply-To: <22f732b0611300627y44f34263hd09a1cdd3582af50@mail.gmail.com> Message-ID: Dear Marco, I have noticed the same phenomenon with other channel-wise statistics (like sample-wise ttests) before. A nose-tip recorded ERP P3, for instance, may show a significant condition effect (e.g. target vs non-target) at parietal electrodes. This condition effect often is "mirrored" to, and "shared" with, frontal sites after re-referencing the data to the common average. At these formerly "inactive" frontal electrodes, the time course and morphology of the parietal P3 now shows up, with the absolute amplitude being decreased and the polarity reversed (due to re-referencing). As a result, if you look at the spatial pattern of p values before/after re-referencing, a previously significant effect at parietal sites may now turn out to be non-significant. Probably a good argument for doing statistical analysis on the source level (which may come with other prolems). Best, Stefan Marco Buiatti wrote: > Dear FieldTrippers, > > I have a question on the use and interpretation of Cluster > Randomization Analysis on ERPs. I analised the statistical difference > between 2 conditions (9 subjects, within-subjects design), and I > obtained two NON-significant clusters, one negative in the frontal > lobe (p=0.24) and one positive in posterior regions (p=0.08). These > clusters emerge and die at almost the same times, so they really look > like reflecting the SAME process. I tested this hypothesis by > performing the same analysis on the absolute value of the ERPs: now a > significant positive cluster (p=0.02) emerges at the same latency of > the previous two, and spatially overlapping to their topography. > > Do you think that this procedure is plausible, or alternatively that > it is not correct and the effect is just too weak? Anyone faced a > similar problem and has alternative procedures? > > Thanks, > > Marco > > >