[FieldTrip] Interpolation and ft_channelrepair (Grazia Di Pisa)

Grazia Di Pisa g.dipisa at gmail.com
Thu Oct 22 11:39:04 CEST 2015


Thank you all so much for the suggestions!!!! :)

After adding /cfg.elec = sens/ it finally worked.

have a nice day,
~ grazia


> On 21Oct, 2015, at 20:22, fieldtrip-request at science.ru.nl wrote:
> 
> Send fieldtrip mailing list submissions to
> 	fieldtrip at science.ru.nl
> 
> To subscribe or unsubscribe via the World Wide Web, visit
> 	http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
> or, via email, send a message with subject or body 'help' to
> 	fieldtrip-request at science.ru.nl
> 
> You can reach the person managing the list at
> 	fieldtrip-owner at science.ru.nl
> 
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of fieldtrip digest..."
> 
> 
> Today's Topics:
> 
>   1. Re: Interpolation and ft_channelrepair (Grazia Di Pisa)
>   2. Re: Interpolation and ft_channelrepair
>      (=?utf-8?Q?J=C3=B6rn_M._Horschig?=)
>   3. Re: Interpolation and ft_channelrepair (Daria Laptinskaya)
>   4. Re: Interpolation and ft_channelrepair (Vit?ria Piai)
>   5. Re: calculating behavioural-power correlation -- follow-up
>      questions (Krebber, Martin)
>   6. Re: calculating behavioural-power correlation -- follow-up
>      questions (Arjen Stolk)
> 
> 
> ----------------------------------------------------------------------
> 
> Message: 1
> Date: Wed, 21 Oct 2015 12:27:40 +0200
> From: Grazia Di Pisa <g.dipisa at gmail.com>
> To: fieldtrip at science.ru.nl
> Subject: Re: [FieldTrip] Interpolation and ft_channelrepair
> Message-ID: <D4187F9B-4F67-434D-9E1B-A9A12D920A26 at gmail.com>
> Content-Type: text/plain; charset="utf-8"
> 
> Hi J?rn,
> 
> Thanks for the advice - I've just tried to add cfg.sens = sens but still the same error.
> 
> Any other suggestions?
> 
> thanks,
> ~ grazia
> 
> 
>> On 21Oct, 2015, at 12:00, fieldtrip-request at science.ru.nl wrote:
>> 
>> Send fieldtrip mailing list submissions to
>> 	fieldtrip at science.ru.nl
>> 
>> To subscribe or unsubscribe via the World Wide Web, visit
>> 	http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
>> or, via email, send a message with subject or body 'help' to
>> 	fieldtrip-request at science.ru.nl
>> 
>> You can reach the person managing the list at
>> 	fieldtrip-owner at science.ru.nl
>> 
>> When replying, please edit your Subject line so it is more specific
>> than "Re: Contents of fieldtrip digest..."
>> 
>> 
>> Today's Topics:
>> 
>>  1. Call for new post docs in the Obleser lab | Auditory
>>     Cognition (Jonas Obleser)
>>  2. Spectrum normalization (Wunderle, Thomas)
>>  3. Interpolation and ft_channelrepair (Grazia Di Pisa)
>>  4. Re: Interpolation and ft_channelrepair
>>     (=?UTF-8?Q?J=C3=B6rn_M._Horschig?=)
>> 
>> 
>> ----------------------------------------------------------------------
>> 
>> Message: 1
>> Date: Tue, 20 Oct 2015 06:07:51 -0500
>> From: Jonas Obleser <jonas at obleser.de>
>> To: fieldtrip at science.ru.nl, AUDITORY at LISTS.MCGILL.CA
>> Subject: [FieldTrip] Call for new post docs in the Obleser lab |
>> 	Auditory	Cognition
>> Message-ID: <71625964-4C4D-41CA-BEDB-171CEFBC87F8 at obleser.de>
>> Content-Type: text/plain; charset=utf-8
>> 
>> The research group ?Auditory Cognition? (headed by Jonas Obleser; auditorycognition.com), now at the University of L?beck, is seeking to hire two Postdoctoral researchers, initially for 3 years, with the option of extension.
>> 
>> These positions fall into the larger framework of an ERC Consolidator grant ?The listening challenge: How ageing brains adapt? (AUDADAPT) recently awarded to Jonas Obleser, and will allow the joint development of cognitive-neuroscience and psychological research projects targeting adaptive control in the auditory modality of middle-aged adults.
>> 
>> Please download the full job advert here: https://www.dropbox.com/s/sqc9c94ewl6bjjh/Ausschreibung_1031_15_Wiss%20MitarbeiterIn_Psychologie_EN.pdf?dl=1 
>> 
>> Note the application deadline of November 12 (postal receipt).
>> 
>> http://auditorycognition.com
>> http://uni-luebeck.de
>> 
>> 
>> 
>> 
>> ------------------------------
>> 
>> Message: 2
>> Date: Tue, 20 Oct 2015 14:58:25 +0000
>> From: "Wunderle, Thomas" <thomas.wunderle at esi-frankfurt.de>
>> To: "fieldtrip at science.ru.nl" <fieldtrip at science.ru.nl>
>> Subject: [FieldTrip] Spectrum normalization
>> Message-ID:
>> 	<27E5CAD9145EEC41BB9B34C01716A198880C3CD4 at UM-excdag-a02.um.gwdg.de>
>> Content-Type: text/plain; charset="iso-8859-1"
>> 
>> Hi all,
>> 
>> I have a question about how FieldTrip normalizes the output of a spectral analyses using ft_freqanalysis.
>> This is important for me, because I need the absolute value of the spectrum for a publication.
>> 
>> I was scanning through the code trying to find the normalization steps.
>> In particular, I don't understand the following steps:
>> 
>> 
>> 1.)    The tapers (e.g. hanning) are normalized prior to the multiplication with the data by the following code:
>> tap = tap./norm(tap, 'fro');   (line 195 in the function fr_specest_mtmfft)
>> What is the rationale of dividing through this special norm of the taper itself?
>> 
>> 
>> 2.)    After calculating the fft, the specrum is scaled (i.e. in the function fr_specest_mtmfft) by:
>> 
>> dum = dum .* sqrt(2 ./ endnsample);  (line 251)
>> 
>> Later on, to get to the power spectrum, the abs of the spectrum is taken and squared
>> 
>> powdum = abs(spectrum(acttap,:,foiind(ifoi),acttboi)) .^2; (line 629 in ft_frequanalysis)
>> 
>> 
>> 
>> This puzzles me, because scanning through the literature, the power spectrum should be given by
>> 
>> (2*abs(X)^2) ./ (nfft^2)                -> unit: V^2        (X=signal, nfft = number of data points)
>> 
>> and the PSD by
>> 
>> (2*abs(X)^2) ./ (nfft*Fs)              -> unit: V^2/Hz (X=signal, nfft = number of data points, Fs=sampling rate)
>> 
>> 
>> 
>> Alternatively, one can get the amplitude spectrum from the power spectrum by taking the square root of the PSD:
>> 
>> sqrt(PSD)                             -> unit: V/sqrt(Hz)
>> 
>> which is still different from
>> 
>> (2*abs(X)) ./ (nfft*Fres)               -> unit: V/Hz ?   (Fres = frequency resolution = Fs/nfft)
>> 
>> 
>> 
>> The result of these equations are different from what comes out of the FieldTrip code.
>> 
>> So what is the unit of the spectrum in FieldTrip?
>> 
>> What is the rationale of scaling the complex spectrum by sqrt(2/nfft) ?
>> 
>> Furthermore, is the unit for the different spectral estimation methods the same? That is, using mtmfft, mtmconvol, wavelet,...?
>> 
>> It would help me a lot if someone could clarify these points.
>> 
>> Thanks in advance,
>> Thomas
>> 
>> 
>> -----
>> Dr. Thomas Wunderle
>> Ernst Str?ngmann Institute (ESI) for Neuroscience<http://www.ncbi.nlm.nih.gov/feed/rss.cgi?ChanKey=PubMedNews>
>> in Cooperation with Max Planck Society <http://www.ncbi.nlm.nih.gov/feed/rss.cgi?ChanKey=PubMedNews>
>> Deutschordenstrasse 46
>> 60528 Frankfurt am Main, Germany
>> www.esi-frankfurt.de<http://www.esi-frankfurt.de/>
>> thomas.wunderle at esi-frankfurt.de<mailto:thomas.wunderle at esi-frankfurt.de>
>> Tel:   +49 69 96769 516
>> Fax:   +49 69 96769 555
>> 
>> Sitz der Gesellschaft: Frankfurt am Main
>> Registergericht: Amtsgericht Frankfurt - HRB 84266
>> Gesch?ftsf?hrer: Prof. Dr. Pascal Fries
>> 
>> 
>> -------------- next part --------------
>> An HTML attachment was scrubbed...
>> URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20151020/eebaf460/attachment-0001.html>
>> 
>> ------------------------------
>> 
>> Message: 3
>> Date: Wed, 21 Oct 2015 10:30:07 +0200
>> From: Grazia Di Pisa <g.dipisa at gmail.com>
>> To: fieldtrip at science.ru.nl
>> Subject: [FieldTrip] Interpolation and ft_channelrepair
>> Message-ID: <A46541FB-BC67-44E7-A9CD-541FB39B7C54 at gmail.com>
>> Content-Type: text/plain; charset=utf-8
>> 
>> Dear all,
>> 
>> I?m trying to do interpolation to repair some bad channels, but I?m getting the error below.
>> I've read the ft_fetch_sens help but I don?t understand how I should specify the electrodes.
>> 
>> Is there a file I should upload or am I missing something in my code? 
>> Any help or hint is very much appreciated!
>> 
>> thanks in advance,
>> ~ grazia
>> 
>> 
>> //
>> Error using ft_fetch_sens (line 183)
>> no electrodes or gradiometers specified.
>> 
>> Error in ft_channelrepair (line 115)
>> sens = ft_fetch_sens(cfg, data);
>> 
>> Error in new_analyse_GDP (line 42)
>> ft_channelrepair(cfg, data)
>> //
>> 
>> This is my code:
>> 
>> 15 	cfg = [];
>> 16 	cfg_neighb       	= [];
>> 17	cfg_neighb.method	= 'triangulation'; 
>> 18    cfg.senstype      	= 'EEG';
>> 19    cfg_neighb.layout 	= 'biosemi64.lay';
>> 20    neighbours        	= ft_prepare_neighbours(cfg_neighb);
>> 21    
>> 22    cfg.neighbours    	= neighbours;
>> 23    cfg.channel       	= {'Fp1', 'Fp2', 'AF7', 'AF3','AF8','F7','F5','FT9',}; 
>> 24    cfg.feedback     	 = 'yes';
>> 25    cfg.layout 		= 'biosemi64.lay';
>> 26    lay 				= ft_prepare_layout(cfg);
>> 27    
>> 28    sens 			= data;
>> 29    sens.type 		= 'eeg';
>> 30    sens.label		= lay.label;
>> 31    sens.chanpos 		= lay.pos;
>> 32    sens.chanpos(:,3) 	= 0;
>> 33  
>> 34   ft_neighbourplot(cfg, data)
>> 35 
>> 36    cfg 				= [];
>> 37    cfg.method         	= 'nearest';
>> 38    cfg.badchannel     	= {'Fp1', 'Fp2', 'AF7', 'AF3','AF8','F7','F5','FT9'};
>> 39    cfg.neighbours    	 = neighbours;
>> 40    cfg.trials        		 = 'all';
>> 41     
>> 42    ft_channelrepair(cfg, data)
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> ------------------------------
>> 
>> Message: 4
>> Date: Wed, 21 Oct 2015 10:42:03 +0200
>> From: "=?UTF-8?Q?J=C3=B6rn_M._Horschig?=" <jorn at artinis.com>
>> To: "'FieldTrip discussion list'" <fieldtrip at science.ru.nl>
>> Subject: Re: [FieldTrip] Interpolation and ft_channelrepair
>> Message-ID: <002b01d10bdc$5d377040$17a650c0$@artinis.com>
>> Content-Type: text/plain;	charset="UTF-8"
>> 
>> Dear Grazia,
>> 
>> try adding cfg.sens = sens; before line 42. That will set the sensor definition so that ft_channelrepair knows the location of your channels, which is otherwise not obvious.
>> 
>> Best,
>> J?rn
>> 
>> --
>> 
>> J?rn M. Horschig, PhD, Software Engineer
>> Artinis Medical Systems  |  +31 481 350 980 
>> 
>>> -----Original Message-----
>>> From: fieldtrip-bounces at science.ru.nl [mailto:fieldtrip-
>>> bounces at science.ru.nl] On Behalf Of Grazia Di Pisa
>>> Sent: Wednesday, October 21, 2015 10:30 AM
>>> To: fieldtrip at science.ru.nl
>>> Subject: [FieldTrip] Interpolation and ft_channelrepair
>>> 
>>> Dear all,
>>> 
>>> I?m trying to do interpolation to repair some bad channels, but I?m getting
>>> the error below.
>>> I've read the ft_fetch_sens help but I don?t understand how I should specify
>>> the electrodes.
>>> 
>>> Is there a file I should upload or am I missing something in my code?
>>> Any help or hint is very much appreciated!
>>> 
>>> thanks in advance,
>>> ~ grazia
>>> 
>>> 
>>> //
>>> Error using ft_fetch_sens (line 183)
>>> no electrodes or gradiometers specified.
>>> 
>>> Error in ft_channelrepair (line 115)
>>> sens = ft_fetch_sens(cfg, data);
>>> 
>>> Error in new_analyse_GDP (line 42)
>>> ft_channelrepair(cfg, data)
>>> //
>>> 
>>> This is my code:
>>> 
>>> 15 	cfg = [];
>>> 16 	cfg_neighb       	= [];
>>> 17	cfg_neighb.method	= 'triangulation';
>>> 18    cfg.senstype      	= 'EEG';
>>> 19    cfg_neighb.layout 	= 'biosemi64.lay';
>>> 20    neighbours        	= ft_prepare_neighbours(cfg_neighb);
>>> 21
>>> 22    cfg.neighbours    	= neighbours;
>>> 23    cfg.channel       	= {'Fp1', 'Fp2', 'AF7', 'AF3','AF8','F7','F5','FT9',};
>>> 24    cfg.feedback     	 = 'yes';
>>> 25    cfg.layout 		= 'biosemi64.lay';
>>> 26    lay 				= ft_prepare_layout(cfg);
>>> 27
>>> 28    sens 			= data;
>>> 29    sens.type 		= 'eeg';
>>> 30    sens.label		= lay.label;
>>> 31    sens.chanpos 		= lay.pos;
>>> 32    sens.chanpos(:,3) 	= 0;
>>> 33
>>> 34   ft_neighbourplot(cfg, data)
>>> 35
>>> 36    cfg 				= [];
>>> 37    cfg.method         	= 'nearest';
>>> 38    cfg.badchannel     	= {'Fp1', 'Fp2', 'AF7', 'AF3','AF8','F7','F5','FT9'};
>>> 39    cfg.neighbours    	 = neighbours;
>>> 40    cfg.trials        		 = 'all';
>>> 41
>>> 42    ft_channelrepair(cfg, data)
>>> 
>>> 
>>> 
>>> 
>>> 
>>> _______________________________________________
>>> fieldtrip mailing list
>>> fieldtrip at donders.ru.nl
>>> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
>> 
>> 
>> 
>> 
>> ------------------------------
>> 
>> _______________________________________________
>> fieldtrip mailing list
>> fieldtrip at donders.ru.nl
>> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
>> 
>> End of fieldtrip Digest, Vol 59, Issue 17
>> *****************************************
> 
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20151021/43fd9e60/attachment-0001.html>
> 
> ------------------------------
> 
> Message: 2
> Date: Wed, 21 Oct 2015 14:16:10 +0200
> From: "=?utf-8?Q?J=C3=B6rn_M._Horschig?=" <jorn at artinis.com>
> To: "'FieldTrip discussion list'" <fieldtrip at science.ru.nl>
> Subject: Re: [FieldTrip] Interpolation and ft_channelrepair
> Message-ID: <002301d10bfa$45d6a740$d183f5c0$@artinis.com>
> Content-Type: text/plain; charset="utf-8"
> 
> Hi Grazia,
> 
> 
> 
> uh, jah, my bad, try cfg.elec instead ;) 
> 
> 
> 
> Best,
> 
> J?rn
> 
> 
> 
> --
> 
> 
> 
> J?rn M. Horschig, PhD, Software Engineer
> 
> <http://www.artinis.com/> Artinis Medical Systems  |  +31 481 350 980 
> 
> 
> 
> From: fieldtrip-bounces at science.ru.nl [mailto:fieldtrip-bounces at science.ru.nl] On Behalf Of Grazia Di Pisa
> Sent: Wednesday, October 21, 2015 12:28 PM
> To: fieldtrip at science.ru.nl
> Subject: Re: [FieldTrip] Interpolation and ft_channelrepair
> 
> 
> 
> Hi J?rn,
> 
> 
> 
> Thanks for the advice - I've just tried to add cfg.sens = sens but still the same error.
> 
> 
> 
> Any other suggestions?
> 
> 
> 
> thanks,
> 
> ~ grazia
> 
> 
> 
> 
> 
> On 21Oct, 2015, at 12:00, fieldtrip-request at science.ru.nl <mailto:fieldtrip-request at science.ru.nl>  wrote:
> 
> 
> 
> Send fieldtrip mailing list submissions to
>          fieldtrip at science.ru.nl <mailto:fieldtrip at science.ru.nl> 
> 
> To subscribe or unsubscribe via the World Wide Web, visit
>          http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
> or, via email, send a message with subject or body 'help' to
>          fieldtrip-request at science.ru.nl <mailto:fieldtrip-request at science.ru.nl> 
> 
> You can reach the person managing the list at
>          fieldtrip-owner at science.ru.nl <mailto:fieldtrip-owner at science.ru.nl> 
> 
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of fieldtrip digest..."
> 
> 
> Today's Topics:
> 
>  1. Call for new post docs in the Obleser lab | Auditory
>     Cognition (Jonas Obleser)
>  2. Spectrum normalization (Wunderle, Thomas)
>  3. Interpolation and ft_channelrepair (Grazia Di Pisa)
>  4. Re: Interpolation and ft_channelrepair
>     (=?UTF-8?Q?J=C3=B6rn_M._Horschig?=)
> 
> 
> ----------------------------------------------------------------------
> 
> Message: 1
> Date: Tue, 20 Oct 2015 06:07:51 -0500
> From: Jonas Obleser <jonas at obleser.de <mailto:jonas at obleser.de> >
> To: fieldtrip at science.ru.nl <mailto:fieldtrip at science.ru.nl> , AUDITORY at LISTS.MCGILL.CA <mailto:AUDITORY at LISTS.MCGILL.CA> 
> Subject: [FieldTrip] Call for new post docs in the Obleser lab |
>          Auditory         Cognition
> Message-ID: <71625964-4C4D-41CA-BEDB-171CEFBC87F8 at obleser.de <mailto:71625964-4C4D-41CA-BEDB-171CEFBC87F8 at obleser.de> >
> Content-Type: text/plain; charset=utf-8
> 
> The research group ?Auditory Cognition? (headed by Jonas Obleser; auditorycognition.com), now at the University of L?beck, is seeking to hire two Postdoctoral researchers, initially for 3 years, with the option of extension.
> 
> These positions fall into the larger framework of an ERC Consolidator grant ?The listening challenge: How ageing brains adapt? (AUDADAPT) recently awarded to Jonas Obleser, and will allow the joint development of cognitive-neuroscience and psychological research projects targeting adaptive control in the auditory modality of middle-aged adults.
> 
> Please download the full job advert here: https://www.dropbox.com/s/sqc9c94ewl6bjjh/Ausschreibung_1031_15_Wiss%20MitarbeiterIn_Psychologie_EN.pdf?dl=1 
> 
> Note the application deadline of November 12 (postal receipt).
> 
> http://auditorycognition.com
> http://uni-luebeck.de
> 
> 
> 
> 
> ------------------------------
> 
> Message: 2
> Date: Tue, 20 Oct 2015 14:58:25 +0000
> From: "Wunderle, Thomas" <thomas.wunderle at esi-frankfurt.de <mailto:thomas.wunderle at esi-frankfurt.de> >
> To: "fieldtrip at science.ru.nl <mailto:fieldtrip at science.ru.nl> " <fieldtrip at science.ru.nl <mailto:fieldtrip at science.ru.nl> >
> Subject: [FieldTrip] Spectrum normalization
> Message-ID:
>          <27E5CAD9145EEC41BB9B34C01716A198880C3CD4 at UM-excdag-a02.um.gwdg.de <mailto:27E5CAD9145EEC41BB9B34C01716A198880C3CD4 at UM-excdag-a02.um.gwdg.de> >
> Content-Type: text/plain; charset="iso-8859-1"
> 
> Hi all,
> 
> I have a question about how FieldTrip normalizes the output of a spectral analyses using ft_freqanalysis.
> This is important for me, because I need the absolute value of the spectrum for a publication.
> 
> I was scanning through the code trying to find the normalization steps.
> In particular, I don't understand the following steps:
> 
> 
> 1.)    The tapers (e.g. hanning) are normalized prior to the multiplication with the data by the following code:
> tap = tap./norm(tap, 'fro');   (line 195 in the function fr_specest_mtmfft)
> What is the rationale of dividing through this special norm of the taper itself?
> 
> 
> 2.)    After calculating the fft, the specrum is scaled (i.e. in the function fr_specest_mtmfft) by:
> 
> dum = dum .* sqrt(2 ./ endnsample);  (line 251)
> 
> Later on, to get to the power spectrum, the abs of the spectrum is taken and squared
> 
> powdum = abs(spectrum(acttap,:,foiind(ifoi),acttboi)) .^2; (line 629 in ft_frequanalysis)
> 
> 
> 
> This puzzles me, because scanning through the literature, the power spectrum should be given by
> 
> (2*abs(X)^2) ./ (nfft^2)                -> unit: V^2        (X=signal, nfft = number of data points)
> 
> and the PSD by
> 
> (2*abs(X)^2) ./ (nfft*Fs)              -> unit: V^2/Hz (X=signal, nfft = number of data points, Fs=sampling rate)
> 
> 
> 
> Alternatively, one can get the amplitude spectrum from the power spectrum by taking the square root of the PSD:
> 
> sqrt(PSD)                             -> unit: V/sqrt(Hz)
> 
> which is still different from
> 
> (2*abs(X)) ./ (nfft*Fres)               -> unit: V/Hz ?   (Fres = frequency resolution = Fs/nfft)
> 
> 
> 
> The result of these equations are different from what comes out of the FieldTrip code.
> 
> So what is the unit of the spectrum in FieldTrip?
> 
> What is the rationale of scaling the complex spectrum by sqrt(2/nfft) ?
> 
> Furthermore, is the unit for the different spectral estimation methods the same? That is, using mtmfft, mtmconvol, wavelet,...?
> 
> It would help me a lot if someone could clarify these points.
> 
> Thanks in advance,
> Thomas
> 
> 
> -----
> Dr. Thomas Wunderle
> Ernst Str?ngmann Institute (ESI) for Neuroscience<http://www.ncbi.nlm.nih.gov/feed/rss.cgi?ChanKey=PubMedNews>
> in Cooperation with Max Planck Society <http://www.ncbi.nlm.nih.gov/feed/rss.cgi?ChanKey=PubMedNews>
> Deutschordenstrasse 46
> 60528 Frankfurt am Main, Germany
> www.esi-frankfurt.de <http://www.esi-frankfurt.de%3chttp:/www.esi-frankfurt.de/> <http://www.esi-frankfurt.de/>
> thomas.wunderle at esi-frankfurt.de <mailto:thomas.wunderle at esi-frankfurt.de%3cmailto:thomas.wunderle at esi-frankfurt.de> <mailto:thomas.wunderle at esi-frankfurt.de>
> Tel:   +49 69 96769 516
> Fax:   +49 69 96769 555
> 
> Sitz der Gesellschaft: Frankfurt am Main
> Registergericht: Amtsgericht Frankfurt - HRB 84266
> Gesch?ftsf?hrer: Prof. Dr. Pascal Fries
> 
> 
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20151020/eebaf460/attachment-0001.html>
> 
> ------------------------------
> 
> Message: 3
> Date: Wed, 21 Oct 2015 10:30:07 +0200
> From: Grazia Di Pisa <g.dipisa at gmail.com <mailto:g.dipisa at gmail.com> >
> To: fieldtrip at science.ru.nl <mailto:fieldtrip at science.ru.nl> 
> Subject: [FieldTrip] Interpolation and ft_channelrepair
> Message-ID: <A46541FB-BC67-44E7-A9CD-541FB39B7C54 at gmail.com <mailto:A46541FB-BC67-44E7-A9CD-541FB39B7C54 at gmail.com> >
> Content-Type: text/plain; charset=utf-8
> 
> Dear all,
> 
> I?m trying to do interpolation to repair some bad channels, but I?m getting the error below.
> I've read the ft_fetch_sens help but I don?t understand how I should specify the electrodes.
> 
> Is there a file I should upload or am I missing something in my code? 
> Any help or hint is very much appreciated!
> 
> thanks in advance,
> ~ grazia
> 
> 
> //
> Error using ft_fetch_sens (line 183)
> no electrodes or gradiometers specified.
> 
> Error in ft_channelrepair (line 115)
> sens = ft_fetch_sens(cfg, data);
> 
> Error in new_analyse_GDP (line 42)
> ft_channelrepair(cfg, data)
> //
> 
> This is my code:
> 
> 15      cfg = [];
> 16      cfg_neighb                  = [];
> 17      cfg_neighb.method     = 'triangulation'; 
> 18    cfg.senstype       = 'EEG';
> 19    cfg_neighb.layout         = 'biosemi64.lay';
> 20    neighbours         = ft_prepare_neighbours(cfg_neighb);
> 21    
> 22    cfg.neighbours               = neighbours;
> 23    cfg.channel        = {'Fp1', 'Fp2', 'AF7', 'AF3','AF8','F7','F5','FT9',}; 
> 24    cfg.feedback      = 'yes';
> 25    cfg.layout                      = 'biosemi64.lay';
> 26    lay                                              = ft_prepare_layout(cfg);
> 27    
> 28    sens                                = data;
> 29    sens.type                        = 'eeg';
> 30    sens.label                       = lay.label;
> 31    sens.chanpos                  = lay.pos;
> 32    sens.chanpos(:,3)           = 0;
> 33  
> 34   ft_neighbourplot(cfg, data)
> 35 
> 36    cfg                                             = [];
> 37    cfg.method                    = 'nearest';
> 38    cfg.badchannel              = {'Fp1', 'Fp2', 'AF7', 'AF3','AF8','F7','F5','FT9'};
> 39    cfg.neighbours               = neighbours;
> 40    cfg.trials                        = 'all';
> 41     
> 42    ft_channelrepair(cfg, data)
> 
> 
> 
> 
> 
> 
> 
> ------------------------------
> 
> Message: 4
> Date: Wed, 21 Oct 2015 10:42:03 +0200
> From: "=?UTF-8?Q?J=C3=B6rn_M._Horschig?=" <jorn at artinis.com <mailto:jorn at artinis.com> >
> To: "'FieldTrip discussion list'" <fieldtrip at science.ru.nl <mailto:fieldtrip at science.ru.nl> >
> Subject: Re: [FieldTrip] Interpolation and ft_channelrepair
> Message-ID: <002b01d10bdc$5d377040$17a650c0$@artinis.com <mailto:002b01d10bdc$5d377040$17a650c0$@artinis.com> >
> Content-Type: text/plain;      charset="UTF-8"
> 
> Dear Grazia,
> 
> try adding cfg.sens = sens; before line 42. That will set the sensor definition so that ft_channelrepair knows the location of your channels, which is otherwise not obvious.
> 
> Best,
> J?rn
> 
> --
> 
> J?rn M. Horschig, PhD, Software Engineer
> Artinis Medical Systems  |  +31 481 350 980 
> 
> 
> 
> 
> -----Original Message-----
> From: fieldtrip-bounces at science.ru.nl <mailto:fieldtrip-bounces at science.ru.nl>  [mailto:fieldtrip-
> bounces at science.ru.nl <mailto:bounces at science.ru.nl> ] On Behalf Of Grazia Di Pisa
> Sent: Wednesday, October 21, 2015 10:30 AM
> To: fieldtrip at science.ru.nl <mailto:fieldtrip at science.ru.nl> 
> Subject: [FieldTrip] Interpolation and ft_channelrepair
> 
> Dear all,
> 
> I?m trying to do interpolation to repair some bad channels, but I?m getting
> the error below.
> I've read the ft_fetch_sens help but I don?t understand how I should specify
> the electrodes.
> 
> Is there a file I should upload or am I missing something in my code?
> Any help or hint is very much appreciated!
> 
> thanks in advance,
> ~ grazia
> 
> 
> //
> Error using ft_fetch_sens (line 183)
> no electrodes or gradiometers specified.
> 
> Error in ft_channelrepair (line 115)
> sens = ft_fetch_sens(cfg, data);
> 
> Error in new_analyse_GDP (line 42)
> ft_channelrepair(cfg, data)
> //
> 
> This is my code:
> 
> 15      cfg = [];
> 16      cfg_neighb                  = [];
> 17      cfg_neighb.method     = 'triangulation';
> 18    cfg.senstype       = 'EEG';
> 19    cfg_neighb.layout         = 'biosemi64.lay';
> 20    neighbours         = ft_prepare_neighbours(cfg_neighb);
> 21
> 22    cfg.neighbours               = neighbours;
> 23    cfg.channel        = {'Fp1', 'Fp2', 'AF7', 'AF3','AF8','F7','F5','FT9',};
> 24    cfg.feedback      = 'yes';
> 25    cfg.layout                      = 'biosemi64.lay';
> 26    lay                                              = ft_prepare_layout(cfg);
> 27
> 28    sens                                = data;
> 29    sens.type                        = 'eeg';
> 30    sens.label                       = lay.label;
> 31    sens.chanpos                  = lay.pos;
> 32    sens.chanpos(:,3)           = 0;
> 33
> 34   ft_neighbourplot(cfg, data)
> 35
> 36    cfg                                             = [];
> 37    cfg.method                    = 'nearest';
> 38    cfg.badchannel              = {'Fp1', 'Fp2', 'AF7', 'AF3','AF8','F7','F5','FT9'};
> 39    cfg.neighbours               = neighbours;
> 40    cfg.trials                        = 'all';
> 41
> 42    ft_channelrepair(cfg, data)
> 
> 
> 
> 
> 
> _______________________________________________
> fieldtrip mailing list
> fieldtrip at donders.ru.nl <mailto:fieldtrip at donders.ru.nl> 
> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
> 
> 
> 
> 
> 
> ------------------------------
> 
> _______________________________________________
> fieldtrip mailing list
> fieldtrip at donders.ru.nl <mailto:fieldtrip at donders.ru.nl> 
> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
> 
> End of fieldtrip Digest, Vol 59, Issue 17
> *****************************************
> 
> 
> 
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20151021/fdead2ac/attachment-0001.html>
> 
> ------------------------------
> 
> Message: 3
> Date: Wed, 21 Oct 2015 14:46:49 +0200
> From: Daria Laptinskaya <daria.laptinskaya at googlemail.com>
> To: FieldTrip discussion list <fieldtrip at science.ru.nl>
> Subject: Re: [FieldTrip] Interpolation and ft_channelrepair
> Message-ID:
> 	<CADcxnnMJ86nmy6ynfEh4TTvM-detkM8-qGVD2D6sv=sc48d4mQ at mail.gmail.com>
> Content-Type: text/plain; charset="utf-8"
> 
> Dear Grazia,
> 
> I?m using the following code and it works fine:
> 
> cfg = [];
> 
> cfg.method = 'average';
> 
> cfg.badchannel = channel;
> 
> cfg.neighbours = neighbours;
> 
> cfg.trials = 'all';
> 
> cfg.elec = sens;
> 
> 
> 
> [interpol] = ft_channelrepair(cfg, opt1_dur);
> 
> 
> 
> Commend out the cfg.elec leads to the same error as you get. ?sens? in my
> code is the result of ft_read_sens, sens=ft_read_sens('GSN-HydroCel-257.sfp'
> ).
> 
> 
> 
> I hope, it helps!
> 
> 
> 
> Best,
> 
> Daria
> 
> 2015-10-21 12:27 GMT+02:00 Grazia Di Pisa <g.dipisa at gmail.com>:
> 
>> Hi J?rn,
>> 
>> Thanks for the advice - I've just tried to add cfg.sens = sens but still
>> the same error.
>> 
>> Any other suggestions?
>> 
>> thanks,
>> ~ grazia
>> 
>> 
>> On 21Oct, 2015, at 12:00, fieldtrip-request at science.ru.nl wrote:
>> 
>> Send fieldtrip mailing list submissions to
>> fieldtrip at science.ru.nl
>> 
>> To subscribe or unsubscribe via the World Wide Web, visit
>> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
>> or, via email, send a message with subject or body 'help' to
>> fieldtrip-request at science.ru.nl
>> 
>> You can reach the person managing the list at
>> fieldtrip-owner at science.ru.nl
>> 
>> When replying, please edit your Subject line so it is more specific
>> than "Re: Contents of fieldtrip digest..."
>> 
>> 
>> Today's Topics:
>> 
>>  1. Call for new post docs in the Obleser lab | Auditory
>>     Cognition (Jonas Obleser)
>>  2. Spectrum normalization (Wunderle, Thomas)
>>  3. Interpolation and ft_channelrepair (Grazia Di Pisa)
>>  4. Re: Interpolation and ft_channelrepair
>>     (=?UTF-8?Q?J=C3=B6rn_M._Horschig?=)
>> 
>> 
>> ----------------------------------------------------------------------
>> 
>> Message: 1
>> Date: Tue, 20 Oct 2015 06:07:51 -0500
>> From: Jonas Obleser <jonas at obleser.de>
>> To: fieldtrip at science.ru.nl, AUDITORY at LISTS.MCGILL.CA
>> Subject: [FieldTrip] Call for new post docs in the Obleser lab |
>> Auditory Cognition
>> Message-ID: <71625964-4C4D-41CA-BEDB-171CEFBC87F8 at obleser.de>
>> Content-Type: text/plain; charset=utf-8
>> 
>> The research group ?Auditory Cognition? (headed by Jonas Obleser;
>> auditorycognition.com), now at the University of L?beck, is seeking to
>> hire two Postdoctoral researchers, initially for 3 years, with the option
>> of extension.
>> 
>> These positions fall into the larger framework of an ERC Consolidator
>> grant ?The listening challenge: How ageing brains adapt? (AUDADAPT)
>> recently awarded to Jonas Obleser, and will allow the joint development of
>> cognitive-neuroscience and psychological research projects targeting
>> adaptive control in the auditory modality of middle-aged adults.
>> 
>> Please download the full job advert here:
>> https://www.dropbox.com/s/sqc9c94ewl6bjjh/Ausschreibung_1031_15_Wiss%20MitarbeiterIn_Psychologie_EN.pdf?dl=1
>> 
>> Note the application deadline of November 12 (postal receipt).
>> 
>> http://auditorycognition.com
>> http://uni-luebeck.de
>> 
>> 
>> 
>> 
>> ------------------------------
>> 
>> Message: 2
>> Date: Tue, 20 Oct 2015 14:58:25 +0000
>> From: "Wunderle, Thomas" <thomas.wunderle at esi-frankfurt.de>
>> To: "fieldtrip at science.ru.nl" <fieldtrip at science.ru.nl>
>> Subject: [FieldTrip] Spectrum normalization
>> Message-ID:
>> <27E5CAD9145EEC41BB9B34C01716A198880C3CD4 at UM-excdag-a02.um.gwdg.de>
>> Content-Type: text/plain; charset="iso-8859-1"
>> 
>> Hi all,
>> 
>> I have a question about how FieldTrip normalizes the output of a spectral
>> analyses using ft_freqanalysis.
>> This is important for me, because I need the absolute value of the
>> spectrum for a publication.
>> 
>> I was scanning through the code trying to find the normalization steps.
>> In particular, I don't understand the following steps:
>> 
>> 
>> 1.)    The tapers (e.g. hanning) are normalized prior to the
>> multiplication with the data by the following code:
>> tap = tap./norm(tap, 'fro');   (line 195 in the function fr_specest_mtmfft)
>> What is the rationale of dividing through this special norm of the taper
>> itself?
>> 
>> 
>> 2.)    After calculating the fft, the specrum is scaled (i.e. in the
>> function fr_specest_mtmfft) by:
>> 
>> dum = dum .* sqrt(2 ./ endnsample);  (line 251)
>> 
>> Later on, to get to the power spectrum, the abs of the spectrum is taken
>> and squared
>> 
>> powdum = abs(spectrum(acttap,:,foiind(ifoi),acttboi)) .^2; (line 629 in
>> ft_frequanalysis)
>> 
>> 
>> 
>> This puzzles me, because scanning through the literature, the power
>> spectrum should be given by
>> 
>> (2*abs(X)^2) ./ (nfft^2)                -> unit: V^2        (X=signal,
>> nfft = number of data points)
>> 
>> and the PSD by
>> 
>> (2*abs(X)^2) ./ (nfft*Fs)              -> unit: V^2/Hz (X=signal, nfft =
>> number of data points, Fs=sampling rate)
>> 
>> 
>> 
>> Alternatively, one can get the amplitude spectrum from the power spectrum
>> by taking the square root of the PSD:
>> 
>> sqrt(PSD)                             -> unit: V/sqrt(Hz)
>> 
>> which is still different from
>> 
>> (2*abs(X)) ./ (nfft*Fres)               -> unit: V/Hz ?   (Fres =
>> frequency resolution = Fs/nfft)
>> 
>> 
>> 
>> The result of these equations are different from what comes out of the
>> FieldTrip code.
>> 
>> So what is the unit of the spectrum in FieldTrip?
>> 
>> What is the rationale of scaling the complex spectrum by sqrt(2/nfft) ?
>> 
>> Furthermore, is the unit for the different spectral estimation methods the
>> same? That is, using mtmfft, mtmconvol, wavelet,...?
>> 
>> It would help me a lot if someone could clarify these points.
>> 
>> Thanks in advance,
>> Thomas
>> 
>> 
>> -----
>> Dr. Thomas Wunderle
>> Ernst Str?ngmann Institute (ESI) for Neuroscience<
>> http://www.ncbi.nlm.nih.gov/feed/rss.cgi?ChanKey=PubMedNews>
>> in Cooperation with Max Planck Society <
>> http://www.ncbi.nlm.nih.gov/feed/rss.cgi?ChanKey=PubMedNews>
>> Deutschordenstrasse 46
>> 60528 Frankfurt am Main, Germany
>> www.esi-frankfurt.de<http://www.esi-frankfurt.de/>
>> thomas.wunderle at esi-frankfurt.de<mailto:thomas.wunderle at esi-frankfurt.de>
>> Tel:   +49 69 96769 516
>> Fax:   +49 69 96769 555
>> 
>> Sitz der Gesellschaft: Frankfurt am Main
>> Registergericht: Amtsgericht Frankfurt - HRB 84266
>> Gesch?ftsf?hrer: Prof. Dr. Pascal Fries
>> 
>> 
>> -------------- next part --------------
>> An HTML attachment was scrubbed...
>> URL: <
>> http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20151020/eebaf460/attachment-0001.html
>>> 
>> 
>> ------------------------------
>> 
>> Message: 3
>> Date: Wed, 21 Oct 2015 10:30:07 +0200
>> From: Grazia Di Pisa <g.dipisa at gmail.com>
>> To: fieldtrip at science.ru.nl
>> Subject: [FieldTrip] Interpolation and ft_channelrepair
>> Message-ID: <A46541FB-BC67-44E7-A9CD-541FB39B7C54 at gmail.com>
>> Content-Type: text/plain; charset=utf-8
>> 
>> Dear all,
>> 
>> I?m trying to do interpolation to repair some bad channels, but I?m
>> getting the error below.
>> I've read the ft_fetch_sens help but I don?t understand how I should
>> specify the electrodes.
>> 
>> 
>> Is there a file I should upload or am I missing something in my code?
>> Any help or hint is very much appreciated!
>> 
>> thanks in advance,
>> ~ grazia
>> 
>> 
>> //
>> Error using ft_fetch_sens (line 183)
>> no electrodes or gradiometers specified.
>> 
>> Error in ft_channelrepair (line 115)
>> sens = ft_fetch_sens(cfg, data);
>> 
>> Error in new_analyse_GDP (line 42)
>> ft_channelrepair(cfg, data)
>> //
>> 
>> This is my code:
>> 
>> 15 cfg = [];
>> 16 cfg_neighb        = [];
>> 17 cfg_neighb.method = 'triangulation';
>> 18    cfg.senstype       = 'EEG';
>> 19    cfg_neighb.layout = 'biosemi64.lay';
>> 20    neighbours         = ft_prepare_neighbours(cfg_neighb);
>> 21
>> 22    cfg.neighbours     = neighbours;
>> 23    cfg.channel        = {'Fp1', 'Fp2', 'AF7',
>> 'AF3','AF8','F7','F5','FT9',};
>> 24    cfg.feedback      = 'yes';
>> 25    cfg.layout = 'biosemi64.lay';
>> 26    lay = ft_prepare_layout(cfg);
>> 27
>> 28    sens = data;
>> 29    sens.type = 'eeg';
>> 30    sens.label = lay.label;
>> 31    sens.chanpos = lay.pos;
>> 32    sens.chanpos(:,3) = 0;
>> 33
>> 34   ft_neighbourplot(cfg, data)
>> 35
>> 36    cfg = [];
>> 37    cfg.method          = 'nearest';
>> 38    cfg.badchannel      = {'Fp1', 'Fp2', 'AF7',
>> 'AF3','AF8','F7','F5','FT9'};
>> 39    cfg.neighbours     = neighbours;
>> 40    cfg.trials         = 'all';
>> 41
>> 42    ft_channelrepair(cfg, data)
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> ------------------------------
>> 
>> Message: 4
>> Date: Wed, 21 Oct 2015 10:42:03 +0200
>> From: "=?UTF-8?Q?J=C3=B6rn_M._Horschig?=" <jorn at artinis.com>
>> To: "'FieldTrip discussion list'" <fieldtrip at science.ru.nl>
>> Subject: Re: [FieldTrip] Interpolation and ft_channelrepair
>> Message-ID: <002b01d10bdc$5d377040$17a650c0$@artinis.com>
>> Content-Type: text/plain; charset="UTF-8"
>> 
>> Dear Grazia,
>> 
>> try adding cfg.sens = sens; before line 42. That will set the sensor
>> definition so that ft_channelrepair knows the location of your channels,
>> which is otherwise not obvious.
>> 
>> Best,
>> J?rn
>> 
>> --
>> 
>> J?rn M. Horschig, PhD, Software Engineer
>> Artinis Medical Systems  |  +31 481 350 980
>> 
>> -----Original Message-----
>> From: fieldtrip-bounces at science.ru.nl [mailto:fieldtrip-
>> bounces at science.ru.nl] On Behalf Of Grazia Di Pisa
>> Sent: Wednesday, October 21, 2015 10:30 AM
>> To: fieldtrip at science.ru.nl
>> Subject: [FieldTrip] Interpolation and ft_channelrepair
>> 
>> Dear all,
>> 
>> I?m trying to do interpolation to repair some bad channels, but I?m getting
>> the error below.
>> I've read the ft_fetch_sens help but I don?t understand how I should
>> specify
>> 
>> the electrodes.
>> 
>> Is there a file I should upload or am I missing something in my code?
>> Any help or hint is very much appreciated!
>> 
>> thanks in advance,
>> ~ grazia
>> 
>> 
>> //
>> Error using ft_fetch_sens (line 183)
>> no electrodes or gradiometers specified.
>> 
>> Error in ft_channelrepair (line 115)
>> sens = ft_fetch_sens(cfg, data);
>> 
>> Error in new_analyse_GDP (line 42)
>> ft_channelrepair(cfg, data)
>> //
>> 
>> This is my code:
>> 
>> 15 cfg = [];
>> 16 cfg_neighb        = [];
>> 17 cfg_neighb.method = 'triangulation';
>> 18    cfg.senstype       = 'EEG';
>> 19    cfg_neighb.layout = 'biosemi64.lay';
>> 20    neighbours         = ft_prepare_neighbours(cfg_neighb);
>> 21
>> 22    cfg.neighbours     = neighbours;
>> 23    cfg.channel        = {'Fp1', 'Fp2', 'AF7',
>> 'AF3','AF8','F7','F5','FT9',};
>> 24    cfg.feedback      = 'yes';
>> 25    cfg.layout = 'biosemi64.lay';
>> 26    lay = ft_prepare_layout(cfg);
>> 27
>> 28    sens = data;
>> 29    sens.type = 'eeg';
>> 30    sens.label = lay.label;
>> 31    sens.chanpos = lay.pos;
>> 32    sens.chanpos(:,3) = 0;
>> 33
>> 34   ft_neighbourplot(cfg, data)
>> 35
>> 36    cfg = [];
>> 37    cfg.method          = 'nearest';
>> 38    cfg.badchannel      = {'Fp1', 'Fp2', 'AF7',
>> 'AF3','AF8','F7','F5','FT9'};
>> 39    cfg.neighbours     = neighbours;
>> 40    cfg.trials         = 'all';
>> 41
>> 42    ft_channelrepair(cfg, data)
>> 
>> 
>> 
>> 
>> 
>> _______________________________________________
>> fieldtrip mailing list
>> fieldtrip at donders.ru.nl
>> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
>> 
>> 
>> 
>> 
>> 
>> ------------------------------
>> 
>> _______________________________________________
>> fieldtrip mailing list
>> fieldtrip at donders.ru.nl
>> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
>> 
>> End of fieldtrip Digest, Vol 59, Issue 17
>> *****************************************
>> 
>> 
>> 
>> _______________________________________________
>> fieldtrip mailing list
>> fieldtrip at donders.ru.nl
>> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
>> 
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20151021/8500cbff/attachment-0001.html>
> 
> ------------------------------
> 
> Message: 4
> Date: Wed, 21 Oct 2015 10:44:28 -0700
> From: Vit?ria Piai <v.piai.research at gmail.com>
> To: FieldTrip discussion list <fieldtrip at science.ru.nl>
> Subject: Re: [FieldTrip] Interpolation and ft_channelrepair
> Message-ID: <5627CEFC.1030608 at gmail.com>
> Content-Type: text/plain; charset="windows-1252"; Format="flowed"
> 
> Hi Grazia,
> 
> I'm using the following code and it works:
> 
> cfgn = [];
> cfgn.method       = 'template';
> cfgn.layout       = 'biosemi64.lay';
> 
> cfg = [];
> cfg.neighbours    = ft_prepare_neighbours(cfgn, data);
> cfg.elec = ft_read_sens('standard_1005.elc');
> cfg.missingchannel = [];
> cfg.badchannel = chanrepair;  % these are my channels
> cfg.trials = [1 3 5]; % for particular trials, otherwise use 'all'
> data = ft_channelrepair(cfg,data);
> 
> Hope this helps
> Vitoria
> 
> 
> 
> On 10/21/2015 3:27 AM, Grazia Di Pisa wrote:
>> Hi J?rn,
>> 
>> Thanks for the advice - I've just tried to add cfg.sens = sens but 
>> still the same error.
>> 
>> Any other suggestions?
>> 
>> thanks,
>> ~ grazia
>> 
>> 
>>> On 21Oct, 2015, at 12:00, fieldtrip-request at science.ru.nl 
>>> <mailto:fieldtrip-request at science.ru.nl> wrote:
>>> 
>>> Send fieldtrip mailing list submissions to
>>> fieldtrip at science.ru.nl <mailto:fieldtrip at science.ru.nl>
>>> 
>>> To subscribe or unsubscribe via the World Wide Web, visit
>>> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
>>> or, via email, send a message with subject or body 'help' to
>>> fieldtrip-request at science.ru.nl
>>> 
>>> You can reach the person managing the list at
>>> fieldtrip-owner at science.ru.nl
>>> 
>>> When replying, please edit your Subject line so it is more specific
>>> than "Re: Contents of fieldtrip digest..."
>>> 
>>> 
>>> Today's Topics:
>>> 
>>>  1. Call for new post docs in the Obleser lab | Auditory
>>>     Cognition (Jonas Obleser)
>>>  2. Spectrum normalization (Wunderle, Thomas)
>>>  3. Interpolation and ft_channelrepair (Grazia Di Pisa)
>>>  4. Re: Interpolation and ft_channelrepair
>>>     (=?UTF-8?Q?J=C3=B6rn_M._Horschig?=)
>>> 
>>> 
>>> ----------------------------------------------------------------------
>>> 
>>> Message: 1
>>> Date: Tue, 20 Oct 2015 06:07:51 -0500
>>> From: Jonas Obleser <jonas at obleser.de>
>>> To: fieldtrip at science.ru.nl, AUDITORY at LISTS.MCGILL.CA
>>> Subject: [FieldTrip] Call for new post docs in the Obleser lab |
>>> AuditoryCognition
>>> Message-ID: <71625964-4C4D-41CA-BEDB-171CEFBC87F8 at obleser.de>
>>> Content-Type: text/plain; charset=utf-8
>>> 
>>> The research group ?Auditory Cognition? (headed by Jonas Obleser; 
>>> auditorycognition.com), now at the University of L?beck, is seeking 
>>> to hire two Postdoctoral researchers, initially for 3 years, with the 
>>> option of extension.
>>> 
>>> These positions fall into the larger framework of an ERC Consolidator 
>>> grant ?The listening challenge: How ageing brains adapt? (AUDADAPT) 
>>> recently awarded to Jonas Obleser, and will allow the joint 
>>> development of cognitive-neuroscience and psychological research 
>>> projects targeting adaptive control in the auditory modality of 
>>> middle-aged adults.
>>> 
>>> Please download the full job advert here: 
>>> https://www.dropbox.com/s/sqc9c94ewl6bjjh/Ausschreibung_1031_15_Wiss%20MitarbeiterIn_Psychologie_EN.pdf?dl=1 
>>> 
>>> 
>>> Note the application deadline of November 12 (postal receipt).
>>> 
>>> http://auditorycognition.com
>>> http://uni-luebeck.de
>>> 
>>> 
>>> 
>>> 
>>> ------------------------------
>>> 
>>> Message: 2
>>> Date: Tue, 20 Oct 2015 14:58:25 +0000
>>> From: "Wunderle, Thomas" <thomas.wunderle at esi-frankfurt.de>
>>> To: "fieldtrip at science.ru.nl" <fieldtrip at science.ru.nl>
>>> Subject: [FieldTrip] Spectrum normalization
>>> Message-ID:
>>> <27E5CAD9145EEC41BB9B34C01716A198880C3CD4 at UM-excdag-a02.um.gwdg.de>
>>> Content-Type: text/plain; charset="iso-8859-1"
>>> 
>>> Hi all,
>>> 
>>> I have a question about how FieldTrip normalizes the output of a 
>>> spectral analyses using ft_freqanalysis.
>>> This is important for me, because I need the absolute value of the 
>>> spectrum for a publication.
>>> 
>>> I was scanning through the code trying to find the normalization steps.
>>> In particular, I don't understand the following steps:
>>> 
>>> 
>>> 1.)    The tapers (e.g. hanning) are normalized prior to the 
>>> multiplication with the data by the following code:
>>> tap = tap./norm(tap, 'fro');   (line 195 in the function 
>>> fr_specest_mtmfft)
>>> What is the rationale of dividing through this special norm of the 
>>> taper itself?
>>> 
>>> 
>>> 2.)    After calculating the fft, the specrum is scaled (i.e. in the 
>>> function fr_specest_mtmfft) by:
>>> 
>>> dum = dum .* sqrt(2 ./ endnsample);  (line 251)
>>> 
>>> Later on, to get to the power spectrum, the abs of the spectrum is 
>>> taken and squared
>>> 
>>> powdum = abs(spectrum(acttap,:,foiind(ifoi),acttboi)) .^2; (line 629 
>>> in ft_frequanalysis)
>>> 
>>> 
>>> 
>>> This puzzles me, because scanning through the literature, the power 
>>> spectrum should be given by
>>> 
>>> (2*abs(X)^2) ./ (nfft^2)                -> unit: V^2 
>>>       (X=signal, nfft = number of data points)
>>> 
>>> and the PSD by
>>> 
>>> (2*abs(X)^2) ./ (nfft*Fs)              -> unit: V^2/Hz (X=signal, 
>>> nfft = number of data points, Fs=sampling rate)
>>> 
>>> 
>>> 
>>> Alternatively, one can get the amplitude spectrum from the power 
>>> spectrum by taking the square root of the PSD:
>>> 
>>> sqrt(PSD)                             -> unit: V/sqrt(Hz)
>>> 
>>> which is still different from
>>> 
>>> (2*abs(X)) ./ (nfft*Fres)               -> unit: V/Hz ?   (Fres = 
>>> frequency resolution = Fs/nfft)
>>> 
>>> 
>>> 
>>> The result of these equations are different from what comes out of 
>>> the FieldTrip code.
>>> 
>>> So what is the unit of the spectrum in FieldTrip?
>>> 
>>> What is the rationale of scaling the complex spectrum by sqrt(2/nfft) ?
>>> 
>>> Furthermore, is the unit for the different spectral estimation 
>>> methods the same? That is, using mtmfft, mtmconvol, wavelet,...?
>>> 
>>> It would help me a lot if someone could clarify these points.
>>> 
>>> Thanks in advance,
>>> Thomas
>>> 
>>> 
>>> -----
>>> Dr. Thomas Wunderle
>>> Ernst Str?ngmann Institute (ESI) for 
>>> Neuroscience<http://www.ncbi.nlm.nih.gov/feed/rss.cgi?ChanKey=PubMedNews>
>>> in Cooperation with Max Planck Society 
>>> <http://www.ncbi.nlm.nih.gov/feed/rss.cgi?ChanKey=PubMedNews>
>>> Deutschordenstrasse 46
>>> 60528 Frankfurt am Main, Germany
>>> www.esi-frankfurt.de<http://www.esi-frankfurt.de/>
>>> thomas.wunderle at esi-frankfurt.de<mailto:thomas.wunderle at esi-frankfurt.de>
>>> Tel:   +49 69 96769 516
>>> Fax:   +49 69 96769 555
>>> 
>>> Sitz der Gesellschaft: Frankfurt am Main
>>> Registergericht: Amtsgericht Frankfurt - HRB 84266
>>> Gesch?ftsf?hrer: Prof. Dr. Pascal Fries
>>> 
>>> 
>>> -------------- next part --------------
>>> An HTML attachment was scrubbed...
>>> URL: 
>>> <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20151020/eebaf460/attachment-0001.html>
>>> 
>>> ------------------------------
>>> 
>>> Message: 3
>>> Date: Wed, 21 Oct 2015 10:30:07 +0200
>>> From: Grazia Di Pisa <g.dipisa at gmail.com>
>>> To: fieldtrip at science.ru.nl
>>> Subject: [FieldTrip] Interpolation and ft_channelrepair
>>> Message-ID: <A46541FB-BC67-44E7-A9CD-541FB39B7C54 at gmail.com>
>>> Content-Type: text/plain; charset=utf-8
>>> 
>>> Dear all,
>>> 
>>> I?m trying to do interpolation to repair some bad channels, but I?m 
>>> getting the error below.
>>> I've read the ft_fetch_sens help but I don?t understand how I should 
>>> specify the electrodes.
>>> 
>>> Is there a file I should upload or am I missing something in my code?
>>> Any help or hint is very much appreciated!
>>> 
>>> thanks in advance,
>>> ~ grazia
>>> 
>>> 
>>> //
>>> Error using ft_fetch_sens (line 183)
>>> no electrodes or gradiometers specified.
>>> 
>>> Error in ft_channelrepair (line 115)
>>> sens = ft_fetch_sens(cfg, data);
>>> 
>>> Error in new_analyse_GDP (line 42)
>>> ft_channelrepair(cfg, data)
>>> //
>>> 
>>> This is my code:
>>> 
>>> 15 cfg = [];
>>> 16 cfg_neighb = [];
>>> 17cfg_neighb.method= 'triangulation';
>>> 18    cfg.senstype = 'EEG';
>>> 19    cfg_neighb.layout = 'biosemi64.lay';
>>> 20    neighbours = ft_prepare_neighbours(cfg_neighb);
>>> 21
>>> 22    cfg.neighbours = neighbours;
>>> 23    cfg.channel = {'Fp1', 'Fp2', 'AF7', 'AF3','AF8','F7','F5','FT9',};
>>> 24    cfg.feedback = 'yes';
>>> 25    cfg.layout = 'biosemi64.lay';
>>> 26    lay = ft_prepare_layout(cfg);
>>> 27
>>> 28    sens = data;
>>> 29    sens.type = 'eeg';
>>> 30    sens.label= lay.label;
>>> 31    sens.chanpos = lay.pos;
>>> 32    sens.chanpos(:,3) = 0;
>>> 33
>>> 34   ft_neighbourplot(cfg, data)
>>> 35
>>> 36    cfg = [];
>>> 37    cfg.method = 'nearest';
>>> 38    cfg.badchannel = {'Fp1', 'Fp2', 'AF7', 
>>> 'AF3','AF8','F7','F5','FT9'};
>>> 39    cfg.neighbours = neighbours;
>>> 40    cfg.trials = 'all';
>>> 41
>>> 42    ft_channelrepair(cfg, data)
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> ------------------------------
>>> 
>>> Message: 4
>>> Date: Wed, 21 Oct 2015 10:42:03 +0200
>>> From: "=?UTF-8?Q?J=C3=B6rn_M._Horschig?=" <jorn at artinis.com>
>>> To: "'FieldTrip discussion list'" <fieldtrip at science.ru.nl>
>>> Subject: Re: [FieldTrip] Interpolation and ft_channelrepair
>>> Message-ID: <002b01d10bdc$5d377040$17a650c0$@artinis.com>
>>> Content-Type: text/plain;charset="UTF-8"
>>> 
>>> Dear Grazia,
>>> 
>>> try adding cfg.sens = sens; before line 42. That will set the sensor 
>>> definition so that ft_channelrepair knows the location of your 
>>> channels, which is otherwise not obvious.
>>> 
>>> Best,
>>> J?rn
>>> 
>>> --
>>> 
>>> J?rn M. Horschig, PhD, Software Engineer
>>> Artinis Medical Systems  |  +31 481 350 980
>>> 
>>>> -----Original Message-----
>>>> From: fieldtrip-bounces at science.ru.nl [mailto:fieldtrip-
>>>> bounces at science.ru.nl] On Behalf Of Grazia Di Pisa
>>>> Sent: Wednesday, October 21, 2015 10:30 AM
>>>> To: fieldtrip at science.ru.nl
>>>> Subject: [FieldTrip] Interpolation and ft_channelrepair
>>>> 
>>>> Dear all,
>>>> 
>>>> I?m trying to do interpolation to repair some bad channels, but I?m 
>>>> getting
>>>> the error below.
>>>> I've read the ft_fetch_sens help but I don?t understand how I should 
>>>> specify
>>>> the electrodes.
>>>> 
>>>> Is there a file I should upload or am I missing something in my code?
>>>> Any help or hint is very much appreciated!
>>>> 
>>>> thanks in advance,
>>>> ~ grazia
>>>> 
>>>> 
>>>> //
>>>> Error using ft_fetch_sens (line 183)
>>>> no electrodes or gradiometers specified.
>>>> 
>>>> Error in ft_channelrepair (line 115)
>>>> sens = ft_fetch_sens(cfg, data);
>>>> 
>>>> Error in new_analyse_GDP (line 42)
>>>> ft_channelrepair(cfg, data)
>>>> //
>>>> 
>>>> This is my code:
>>>> 
>>>> 15 cfg = [];
>>>> 16 cfg_neighb = [];
>>>> 17cfg_neighb.method= 'triangulation';
>>>> 18    cfg.senstype = 'EEG';
>>>> 19    cfg_neighb.layout = 'biosemi64.lay';
>>>> 20    neighbours = ft_prepare_neighbours(cfg_neighb);
>>>> 21
>>>> 22    cfg.neighbours = neighbours;
>>>> 23    cfg.channel = {'Fp1', 'Fp2', 'AF7', 'AF3','AF8','F7','F5','FT9',};
>>>> 24    cfg.feedback = 'yes';
>>>> 25    cfg.layout = 'biosemi64.lay';
>>>> 26    lay = ft_prepare_layout(cfg);
>>>> 27
>>>> 28    sens = data;
>>>> 29    sens.type = 'eeg';
>>>> 30    sens.label= lay.label;
>>>> 31    sens.chanpos = lay.pos;
>>>> 32    sens.chanpos(:,3) = 0;
>>>> 33
>>>> 34   ft_neighbourplot(cfg, data)
>>>> 35
>>>> 36    cfg = [];
>>>> 37    cfg.method = 'nearest';
>>>> 38    cfg.badchannel = {'Fp1', 'Fp2', 'AF7', 
>>>> 'AF3','AF8','F7','F5','FT9'};
>>>> 39    cfg.neighbours = neighbours;
>>>> 40    cfg.trials = 'all';
>>>> 41
>>>> 42    ft_channelrepair(cfg, data)
>>>> 
>>>> 
>>>> 
>>>> 
>>>> 
>>>> _______________________________________________
>>>> fieldtrip mailing list
>>>> fieldtrip at donders.ru.nl
>>>> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
>>> 
>>> 
>>> 
>>> 
>>> ------------------------------
>>> 
>>> _______________________________________________
>>> fieldtrip mailing list
>>> fieldtrip at donders.ru.nl
>>> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
>>> 
>>> End of fieldtrip Digest, Vol 59, Issue 17
>>> *****************************************
>> 
>> 
>> 
>> _______________________________________________
>> fieldtrip mailing list
>> fieldtrip at donders.ru.nl
>> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
> 
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20151021/7d31addb/attachment-0001.html>
> 
> ------------------------------
> 
> Message: 5
> Date: Wed, 21 Oct 2015 17:54:40 +0000
> From: "Krebber, Martin" <martin.krebber at charite.de>
> To: FieldTrip discussion list <fieldtrip at science.ru.nl>
> Subject: Re: [FieldTrip] calculating behavioural-power correlation --
> 	follow-up questions
> Message-ID:
> 	<B521CE9BFA72124F87A7D9CBEE13F9BE0DDCF182 at s-mx14-mb0105.charite.de>
> Content-Type: text/plain; charset="iso-8859-1"
> 
> Hi Xiaoming, hi Arjen,
> 
> I've been encountering the same problem. I believe Xiaoming is right when he points out that the permutaion step shuffles data across conditions and that this introduces a negative bias in the distribution. I found the same thing when I correlated RT data with TFRs (absolute power). My distribution was shifted strongly to the left and, thus, not a single negative cluster was significant, but every positive one was.
> 
> Xiaomings explanation made a lot of sense to me when I thought about it graphically: Imagine correlating two data vectors, one (x) ranging between .5 and1, the other (y) between 50 and and 100. When plotting this, one gets a cloud of dots on the upper left corner of the diagram. When you then switch the variable assignment of half of the data points (which is what the permutation step seems to do), these dots will now be be shifted to the lower right corner of the diagram. So no matter what the correlation in the original data, chances are that (given different scaling) after permutaion, you get a negative correlation.
> 
> I am not 100% sure about this, so please let me know if I made a mistake.
> 
> What I tried instead of the 'ft_statfun_correlationT' was using a custom made statfun in which I pass the RTs via the design matrix. With this, my results looked much better. I am not sure, but I guess this is because there is no shuffling between the two variables in this case.
> 
> I would really like to know, what is the right way of doing this using just the FieldTrip functions. Is there a way to permute data within variables? I tried cfg.resampling = 'bootstrap', but this is not a permutation, as far as I know.
> 
> 
> Thanks!
> Martin
> 
> 
> ________________________________
> Von: fieldtrip-bounces at science.ru.nl [fieldtrip-bounces at science.ru.nl]" im Auftrag von "Arjen Stolk [a.stolk8 at gmail.com]
> Gesendet: Dienstag, 20. Oktober 2015 08:03
> An: FieldTrip discussion list
> Betreff: Re: [FieldTrip] calculating behavioural-power correlation -- follow-up questions
> 
> Hey Xiaoming,
> 
> It's still pretty hard, for me, to guess on basis of that matlab output what is going on here and what you mean with 'shuffling design matrices', and how that shuffling 'biases the cluster distribution'. As you mention yourself, it could be due to various reasons, and you're open to suggestions and increasing your understanding. I'd therefore suggest to try to funnel the number of potential explanations by simulating what you're doing (using input data for which you know how it should behave), after you've read more about what the design matrix and monte carlo statistics are supposed to do. Perhaps the statistics section at the bottom of this page provides a good starting point: http://www.fieldtriptoolbox.org/walkthrough
> 
> Hope that helps,
> Arjen
> 
> 2015-10-19 15:56 GMT-07:00 Xiaoming Du <XDu at mprc.umaryland.edu<mailto:XDu at mprc.umaryland.edu>>:
> For example, our power values ranged from 1 to 3 (after log transform); my behavioral data ranged from 20 to 90;
> 
> by using above mentioned script, there are 14 negative clusters were reported in variable stat.
> 
> stat =
> 
>                   prob: [30x50 double]
>            posclusters: []
>    posclusterslabelmat: [30x50 double]
>        posdistribution: [1x1000 double]
>            negclusters: [1x14 struct]
>    negclusterslabelmat: [30x50 double]
>        negdistribution: [1x1000 double]
>                cirange: [30x50 double]
>                   mask: [30x50 logical]
>                   stat: [30x50 double]
>                    ref: [30x50 double]
>                    rho: [30x50 double]
>                 dimord: 'chan_freq'
>                   freq: [1x50 double]
>                  label: {30x1 cell}
>                   time: 2.5000
>                    cfg: [1x1 struct]
> 
> However, the p values of those clusters (i.e., stat.negclusters.prob) are all ones. The smallest value in  stat.negdistribution is way larger than the largest negative cluster t-sum. This could be real. However, it is more likely due to the shuffle between power and behavioral group. For example, design matrix  [1 1 1 1 2 2 2 2; 1 2 3 4 1 2 3 4] was shuffled to [1 2 2 1 2 2 1 1; 1 2 3 4 1 2 3 4].  After each permutation, for some subjects, their power data was labeled as behavioral data and vice versa. Because of the scale difference between power and behavioral data, large negative correlations were generated by permutation. This further biased the cluster distribution.
> My limited understanding is that, for correlation, each permutation should fix cfg.ivar and only shuffle half of the cfg.uvar. For example, permute design matrix [1 1 1 1 2 2 2 2; 1 2 3 4 1 2 3 4]  to [1 1 1 1 2 2 2; 1 2 3 4 4 2 3 1]. THerefore, after permutation, one subject's power data corresponds to another subject's behavioral data.
> 
> I am not good at statistics. It will be really appreciated if you have any suggestions or comments.
> 
> Xiaoming
> 
> 
> 
> 
>>>> Arjen Stolk <a.stolk8 at gmail.com<mailto:a.stolk8 at gmail.com>> 10/19/2015 6:01 PM >>>
> Hey Xiaoming,
> 
> Not sure if I understand, but shouldn't the directions of the correlations be independent of the scaling of the two variables? Looking at the code of ft_statfun_correlationT it doesn't seem the conversion from correlation to T value (tstat = rho*(sqrt(max(nunits)-2))/sqrt((1-rho^2))) would result in a direction change either. Perhaps you could try to first manually calculate a correlation between signal power and behavioral power, and see whether anything is behaving unexpectedly?
> 
> Yours,
> Arjen
> 
> 2015-10-19 14:25 GMT-07:00 Xiaoming Du <XDu at mprc.umaryland.edu<mailto:XDu at mprc.umaryland.edu>>:
> Dear FieldTrip users,
> This is Xiaoming from University of Maryland Baltimore. My current project requires to calculate behavioral-power correlation across subjects. Similar topic was discussed here early this year. http://mailman.science.ru.nl/pipermail/fieldtrip/2015-February/008953.html
> According to the suggestions in above mentioned thread, I duplicate my power dataset and replace the power values at each time-frequency point with behavioral data. Therefore, those two datasets have same structure and dimension. I used the following script to test if there are significant clusters of correlations.
> cfg = [];
> cfg.parameter = 'powspctrm';
> cfg.method = 'montecarlo';
> cfg.statistic = 'ft_statfun_correlationT';
> ...
> etc
> ...
> design = zeros(2, n1 * 2); % n1 is the number of subjects.
> design(1,1:n1) = 1;
> design(1,(n1 + 1):(n1 * 2)) = 2;
> design(2, :) = [[1:n1 ] [1 : n1]];
> cfg.design = design;
> 
> cfg.ivar = 1;
> cfg.uvar = 2;
> stat = ft_freqstatistics(cfg, dataBeh{:}, dataDX1{:});
> However, it seems when each time the design matrix is permuted, FieldTrip is using the same method as for 'ft_statfun_depsamplesT', meaning cfg.uvar remains the same while cfg.ivar (1 or 2) is randomly assigned to each subject in design matrix. Although I confirmed this by uncommenting line 313 (i.e., tmpdesign = design(:,resample(i,:))) in ft_statistics_montecarlo.m which allows to display the permuted design matrix in command line, please correct me if this is not the case.
> In my mind, this kind of permutation will cause trouble when dealing with correlation. For example, in my case, the behavioral data and power data have different scales. The power data are much larger than behavioral data in general. When assigning behavioral data into power group or vice versa, it will induce huge negative correlations between power and behavioral measurement. Therefore, no negative clusters will survive from permutation test.
> Please let me know if I have mis-understanding or if I did anything wrong. Any suggestions will be highly appreciated!
> Thanks.
> Xiaoming
> 
> _______________________________________________
> fieldtrip mailing list
> fieldtrip at donders.ru.nl<mailto:fieldtrip at donders.ru.nl>
> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
> 
> 
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20151021/138520fa/attachment-0001.html>
> 
> ------------------------------
> 
> Message: 6
> Date: Wed, 21 Oct 2015 11:22:09 -0700
> From: Arjen Stolk <a.stolk8 at gmail.com>
> To: FieldTrip discussion list <fieldtrip at science.ru.nl>
> Subject: Re: [FieldTrip] calculating behavioural-power correlation --
> 	follow-up questions
> Message-ID:
> 	<CAAiwptSYuNU0hrqb79C9H8R+viiM5O=wugBrcX8QovNrE8m4Qg at mail.gmail.com>
> Content-Type: text/plain; charset="utf-8"
> 
> Hi Martin,
> 
> Thanks for thinking along. I've briefly tried to replicate/simplify the
> situation depicted by you using the code below. It works as I would expect,
> no matter whether one variable is scaled differently. But perhaps I'm not
> fully capturing the issue, and something still goes awry. This is a
> possibility because ft_statfun_correlationT has only recently been
> implemented for a specific case, and was never really tested within
> different situations (hence it's not well-documented on the wiki). Do you
> think you could use this example code to replicate the situation you are
> experiencing?
> 
> Yours,
> Arjen
> 
> % simulate simple multiple subjects timelock structures
> 
> data_brain = [];
> 
> data_behav = [];
> 
> for j=1:10
> 
> data_brain{j}.avg = j; % increasing
> 
> data_brain{j}.dimord = 'chan_time';
> 
> data_brain{j}.time = 1;
> 
> data_brain{j}.label = {'1'};
> 
> 
> 
> data_behav{j} = data_brain{j};
> 
> data_behav{j}.avg = data_brain{j}.avg*-1000+50; % add scaling difference
> 
> end
> 
> 
> 
> % compute statistics with correlationT
> 
> cfg = [];
> 
> cfg.method           = 'montecarlo';
> 
> cfg.statistic        = 'ft_statfun_correlationT';
> 
> cfg.numrandomization = 100;
> 
> 
> 
> n1 = 10;    % n1 is the number of subjects
> 
> design              = zeros(2, n1 * 2);
> 
> design(1,1:n1)      = 1;
> 
> design(1,(n1 + 1):(n1 * 2)) = 2;
> 
> design(2, :)        = [1:n1 1:n1];
> 
> cfg.design           = design;
> 
> 
> 
> cfg.ivar             = 1;
> 
> cfg.uvar             = 2;
> 
> stat = ft_timelockstatistics(cfg, data_brain{:}, data_behav{:});
> 
> 
> 
> assert(isequal(stat.rho, -1));
> 
> 2015-10-21 10:54 GMT-07:00 Krebber, Martin <martin.krebber at charite.de>:
> 
>> Hi Xiaoming, hi Arjen,
>> 
>> I've been encountering the same problem. I believe Xiaoming is right when
>> he points out that the permutaion step shuffles data across conditions and
>> that this introduces a negative bias in the distribution. I found the same
>> thing when I correlated RT data with TFRs (absolute power). My distribution
>> was shifted strongly to the left and, thus, not a single negative cluster
>> was significant, but every positive one was.
>> 
>> Xiaomings explanation made a lot of sense to me when I thought about it
>> graphically: Imagine correlating two data vectors, one (x) ranging between
>> .5 and1, the other (y) between 50 and and 100. When plotting this, one gets
>> a cloud of dots on the upper left corner of the diagram. When you then
>> switch the variable assignment of half of the data points (which is what
>> the permutation step seems to do), these dots will now be be shifted to the
>> lower right corner of the diagram. So no matter what the correlation in the
>> original data, chances are that (given different scaling) after permutaion,
>> you get a negative correlation.
>> 
>> I am not 100% sure about this, so please let me know if I made a mistake.
>> 
>> What I tried instead of the 'ft_statfun_correlationT' was using a custom
>> made statfun in which I pass the RTs via the design matrix. With this, my
>> results looked much better. I am not sure, but I guess this is because
>> there is no shuffling between the two variables in this case.
>> 
>> I would really like to know, what is the right way of doing this using
>> just the FieldTrip functions. Is there a way to permute data within
>> variables? I tried cfg.resampling = 'bootstrap', but this is not a
>> permutation, as far as I know.
>> 
>> 
>> Thanks!
>> Martin
>> 
>> 
>> ------------------------------
>> *Von:* fieldtrip-bounces at science.ru.nl [fieldtrip-bounces at science.ru.nl]"
>> im Auftrag von "Arjen Stolk [a.stolk8 at gmail.com]
>> *Gesendet:* Dienstag, 20. Oktober 2015 08:03
>> *An:* FieldTrip discussion list
>> *Betreff:* Re: [FieldTrip] calculating behavioural-power correlation --
>> follow-up questions
>> 
>> Hey Xiaoming,
>> 
>> It's still pretty hard, for me, to guess on basis of that matlab output
>> what is going on here and what you mean with 'shuffling design matrices',
>> and how that shuffling 'biases the cluster distribution'. As you mention
>> yourself, it could be due to various reasons, and you're open to
>> suggestions and increasing your understanding. I'd therefore suggest to try
>> to funnel the number of potential explanations by simulating what you're
>> doing (using input data for which you know how it should behave), after
>> you've read more about what the design matrix and monte carlo statistics
>> are supposed to do. Perhaps the statistics section at the bottom of this
>> page provides a good starting point:
>> http://www.fieldtriptoolbox.org/walkthrough
>> 
>> Hope that helps,
>> Arjen
>> 
>> 2015-10-19 15:56 GMT-07:00 Xiaoming Du <XDu at mprc.umaryland.edu>:
>> 
>>> For example, our power values ranged from 1 to 3 (after log transform);
>>> my behavioral data ranged from 20 to 90;
>>> 
>>> by using above mentioned script, there are 14 negative clusters were
>>> reported in variable stat.
>>> 
>>> stat =
>>> 
>>>                   prob: [30x50 double]
>>>            posclusters: []
>>>    posclusterslabelmat: [30x50 double]
>>>        posdistribution: [1x1000 double]
>>>            negclusters: [1x14 struct]
>>>    negclusterslabelmat: [30x50 double]
>>>        negdistribution: [1x1000 double]
>>>                cirange: [30x50 double]
>>>                   mask: [30x50 logical]
>>>                   stat: [30x50 double]
>>>                    ref: [30x50 double]
>>>                    rho: [30x50 double]
>>>                 dimord: 'chan_freq'
>>>                   freq: [1x50 double]
>>>                  label: {30x1 cell}
>>>                   time: 2.5000
>>>                    cfg: [1x1 struct]
>>> 
>>> However, the p values of those clusters (i.e., stat.negclusters.prob) are
>>> all ones. The smallest value in  stat.negdistribution is way larger than
>>> the largest negative cluster t-sum. This could be real. However, it is more
>>> likely due to the shuffle between power and behavioral group. For example,
>>> design matrix  [1 1 1 1 2 2 2 2; 1 2 3 4 1 2 3 4] was shuffled to [1 2 2 1
>>> 2 2 1 1; 1 2 3 4 1 2 3 4].  After each permutation, for some subjects,
>>> their power data was labeled as behavioral data and vice versa. Because of
>>> the scale difference between power and behavioral data, large negative
>>> correlations were generated by permutation. This further biased the cluster
>>> distribution.
>>> My limited understanding is that, for correlation, each permutation
>>> should fix cfg.ivar and only shuffle half of the cfg.uvar. For example,
>>> permute design matrix [1 1 1 1 2 2 2 2; 1 2 3 4 1 2 3 4]  to [1 1 1 1 2 2
>>> 2; 1 2 3 4 4 2 3 1]. THerefore, after permutation, one subject's power data
>>> corresponds to another subject's behavioral data.
>>> 
>>> I am not good at statistics. It will be really appreciated if you have
>>> any suggestions or comments.
>>> 
>>> Xiaoming
>>> 
>>> 
>>> 
>>> 
>>>>>> Arjen Stolk <a.stolk8 at gmail.com> 10/19/2015 6:01 PM >>>
>>> Hey Xiaoming,
>>> 
>>> Not sure if I understand, but shouldn't the directions of the
>>> correlations be independent of the scaling of the two variables? Looking at
>>> the code of ft_statfun_correlationT it doesn't seem the conversion from
>>> correlation to T value (tstat = rho*(sqrt(max(nunits)-2))/sqrt((1-rho^2)))
>>> would result in a direction change either. Perhaps you could try to first
>>> manually calculate a correlation between signal power and behavioral power,
>>> and see whether anything is behaving unexpectedly?
>>> 
>>> Yours,
>>> Arjen
>>> 
>>> 2015-10-19 14:25 GMT-07:00 Xiaoming Du <XDu at mprc.umaryland.edu>:
>>> 
>>>> Dear FieldTrip users,
>>>> This is Xiaoming from University of Maryland Baltimore. My current
>>>> project requires to calculate behavioral-power correlation across subjects.
>>>> Similar topic was discussed here early this year.
>>>> http://mailman.science.ru.nl/pipermail/fieldtrip/2015-February/008953.html
>>>> According to the suggestions in above mentioned thread, I duplicate my
>>>> power dataset and replace the power values at each time-frequency point
>>>> with behavioral data. Therefore, those two datasets have same structure and
>>>> dimension. I used the following script to test if there are significant
>>>> clusters of correlations.
>>>> cfg = [];
>>>> cfg.parameter = 'powspctrm';
>>>> cfg.method = 'montecarlo';
>>>> cfg.statistic = 'ft_statfun_correlationT';
>>>> ...
>>>> etc
>>>> ...
>>>> design = zeros(2, n1 * 2); % n1 is the number of subjects.
>>>> design(1,1:n1) = 1;
>>>> design(1,(n1 + 1):(n1 * 2)) = 2;
>>>> design(2, :) = [[1:n1 ] [1 : n1]];
>>>> cfg.design = design;
>>>> 
>>>> cfg.ivar = 1;
>>>> cfg.uvar = 2;
>>>> stat = ft_freqstatistics(cfg, dataBeh{:}, dataDX1{:});
>>>> However, it seems when each time the design matrix is permuted,
>>>> FieldTrip is using the same method as for 'ft_statfun_depsamplesT', meaning
>>>> cfg.uvar remains the same while cfg.ivar (1 or 2) is randomly assigned to
>>>> each subject in design matrix. Although I confirmed this by uncommenting
>>>> line 313 (i.e., tmpdesign = design(:,resample(i,:))) in
>>>> ft_statistics_montecarlo.m which allows to display the permuted design
>>>> matrix in command line, please correct me if this is not the case.
>>>> In my mind, this kind of permutation will cause trouble when dealing
>>>> with correlation. For example, in my case, the behavioral data and power
>>>> data have different scales. The power data are much larger than behavioral
>>>> data in general. When assigning behavioral data into power group or vice
>>>> versa, it will induce huge negative correlations between power and
>>>> behavioral measurement. Therefore, no negative clusters will survive from
>>>> permutation test.
>>>> Please let me know if I have mis-understanding or if I did anything
>>>> wrong. Any suggestions will be highly appreciated!
>>>> Thanks.
>>>> Xiaoming
>>>> 
>>>> _______________________________________________
>>>> fieldtrip mailing list
>>>> fieldtrip at donders.ru.nl
>>>> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
>>>> 
>>> 
>>> 
>> 
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20151021/c798d778/attachment.html>
> 
> ------------------------------
> 
> _______________________________________________
> fieldtrip mailing list
> fieldtrip at donders.ru.nl
> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
> 
> End of fieldtrip Digest, Vol 59, Issue 18
> *****************************************

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20151022/1d26e772/attachment-0001.html>


More information about the fieldtrip mailing list