<p dir="ltr">Hello Jörn,</p>
<p dir="ltr">Thank you for the suggestion. I managed to get connectivity plots with that function. Coming back to the question in my previous email, would it be OK to take the absolute value of the debiased wpli values to be used in graph analysis as edge weights? For example, HERMES, another connectivity toolbox returns only values between 0 and 1 for this measure. Also, Vinck et al. paper says that the value should be positive, I guess by taking the absolute value in the case of a lagging phase. Sorry if this is a basic question, but I would appreciate if someone can shed some light on this. </p>

<p dir="ltr">Kind regards,<br>
Dragos Stanciu<br></p>
<div class="gmail_quote">On Jul 31, 2014 2:18 PM, Jörn M. Horschig <<a href="mailto:jm.horschig@donders.ru.nl">jm.horschig@donders.ru.nl</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi Dragos,<br>
<br>
have yoi checked ft_topoplotCC?<br>
<br>
Best,<br>
Jörn<br>
<br>
On 7/31/2014 12:06 AM, Dragos Stanciu wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hello Jörn,<br>
<br>
Thank you so much for responding. The suggested changes were spot on and ft_connectivityanalysis executed successfully.<br>
In the end, I went with the approach of redefining the 10s epoch in 2s minitrials and performing ft_freqanalysis on these minitrials with /cfg.output='fourier'/ and /keeptrial='yes'. /I then did ft_connectivityanalysis on the frequency structures resulted from processing the segmented data. This would give me connectivity matrices for each 10s epoch, which I then average to get one connectivity matrix for the subject (technically, I have a connectivity matrix for each frequency bin, but I can again average across the frequency spectrum).<br>

<br>
I have a question on the debiased weighted phase lag index measure. The values in the matrix vary between -1 and 1 (depending if the relative phase lags or leads). When I construct the adjacency matrices, is it just a matter of taking the absolute value of these values?<br>

<br>
I would also like some advice on plotting connectivity matrices. I was able to plot one matrix with ft_plot_matrix, but it would be really nice if I could plot a connectivity graph where the thickness of the edges correspond to the strength of the connectivity measure. I tried ft_topoplotER with 4D148.lay as the layout file and 'gui' as refchannel, but I didn't get anything interesting. As my data is MEG, it doesn't make sense to me to choose a reference channel...<br>

Ideally, I would like to combine the layout (4D148.lay) with the connectivity matrix for plotting the graph. Do you have any ideas for this? Also, do you have any other suggestions on what other plotting functions can be used with these connectivity matrices? I've looked through the tutorial, but the functions don't seem very relevant to my type of data.<br>

<br>
Thank you for your help.<br>
<br>
Regards,<br>
Dragos Stanciu<br>
<br>
    Message: 9<br>
    Date: Wed, 30 Jul 2014 10:28:50 +0200<br>
    From: "J?rn M. Horschig" <<a href="mailto:jm.horschig@donders.ru.nl" target="_blank">jm.horschig@donders.ru.nl</a><br>
    <mailto:<a href="mailto:jm.horschig@donders.ru.nl" target="_blank">jm.horschig@donders.<u></u>ru.nl</a>>><br>
    To: FieldTrip discussion list <<a href="mailto:fieldtrip@science.ru.nl" target="_blank">fieldtrip@science.ru.nl</a><br>
    <mailto:<a href="mailto:fieldtrip@science.ru.nl" target="_blank">fieldtrip@science.ru.<u></u>nl</a>>><br>
    Subject: Re: [FieldTrip] Connectivity analysis after applying Welch's<br>
            method<br>
<br>
    Hi Dragos,<br>
<br>
    while quickly browisng through your mail, it appears to me that you<br>
    simply need to set single_epoch_freq.dimord = 'rpt_chan_freq'.<br>
    FieldTrip<br>
    is using the dimord field to infer the order of the dimensions<br>
    (*dim*ension *ord*er). The actual dimensions of powspctrm and<br>
    crsspctrm<br>
    are now inconsistent with the dimord specifications.<br>
<br>
    Best,<br>
    J?rn<br>
