[Mne_analysis] Mne_analysis Digest, Vol 113, Issue 27

Stout, Jeffrey jstout at mcw.edu
Thu Jun 15 16:55:34 EDT 2017
Search archives:

Thanks  All, 

I think this was my issue - we are indeed using the wpli-debiased measure.  Sorry for the confusion.

I appreciate all of the help on this.


Jeff Stout



-----Original Message-----
From: mne_analysis-bounces at nmr.mgh.harvard.edu [mailto:mne_analysis-bounces at nmr.mgh.harvard.edu] On Behalf Of mne_analysis-request at nmr.mgh.harvard.edu
Sent: Thursday, June 15, 2017 10:53 AM
To: mne_analysis at nmr.mgh.harvard.edu
Subject: Mne_analysis Digest, Vol 113, Issue 27

Send Mne_analysis mailing list submissions to
	mne_analysis at nmr.mgh.harvard.edu

To subscribe or unsubscribe via the World Wide Web, visit
	https://urldefense.proofpoint.com/v2/url?u=https-3A__mail.nmr.mgh.harvard.edu_mailman_listinfo_mne-5Fanalysis&d=DwICAg&c=aFamLAsxMIDYjNglYHTMV0iqFn3z4pVFYPQkjgspw4Y&r=-re9rx1mJRcK9z2vjZt6NQ&m=Z-28XezESpBrLxF1nKN5lhRHtzUxTmsSfLSEE6fb4mg&s=8v1BlkvOGDfAIH4SfBjjlrQ1hAqaAIsidloMgAD3sx0&e=
or, via email, send a message with subject or body 'help' to
	mne_analysis-request at nmr.mgh.harvard.edu

You can reach the person managing the list at
	mne_analysis-owner at nmr.mgh.harvard.edu

When replying, please edit your Subject line so it is more specific than "Re: Contents of Mne_analysis digest..."


Today's Topics:

   1. Re: Mne_analysis Digest, Vol 113, Issue 24 (Eric Larson)
   2. Re: Negative Weighted Phase Lag Index Values (Cushing, Cody)
   3. How to get coherence between stc files? (Maria Hakonen)


----------------------------------------------------------------------

Message: 1
Date: Thu, 15 Jun 2017 11:19:46 -0400
From: Eric Larson <larson.eric.d at gmail.com>
Subject: Re: [Mne_analysis] Mne_analysis Digest, Vol 113, Issue 24
To: Discussion and support forum for the users of MNE Software
	<mne_analysis at nmr.mgh.harvard.edu>
Message-ID:
	<CAGu2niV547q7NfCOm57yPHoHW_RZpw9-j0wDce6PxaxuF6SO3g at mail.gmail.com>
Content-Type: text/plain; charset="utf-8"

>
> We are just getting started with using this connectivity measure 
> (wpli), so thanks for all of the help and information.  I believe that 
> a lot of the analysis code was from the MNE website, so it should be 
> fairly familiar (I have the pseudo code and code snippet below).  I 
> have attached an image that shows what our lowest negative values (for 
> ~30subjects) are with the wpli_debiased connectivity matrix and the 
> percentage of connections that are negative .


Just to be clear, since it looks like these might be being used interchangeably a bit in these discussions -- "WPLI" and "debiased WPLI2"
are expected to give different sets of values.

For WPLI (our implementation at least), the values should be strictly between 0 and 1, with no negative values. WPLI is therefore biased (non-zero mean for even pure noise data). Can you confirm this?

For debiased WPLI squared, the debiasing produces some small negative values. I suspect in your original email, you might have been talking about *debiased
wPLI* giving you small negative values, even though you mentioned using *WPLI*...?

If the values should vary from -1 to 1, I would assume the percentage of
> negatives to be closer to 50% of the connections (since for every lead 
> roi there would be a lag roi as well), but across subjects we are 
> seeing about a  0-10% of the connections are negative.


