What does a wavelet coherence plot tell you?

1 min read

Can you find any pattern in the two signals, green and blue?

Two Time Series
Two Time Series

The blue signal is the brain wave (measured by NIRS) of a person when he is pressing some buttons (the timing of button pressing is shown in the vertical lines); the green signal is also brain wave but from a second person who is doing the same thing (button pressing). With naked eyes, it’s hard to see if there is any pattern in the signals in relation with each other, or with the button pressing. But wavelet coherence analysis tell you something.

Wavelet Coherence
Wavelet Coherence

In the above figure, I plot the wavelet coherence between the two signals in both time and frequency domain. Coherence is kind of correlation. 1 (red) means the two signals are highly correlated and 0 (blue) means no correlation. There are definitely something interesting between the two signals.

First, there is a red band in the period 8 region. As the sampling frequency of the signals is 10Hz, period 8 means 0.8s. This band is originated from heart beating (~1Hz) and indicates that the two people’s heart beating is highly correlated.

Second, there are some red blobs in the period 64 region. The button pressing is occurring at 6-7s frequency. These blobs indicate that the two people’s brain are correlated during button pressing.

So, with wavelet coherence analysis, you can discover something you might not discover with other methods.

Cross Wavelet and Wavelet Coherence Toolbox Note: this link is dead. To download the “Cross Wavelet and Wavelet Coherence Toolbox”, please enter

Other blog posts on wavelet analysis

PS: You may wonder why the two brain signals are correlated. In fact, the two people are doing a cooperative task. They have to press buttons at the same time to win a point. We at the same time measure their brain activity and find their brain is correlated during cooperation (but not during competition).

Check out our publication: Cui et al, NIRS-based hyperscanning reveals increased interpersonal coherence in superior frontal cortex during cooperation, NeuroImage, 2012

[update 2017-01-25] We contributed to MatLab (wavelet toolbox) https://www.alivelearn.net/?p=1957

第十一期 fNIRS Journal Club 通知 2020/8/29,10am

北京时间2020年8月29日周六上午10点, 深圳大学成晓君助理教授将为大家讲解她去年发表的一篇用近红外超扫描揭示人际协调的神经机制的文章。同时,她还会和大家介绍如何用Granger causality分析两个信号的因果关系。欢迎大家参加并参与讨论。 她要讲的文献如下: Cheng, Pan, Hu, Hu (2019) Coordination Elicits Synchronous Brain Activity Between Co-actors: Frequency Ratio Matters Frontiers in neuroscience 13() 1071 Abstract: People...
Xu Cui
48 sec read

第十期 fNIRS Journal Club 视频

在2020/7/25日, 北京航空航天大学的汪待发副教授讲解了他发表的一篇BCI文章。视频如下: Youtube:https://youtu.be/gAQQrmbWSOcYouku:https://v.youku.com/v_show/id_XNDc2OTAxNzkzMg==.html
Xu Cui
4 sec read

第十期 fNIRS Journal Club 通知 2020/7/25,10am

北京时间2020年7月25日周六上午10点,北京航空航天大学的汪待发副教授,博士生导师,将为大家讲解他们组去年发表的一篇脑机交互(BCI)的近红外文章。欢迎大家参加并参与讨论。 他要讲的文献如下:Y. Zheng,D. Zhang, L. Wang, Y. Wang, H. Deng, S. Zhang, D. Li, D. Wang, “Resting-State-Based Spatial Filtering for an fNIRS-Based Motor Imagery...
Xu Cui
1 min read