<br>
<br>
    On 7/30/2014 1:18 AM, Dragos Stanciu wrote:<br>
    > Dear FieldTrippers,<br>
    ><br>
    > I'm Dragos Stanciu and I'm working on my MSc in Neuroinformatics<br>
    > dissertation at the University of Edinburgh. My project involves<br>
    > analysis of resting-state functional connectivity using graph theory<br>
    > in Alzheimer's disease based on MEG data.<br>
    ><br>
    > Each of my subjects has a number of 10s epochs (trials) associated<br>
    > with him/her. I was able to compute the coherence and weighted phase<br>
    > lag index measures (with /ft_freqanalysis /and<br>
    > /ft_connectivityanalysis) /by treating my 10s epochs as trials, but<br>
    > now I would like to reduce the amount of noise in the estimation of<br>
    > the frequency spectrum by employing Welch's method.<br>
    ><br>
    > For this, I split each 10s epoch in 2s segments (minitrials)<br>
    with 50%<br>
    > overlap:<br>
    ><br>
    >     [sep_epoch_data] = ft_redefinetrial(cfg_cut,<br>
    single_epoch_data)/. /<br>
    ><br>
    ><br>
    > I then apply /ft_preprocessing /on the minitrials:<br>
    ><br>
    >      [processed_single_epoch] = ft_preprocessing(cfg,<br>
    sep_epoch_data);<br>
    ><br>
    > I then do frequency analysis on the preprocessed segmented data:<br>
    ><br>
    >     [single_epoch_freq] = ft_freqanalysis(cfg_freq,<br>
    >     processed_single_epoch);<br>
    ><br>
    > where<br>
    ><br>
    >     display(cfg_freq)<br>
    >             method: 'mtmfft'<br>
    >              taper: 'hanning'<br>
    >             foilim: [0.5000 4]<br>
    >             output: 'powandcsd'<br>
    >            channel: {148x1 cell}    % 148 channels labelled from<br>
    A1 to<br>
    >     A148<br>
    >          keeptrial: 'no'     % don't keep the minitrials, as we want<br>
    >     to average them<br>
    >         keeptapers: 'no'<br>
    ><br>
    > Please note that I average the minitrials (/keeptrial = 'no'/) as I<br>
    > want to get an average of the frequencies.<br>
    ><br>
    > The resulting /single_epoch_freq/ structure looks like:<br>
    ><br>
    >     display(single_epoch_freq)<br>
    >     label: {148x1 cell}<br>
    >            dimord: 'chan_freq'<br>
    >              freq: [0.5001 1.0002 1.5004 2.0005 2.5006 3.0007 3.5008<br>
    >     4.0009]<br>
    >         powspctrm: [148x8 double]<br>
    >          labelcmb: {10878x2 cell}     % channel combinations<br>
    (148*147/2)<br>
    >         crsspctrm: [10878x8 double]<br>
    >               cfg: [1x1 struct]<br>
    ><br>
    ><br>
    > The last step is to append the averaged frequency structures of each<br>
    > 10s epoch together and perform connectivity analysis on the main 10s<br>
    > epochs. I do the concatenation like so:<br>
    > freq_avgs_powspctrm = [freq_avgs_powspctrm;<br>
    > permute(single_epoch_freq.<u></u>powspctrm, [3,1,2])];<br>
    ><br>
    > freq_avgs_crsspctrm = [freq_avgs_crsspctrm;<br>
    > permute(single_epoch_freq.<u></u>crsspctrm, [3,1,2])];<br>
    ><br>
    > The idea behind /permute(..., [3, 1, 2])/ is that I want the first<br>
    > dimension to represent trials, the second dimension channel<br>
    > combinations and the third dimension frequencies, as this is needed<br>
    > for the input of /ft_connectivity_wpli /(Repetitions x<br>
    > Channelcombination (x Frequency)).<br>
    ><br>
    > I then call stat_conn = ft_connectivityanalysis(cfg_<u></u>conn,<br>
    freq_avgs);<br>
    > where:<br>
    ><br>
    >     display(cfg_conn)<br>
    >          method: 'wpli_debiased'<br>
    >         channel: {148x1 cell}<br>
    ><br>
    > and<br>
    ><br>
    >     display(freq_avgs)<br>
    >          powspctrm: [4x148x8 double]      % as I have 4 ten<br>
    second epochs<br>
    >         crsspctrm: [4x10878x8 double]     % as I have 4 ten<br>
    second epochs<br>
    >             label: {148x1 cell}<br>
    >            dimord: 'chan_freq'<br>
    >              freq: [0.5001 1.0002 1.5004 2.0005 2.5006 3.0007 3.5008<br>
    >     4.0009]<br>
    >          labelcmb: {10878x2 cell}<br>
    >               cfg: [1x1 struct]<br>
    ><br>
    ><br>
    > The error that I get when running /ft_connectivityanalysis/ is:<br>
    ><br>
    >     Error using cat<br>
    >     CAT arguments dimensions are not consistent.<br>
    >     Error in ft_checkdata>fixcsd (line 1170)<br>
    >         data.crsspctrm = cat(catdim, data.powspctrm,<br>
    data.crsspctrm);<br>
    ><br>
    ><br>
    > When debugging, /catdim/ is equal to 1. The error occurs because the<br>
    > 2nd dimension of data.powspctrm and data.crsspctrm are not equal<br>
    > (former is 148, latter is 10878). Do you have any suggestions on<br>
    > getting around this problem? Should I construct /freq_avgs /(data<br>
    > input to ft_connectivityanalysis) differently? I'm also open to<br>
    > different approaches to working out Welch's method in FieldTrip.<br>
    ><br>
    > Please download this archive that contains my test script and 4<br>
    > example 10s epochs of a subject:<br>
    > <a href="https://www.dropbox.com/s/js7pztai02f5p27/Welch_fieldtrip.zip" target="_blank">https://www.dropbox.com/s/<u></u>js7pztai02f5p27/Welch_<u></u>fieldtrip.zip</a><br>
    The code<br>
    > should make things clearer (or the opposite).<br>
    > Observations: I thought about using /ft_freqanalysis_mtmwelch/, but<br>
    > apparently it's deprecated.<br>
    ><br>
    > Thank you all in advance for your feedback.<br>
    ><br>
    > Kind regards,<br>
    > Dragos Stanciu<br>
    ><br>
