Dynamic correlation matrix generating

Submitted by phil1022 on

Dear Johann,

    I was trying to use Graph Var to do some dynamic connectcome analysis. I tried to generate the correlation matrix from ROI signals. My data was generated from DPARSFA with AAL templete. My data has 120 time points and in my preliminary analysis I would divided the data into 5 non-overlapped windows with each containing 24 time points. So I set the window size as 24, step size as 24 as well. As the result, I only found four correlation matrices in the .mat file. This is abnormal. Can you tell me how to set the window size and step size to get what I want? Thank you very much!

    With kind regards.

    Sincerely,

    Xiaosong

Johann Kruschwitz

Wed, 09/30/2015 - 09:49

Hi,

thanks for pointing to this issue! We totally forgot to include the case for non-overlapping windows in the script! SORRY!!!
DOWNLOAD  HERE the NEW script (first unzip) and replace the old one in GraphVar_beta_v_06.11\src\calc 

@Xiaosong: THANKS!

Dear Johann,

   

I figured it out eventually. I haven’t read your updated script yet, but I feel like to tell you that this issue is not limited to the non-overlapped condition. It also omits the last window of your overlapped condition. Assume we have 100 time points and we have a window size of 50, shift 10 at a time, we would actually generate 6 windows: 1~50, 11~60, 21~70, 31~80, 41~90, 51~100. However based on your old script, the number of windows is calculated as (100-50)/10 = 5. It will omit the last 51~100 window. So I made modification by myself and added 1 to the equation. It works fine. I hope you did the same modification.

Btw, I am not sure if you mentioned but if you input 50 (as your default) as window size, you will actually got a window size of 51, based on your original script. Therefore, people should input their window size by 1 time-point less.

I am glad to help out here.

Sincerely,

Xiaosong

Johann Kruschwitz

Wed, 09/30/2015 - 17:01

Hi Xiasong, I just realized that this is indeed strange! You are totally corect with the fact that last window is omitted... the "+1" in the equation must have been lost (or never added) during changing this script back and forth - I am honestly sorry for this mistake and will correct this in a new official bug release tomorrow. Of course you will be acknowledged! Thanks again for revising the script! Best, Johann

Dear Johann,

    Since you are going to build a new release I think I should also report something else that could be a bug. When calculating dynamic variance over time (the standard deviation as well), there maybe something wrong in the script.

    If you look into the script CalcVars, at around line 475, you will see the "Result=var(cell2mat(ResultS), [], 3)" and 477 the  "Result=std(cell2mat(ResultS), [], 3)". The function cell2mat will creat an error here. So I deleted the cell2mat, and it works fine. It looks like here it doesn't need to do the cell2mat, since you did not have them in the later part of your script where similar calculations are executed.

    Again I am glad to help. This is a great toolbox and I hope you can make it more and more powerful.

    With kind regards.

    Sincerely,

    Xiaosong

Hi all,

thanks to Xiaosong He there is an updated version of GraphVar available for DOWNLOAD.

Bug fixes:
- added the exception that for sliding windows also non-overlapping windows can be generated with gaps between windows
- fixed a bug that when generating sliding windows the last possible window was omitted from generating
- fixed a bug that the window size was erroneous window size+1
- fixed a bug that a cell2mat error occured for variance/standard deviation calculations with small-worldness (sliding windows)

 

Sorry for the inconvenience!
Johann

 

Dear Johann,

    Thank you for the credit. I got an additional question for you, not bugs. ;P

    When calculating dynamic graphic measurements, let's take smallworldness for example, if I have 5 windows, and in the output, I only find the variance (assume I selected) over time, instead of 5 seperate smallworldness for each window. If I want to analyze something else, i.e., standard deviation, need I resart everything again? That would be quite unefficient. I think probably I just did not find the right path where those temporary files (5 smallworldness for the 5 windows) were restored?

    With kind regards.

    Sincerely,

    Xiaosong

 

Forums