It looks like you're saying you're seeing generally small negative values for debiased WPLI, which is to be expected. However, they should not be uniformly spaced from -1 to 1. Rather, the mean (for pure noise) for this measure should be near zero, with generally small values (like the negative ones you report). Positive values thus mean "more likely to be real connectivity". The distribution of values for data with true connectivity should have a long right (positive) tail, which sounds like what you describe. Can you confirm?

HTH,
Eric

P.S. Andrea, from what I see in the code, we already implement the absolute value operation, unlike in the FieldTrip code.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://urldefense.proofpoint.com/v2/url?u=http-3A__mail.nmr.mgh.harvard.edu_pipermail_mne-5Fanalysis_attachments_20170615_a648c1bc_attachment-2D0001.html&d=DwICAg&c=aFamLAsxMIDYjNglYHTMV0iqFn3z4pVFYPQkjgspw4Y&r=-re9rx1mJRcK9z2vjZt6NQ&m=Z-28XezESpBrLxF1nKN5lhRHtzUxTmsSfLSEE6fb4mg&s=xoptAgej77uugg5zhSc0LlAphxil5FkmoJgDj4tmMag&e=  

------------------------------

Message: 2
Date: Thu, 15 Jun 2017 15:20:35 +0000
From: "Cushing, Cody" <CCUSHING1 at mgh.harvard.edu>
Subject: Re: [Mne_analysis] Negative Weighted Phase Lag Index Values
To: Discussion and support forum for the users of MNE Software
	<mne_analysis at nmr.mgh.harvard.edu>
Message-ID:
	<D55DBCE8FA87E7468AC8A021B674DE9425E1DBB4 at PHSX10MB22.partners.org>
Content-Type: text/plain; charset="iso-8859-1"

I'm not sure whether to respond here or to that Digest email that just got sent out, but Jeff appears to also be using the 'wpli2_debiased' method, according to the chunks of code that just got sent out:

"        con_methods = ['coh', 'pli', 'wpli2_debiased'] "

And Eric seems to be correct that these values can indeed be negative.  If you look at Fig. 12 of Vinck et. al 2011, their color mapping spans from -0.2 to 0.6, with the two bias measure (unbiased PLI2 and debased WPLI2) both appearing to reach negative values compared to the direct PLI2.  So, if Jeff is truly using 'wpli2_debiased' as his method just as I am (as the code suggests), then there should be no bug.

Cheers,
Cody





From: mne_analysis-bounces at nmr.mgh.harvard.edu [mne_analysis-bounces at nmr.mgh.harvard.edu] on behalf of Andrea Brovelli [andrea.brovelli at univ-amu.fr]
Sent: Thursday, June 15, 2017 2:49 AM
To: mne_analysis at nmr.mgh.harvard.edu
Subject: Re: [Mne_analysis] Negative Weighted Phase Lag Index Values


Suggestion: in Fieldtrip, the WPLI is implemented in its signed version, it is not the eq.8 of Vinck' paper, which is bounded [0, 1].

The estimator is (line 73 in ft_connectivity_wpli.m<https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_fieldtrip_fieldtrip_blob_master_connectivity_ft-5Fconnectivity-5Fwpli.m&d=DwICAg&c=aFamLAsxMIDYjNglYHTMV0iqFn3z4pVFYPQkjgspw4Y&r=-re9rx1mJRcK9z2vjZt6NQ&m=Z-28XezESpBrLxF1nKN5lhRHtzUxTmsSfLSEE6fb4mg&s=OaAUTRYjh-_PJuvstcrX3GMCX1-nRpeigtZpNxaqRZ4&e= > ):

E(Im(X))/E(|Im(X)|)

Maybe the MNE code got inspiration from it.

Andrea