<br>
<br>
    --<br>
    J?rn M. Horschig<br>
    PhD Student<br>
    Donders Institute for Brain, Cognition and Behaviour<br>
    Centre for Cognitive Neuroimaging<br>
<br>
<br>
<br>
______________________________<u></u>_________________<br>
fieldtrip mailing list<br>
<a href="mailto:fieldtrip@donders.ru.nl" target="_blank">fieldtrip@donders.ru.nl</a><br>
<a href="http://mailman.science.ru.nl/mailman/listinfo/fieldtrip" target="_blank">http://mailman.science.ru.nl/<u></u>mailman/listinfo/fieldtrip</a><br>
</blockquote>
<br>
<br>
-- <br>
Jörn M. Horschig<br>
PhD Student<br>
Donders Institute for Brain, Cognition and Behaviour<br>
Centre for Cognitive Neuroimaging<br>
Radboud University Nijmegen<br>
Neuronal Oscillations Group<br>
FieldTrip Development Team<br>
<br>
P.O. Box 9101<br>
NL-6500 HB Nijmegen<br>
The Netherlands<br>
<br>
Contact:<br>
E-Mail: <a href="mailto:jm.horschig@donders.ru.nl" target="_blank">jm.horschig@donders.ru.nl</a><br>
Tel:    <a href="tel:%2B31-%280%2924-36-68493" value="+31243668493" target="_blank">+31-(0)24-36-68493</a><br>
Web: <a href="http://www.ru.nl/donders" target="_blank">http://www.ru.nl/donders</a><br>
<br>
Visiting address:<br>
Trigon, room 2.30<br>
Kapittelweg 29<br>
NL-6525 EN Nijmegen<br>
The Netherlands<br>
<br>
______________________________<u></u>_________________<br>
fieldtrip mailing list<br>
<a href="mailto:fieldtrip@donders.ru.nl" target="_blank">fieldtrip@donders.ru.nl</a><br>
<a href="http://mailman.science.ru.nl/mailman/listinfo/fieldtrip" target="_blank">http://mailman.science.ru.nl/<u></u>mailman/listinfo/fieldtrip</a><br>
</blockquote></div>