29 Replies to “What does a wavelet coherence plot tell you?”

  1. Dear Dr. Xu:

    Could you please tell me what tools you usually apply when you analyze the data from NIRS? I always get signals from which the pattern are usually hard to detect with bare eye. Also, when you consider the changes in signal, did you take the scattering coefficient changes into consideration?

    Hope to see your reply.


  2. @Zoe
    I usually write my own programs to analyze data. I used nirs-spm for a while and you may check it out.

    We do use scattering coefficient to calculate the change of hbo and hbr.

  3. Dear Dr. Xu:
    Thank you, I will check the SPM.
    Does that mean that you calculate the scattering coefficient in real time, and apply the real time optical property to calculate the HbO and Hbr level?
    And how do you usually consider the brain structure, do you consider it as several layers or you treat it as a homogeneous tissue?

    Thanks for your time!
    Best Regards

  4. @Zoe
    It’s called NIRS-SPM.

    No. For we calculate after we acquired the data. For real time experiment, the device we use (ETG4000) calculated the hbo hbr level automatically.

    We did not consider the structure of brain in the calculation.

  5. Can we classify normal ECG and abnormal ECG using wavelet coherence and cross correlation.

  6. Hi, Dr Cui
    What is coherence mean? I know it is a character of waves, which have the same frequency. But, when it comes to two persons, what’s that mean? And what could it tell us?

  7. Dear Dr. Xu

    My research is related to “Spatiotemporal groundwater level modeling using hybrid artificial intelligence-meshless method”

    i like to know what is the correlation between input time series data (rainfall, runoff and grounwater level lag time series) and output time series data (groundwater level).

    ANN input and output prediction:
    R(t-1) , R2(t-1), GL (t-1) —> Gl (t)

    What can use wavelet coherence?

  8. Dear Sir,

    can you please guide me how I can cut the cone of influence in WTC diagram and how I can limit my frequency scale upto 256

  9. Dear Dr. Xu,

    I wonder if you could share a small sample as .CVS file from one of your experiments. The reason I am asking for this is that the data I am using appears to have a different result when I plot the wavelet coherence. So I do not know if my database is wrong or not.

    I did an anti-correlation check between Hbo and Hbr and it appears to be OK with only 3 or 4 bad channels.

    I can share/email my figures if it is needed.

    Thanks for your help.

  10. Dear Dr. Cui,

    As you said, there are some red blobs in the period 64 region (i.e., about 6.4s). The button pressing is occurring at 6-7s frequency. These blobs indicate that the two people’s brain are correlated during button pressing.

    Since your task lasted about only 6 min, the peak MaxScale reached 1024 region. I used the same wtc method to analyze the data lasting 40 min (task:a long two-person talk),however the peak MaxScale reached 8192 region. My question is, whether the horizontal coordinate (i.e., Time) covaried with the vertical coordinate (i.e., Period)?

    Closely related, the inter-brain coherence in my 40-min talk mainly appears in the 256-1024 period. It is weird to focus such high period based on your rationale provided (i.e., 64period corresponds 6~7s button-pressing). Simply because I have not see such high period in existing fNIRS hyperscanning studies.

    I look forward to hearing you!

    Yafeng Pan

  11. Dear Dr. Xu
    感谢您分享的程序和使用心得体会。交叉小波和小波相干图谱里面的箭头有特定的含义,右箭头表示正相关,左箭头表示负相关,这个还能理解。但是上下箭头表示相位角提前或滞后90°,这是什么概念,具体表示什么含义呢,还请Dr. Xu帮忙解释一下.
    Thank you!

  12. 您好,我在理解matlab生成的wavelet coherence图的时候发生了困难,找到了您的博客。

    1.我很困惑的是生成了这样一个wavelet scale – frequency/period的矩阵,如何才能把它压缩成一个scalar来形容这两个timeseries的整体的相关性?就像相关系数那样?
    2.我有同一个人两个不同脑部ROI的fMRI的timeseries, 有80个timepoints, TR=720ms。那么对应timescale-period图中的某一个点,例如, 在time40秒处period20秒处的取值是0.999,表达了什么含义呢?是从0~40秒的范围内,20秒一个cycle的时间内,相关度很高的意思吗?

  13. @Xiang Xiao
    1. 可以把这个矩阵的数值平均成一个值。参考:http://www.alivelearn.net/?p=1518
    2. 说明在time 40s附近,这两个信号在1/20频率上有很高的相关度。

  14. @Xu Cui

    感谢回答!我也看了您哪一篇,您的意思是先过滤一部分必定相关的(例如period > 32 )然后再直接求平均吗?这样会不会损失了比较多的情报。

    另外再追问一下,https://cn.mathworks.com/help/wavelet/ref/wcoherence.html matlab2016b自带了Wavelet coherence的模块,但是计算Wavelet coherence矩阵的时候可以设置两个参数,一个是period,一个是frequency,也可以都不设置。例如我上面问您的那个例子里的fMRI的时间序列,应该怎么样设置period和frequency呢?比如frequecny是不是就是TR=720ms的倒数设置为1/0.72而period(interval)就设置为seconds(0.72),还是说不用设置?


  15. @Xiang Xiao

    matlab自带的wavelet coherence这个,我还不熟悉,因此不敢乱给建议。

    btw,matlab的wavelet package中用到的nirs数据是我们的数据:https://www.mathworks.com/help/wavelet/examples/compare-time-frequency-content-in-signals-with-wavelet-coherence.html

  16. 我想请问,wavelet coherence中关于significance level的计算问题,您论文中的significance level的计算方法跟A Grinsted工具箱中的一样吗?

  17. 非常感谢您的回答,我想问一个问题,当有多个试次时,如何计算这些试次的平均wavelet coherence?

  18. Dear Cui,

    Thank you for the complete explanation for the wavelet analysis. I am currently conducting an analysis using this method. You mention that coherency in wavelet representing the correlation between two (time-series) dataset. However, is there anyway to understand if the data were negatively or positively correlated?

Leave a Reply

Your email address will not be published. Required fields are marked *