Le 14-Jun-17 ? 10:48 PM, Eric Larson a ?crit :
this also occurs when computing the debiased squared wpli, where there should undoubtedly be no negative values (unless the debiasing does something strange that I'm not aware of), just FYI.

>From what I recall the debiasing can indeed produce (generally small) negative values, so that at least I would expect. From Vinck et al., 2011:

If the WPLI exceeds the PLI, then the debiased WPLI-square estimator will be negatively biased for small sample sizes.

The WPLI, however, doesn't have this characteristic, and from what I've seen in a brief look at the MNE code, I'm not sure where it could come from (based on where we use abs()). So a minimal example would help us track it down.

Eric




_______________________________________________
Mne_analysis mailing list
Mne_analysis at nmr.mgh.harvard.edu<mailto:Mne_analysis at nmr.mgh.harvard.edu>
https://urldefense.proofpoint.com/v2/url?u=https-3A__mail.nmr.mgh.harvard.edu_mailman_listinfo_mne-5Fanalysis&d=DwICAg&c=aFamLAsxMIDYjNglYHTMV0iqFn3z4pVFYPQkjgspw4Y&r=-re9rx1mJRcK9z2vjZt6NQ&m=Z-28XezESpBrLxF1nKN5lhRHtzUxTmsSfLSEE6fb4mg&s=8v1BlkvOGDfAIH4SfBjjlrQ1hAqaAIsidloMgAD3sx0&e= 


The information in this e-mail is intended only for the person to whom it is addressed. If you believe this e-mail was sent to you in error and the e-mail contains patient information, please contact the Partners Compliance HelpLine at https://urldefense.proofpoint.com/v2/url?u=http-3A__www.partners.org_complianceline&d=DwICAg&c=aFamLAsxMIDYjNglYHTMV0iqFn3z4pVFYPQkjgspw4Y&r=-re9rx1mJRcK9z2vjZt6NQ&m=Z-28XezESpBrLxF1nKN5lhRHtzUxTmsSfLSEE6fb4mg&s=Rktf_VuzjCn-3MMDEwBPFIZuiptkmbCt22lLWK7ACXY&e=  . If the e-mail was sent to you in error but does not contain patient information, please contact the sender and properly dispose of the e-mail.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://urldefense.proofpoint.com/v2/url?u=http-3A__mail.nmr.mgh.harvard.edu_pipermail_mne-5Fanalysis_attachments_20170615_471452ee_attachment-2D0001.html&d=DwICAg&c=aFamLAsxMIDYjNglYHTMV0iqFn3z4pVFYPQkjgspw4Y&r=-re9rx1mJRcK9z2vjZt6NQ&m=Z-28XezESpBrLxF1nKN5lhRHtzUxTmsSfLSEE6fb4mg&s=igGQfcTVwSX0djnHmSt6nNoXG3VUfK0jdqNKFLB1JTg&e=  

------------------------------

Message: 3
Date: Thu, 15 Jun 2017 18:53:10 +0300
From: Maria Hakonen <maria.hakonen at gmail.com>
Subject: [Mne_analysis] How to get coherence between stc files?
To: Discussion and support forum for the users of MNE Software
	<Mne_analysis at nmr.mgh.harvard.edu>
Message-ID:
	<CADF3goMhV4Z_M2uQeATmP8_ZKafE8Dzs8Q9N0NyspVBMKv3mkA at mail.gmail.com>
Content-Type: text/plain; charset="utf-8"

Dear mne experts,

In an example ?Compute coherence in source space using a MNE inverse solution? mne.connectivity.spectral_connectivity is used to compute the coherence between a seed in the left auditory cortex and the rest of the brain based on single-trial MNE-dSPM inverse solutions. However, I would like to use mne.connectivity.spectral_connectivity to compute the coherence between two stc files measured in two different conditions.

I have tried to do this as follows:
stcs=np.concatenate((stc_1.data,stc_2.data),axis=0)
stcs=stcs.tolist()
indices=(np.arange(1,20484),np.arange(20485,40968)) (I would like to get the coherence between each vertex in stc1 and the corresponding vertices in
stc2)
coh, freqs, times, n_epochs, n_tapers = spectral_connectivity(
    stcs, method='coh', mode='fourier', indices=indices,
    sfreq=sfreq, fmin=fmin, fmax=fmax, faverage=True, n_jobs=1)

However, I get:

Connectivity computation...
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-40-139613d5f602> in <module>()
      1 coh, freqs, times, n_epochs, n_tapers = spectral_connectivity(
      2     stcs, method='coh', mode='fourier', indices=indices,
----> 3     sfreq=sfreq, fmin=fmin, fmax=fmax, faverage=True, n_jobs=1)

/share/apps/mne/mne-python/python2.7/lib/python2.7/site-packages/mne-0.11.dev0-py2.7.egg/mne/connectivity/spectral.pyc
in spectral_connectivity(data, method, indices, sfreq, mode, fmin, fmax, fskip, faverage, tmin, tmax, mt_bandwidth, mt_adaptive, mt_low_bias, cwt_frequencies, cwt_n_cycles, block_size, n_jobs, verbose)

/share/apps/mne/mne-python/python2.7/lib/python2.7/site-packages/mne-0.11.dev0-py2.7.egg/mne/utils.pyc
in verbose(function, *args, **kwargs)
    549         finally:
    550             set_log_level(old_level)
--> 551     return function(*args, **kwargs)
    552
    553

/share/apps/mne/mne-python/python2.7/lib/python2.7/site-packages/mne-0.11.dev0-py2.7.egg/mne/connectivity/spectral.pyc
in spectral_connectivity(data, method, indices, sfreq, mode, fmin, fmax, fskip, faverage, tmin, tmax, mt_bandwidth, mt_adaptive, mt_low_bias, cwt_frequencies, cwt_n_cycles, block_size, n_jobs, verbose)
    772             # get the data size and time scale
    773             n_signals, n_times_in, times_in = \
--> 774                 _get_and_verify_data_sizes(first_epoch)
    775
    776             if times_in is None:

/share/apps/mne/mne-python/python2.7/lib/python2.7/site-packages/mne-0.11.dev0-py2.7.egg/mne/connectivity/spectral.pyc
in _get_and_verify_data_sizes(data, n_signals, n_times, times)
    479     n_signals_tot = 0
    480     for this_data in data:
--> 481         this_n_signals, this_n_times = this_data.shape
    482         if n_times is not None:
    483             if this_n_times != n_times:

AttributeError: 'float' object has no attribute 'shape'

Could someone please let me know what I am doing wrong?

Best,
Maria
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://urldefense.proofpoint.com/v2/url?u=http-3A__mail.nmr.mgh.harvard.edu_pipermail_mne-5Fanalysis_attachments_20170615_3329bd22_attachment.html&d=DwICAg&c=aFamLAsxMIDYjNglYHTMV0iqFn3z4pVFYPQkjgspw4Y&r=-re9rx1mJRcK9z2vjZt6NQ&m=Z-28XezESpBrLxF1nKN5lhRHtzUxTmsSfLSEE6fb4mg&s=aJ2MBjU8Ee4MJMMZPMRiEBMx3dyjDSQD_PtP8I4MzSc&e=  

------------------------------

_______________________________________________
Mne_analysis mailing list
Mne_analysis at nmr.mgh.harvard.edu
https://urldefense.proofpoint.com/v2/url?u=https-3A__mail.nmr.mgh.harvard.edu_mailman_listinfo_mne-5Fanalysis&d=DwICAg&c=aFamLAsxMIDYjNglYHTMV0iqFn3z4pVFYPQkjgspw4Y&r=-re9rx1mJRcK9z2vjZt6NQ&m=Z-28XezESpBrLxF1nKN5lhRHtzUxTmsSfLSEE6fb4mg&s=8v1BlkvOGDfAIH4SfBjjlrQ1hAqaAIsidloMgAD3sx0&e= 

End of Mne_analysis Digest, Vol 113, Issue 27
*********************************************



More information about the Mne_analysis mailing list