Home › Forums › General Help › EEG graph analysis
Tagged: connectivity; PLV; EEG
 This topic has 9 replies, 3 voices, and was last updated 1 year, 2 months ago by Mite Mijalkov.

AuthorPosts

amna.ghParticipant
Hi Mite,
I have question regarding the results returned by Braph of my EEG graph analysis. Looking at the nodal measures (after clicking at comparision), in this window there are columns like –> difference, p(1 tailed), fdr(1 tailed)… and so on.
I am wondering that do we still have to apply fdr if this column has zero values. Sometime it has value like 1e3 (fdr1 tail). Does it show the value of false discovery?
Also if I have repeated measure design, do I have to define some other parameters or by selecting longitudinal study will work?Thanks,
AmnaMite MijalkovKeymasterHi Amna,
We are very happy you chose to use Braph for your analysis and I hope everything is going well with it.
The table on the Nodal measures panel contains the information on the calculated parameters outputted from the permutation test. The fdr part of this table works in the following way:
To calculate the false discovery rate (corrected by using the BenjaminiHochberg procedure, http://braph.org/manual/braingraphs/) the pvalues are ranked in ascending order and compared with their false corrected values. Once the largest pvalue that is smaller than the corresponding falseratecorrected value is identified, all the pvalues smaller than this value are considered significant. These multiple comparisons are performed at a particular density for a given measure across all of the regions in the brain atlas.
Therefore, if you have a zero in the fdr column this means that none of the regions show a significant differences at that particular density value once their corresponding pvalues are fdr corrected. Conversely, a nonzero pvalue in the fdr column is the largest pvalue discussed earlier (this value can be for any region but it is calculated at the particular density). In other words, if the pvalue that is shown in the pvalue column is smaller than the corresponding fdr value shown in the fdr column, that region is significant at this density. Please note that as you change the regions from the popup menu, the fdr value does not change since for a given measure it depends only on the density.
For your second question, yes, the longitudinal study will work.
If you need further help, please do not hesitate to contact me.
Best,
Miteamna.ghParticipantHi Mite,
Thanks for your detailed answer. I would like to ask about connectivity matrix calculation.
I have already calculated connectivity matrices using phase locking values (PLV). For that reason I would like to bypass the connectivity matrices calculation option and start graph theoretical analysis on matrices that I already got using PLV algorithm. However, I can see that one has to select different measures (spearman, pearson etc) in braph. The question is how can I eliminate this option in Braph? Cause changing this option is effecting my already calculated connectivity matrices. Is it possible or do I have to measure connectivities again using time series of EEG data?Many thanks,
AmnaMite MijalkovKeymasterHi Amna,
Currently you cannot enter the adjacency matrix directly from the graphical user interface. However, you could still perform the analysis with a precalculated adjacency matrix from the command line while using all functionalities of Braph (like calculation of graph measures).
If, on the other hand, you would still like to use the graphical interface you would need to modify the code a bit in order to allow for the adjacency matrix to be inputted.
Assuming that you have an adjacency matrix already calculated for each subject you would need to modify two things:
1. Modify the input to the GUIfMRICohort / fMRICohort so that instead of time series for each brain region, you will be able to import matrices.
2. Modify the fMRIGraphAnalysis object (in the method adjmatrix either add one case in the switch function or modify an existing case that you would not use) so that instead of reading the object data and calculating the matrix, it reads the adjacency matrix from each subject and accepts it without doing any calculation.If you instead have a ready Matlab code that will calculate the adjacency matrix with the PLV method provided the time series of the subject, you could just modify the fMRIGraphAnalysis object. In this case, you would add another case in the switch function (the method adjmatrix) that would execute PLV instead of the standard correlation methods.
After these modifications, all other features of BRAPH will work as in the original case.
I really hope this was helpful. If you need any more information, or further help about these modifications, please do not hesitate to ask me.
Best,
MiteVeroniqueGuestDear Mite,
I have just knwon about BRAPH software and I am very happy to have find it on the web !! However, as Amma, I am a little bit concerned about EEG connectivity matrix . Indeed, in the EEG field, connectivity matrix are not calculated from correlation (pearson or others types) while it is the case in fMRI data …. so as Amma I have already calculated connectivity matrices using phase locking values (PLV).
You have given information about how to proceede with but unfortunately I am not familiar with Matlab so I do not know how to do when you say:
1. Modify the input to the GUIfMRICohort ……
2. Modify the fMRIGraphAnalysis ….
What do you mean by modify ?? What should I do ??
Many thanks,
VeroniqueMite MijalkovKeymasterDear Veronique,
I am happy you are using Braph and hope you find it useful and helpful for your research.
I understand your concern. I will implement the feature to import and analyze precalculated adjacency matrix and will describe a detailed step by step instructions in the next few days.
If you need any additional help please do not hesitate to contact me.
Best,
MiteVeroniqueGuestThank you so much. This is very kind.
I look forward to seeing progress …
VeroniqueMite MijalkovKeymasterHi Veronique,
I modified the Braph toolbox in order to be able to accept previously calculated matrices. It works in the following way:
1) You should have the adjacency matrix for each subject saved separately in a Matlab file (.mat) and group the matrices according to your study. Then, without any modification to the EEG Cohort files you would be able to import the adjacency matrices for each group as explained in the manual (http://braph.org/manual/fmri/fmricohort/ ; since EEG analysis is analogous to the fMRI analysis, the manual’s explanations are valid for both cases).
Please note that your adjacency matrix needs to be consistent with the atlas you uploaded for this to work; for example if you upload brain atlas of 200 regions, you need to have an adjacency matrix of size 200×200.2) In the EEGGraphAnalysis.m file, locate the function adjmatrix. In this function, after the line case EEGGraphAnalysis.CORR_KENDALL you should see [A,P] = corr(data,’Type’,’Kendall’) (this should be located at line 355 in EEGGraphAnalysis.m). You would need to modify this line to read:
A = data;
P = zeros(size(data));
In other words, the function [A,P] = adjmatrix(ga,data) in the file EEGGraphAnalysis.m should look like this (notice the line commented out after case EEGGraphAnalysis.CORR_KENDALL):
function [A,P] = adjmatrix(ga,data)
% ADJMATRIX calculates the adjaciency matrix
%
% [A,P] = ADJMATRIX(GA,DATA) calculates the adjaciency matrix A and the
% matrix of pvalues for correlations P, given the graph analysis GA
% and its subject data DATA.
%
% See also EEGGraphAnalysis, corr, partialcorr, corrcoef.switch ga.getProp(EEGGraphAnalysis.CORR)
case EEGGraphAnalysis.CORR_SPEARMAN
[A,P] = corr(data,’Type’,’Spearman’);
case EEGGraphAnalysis.CORR_KENDALL
%[A,P] = corr(data,’Type’,’Kendall’);
A = data;
P = zeros(size(data));
case EEGGraphAnalysis.CORR_PARTIALPEARSON
[A,P] = partialcorr(data,’Type’,’Pearson’);
case EEGGraphAnalysis.CORR_PARTIALSPEARMAN
[A,P] = partialcorr(data,’Type’,’Spearman’);
otherwise % EEGGraphAnalysis.PEARSON
[A,P] = corrcoef(data);
endswitch ga.getProp(EEGGraphAnalysis.NEG)
case EEGGraphAnalysis.NEG_ZERO
A(A<0) = 0;
case EEGGraphAnalysis.NEG_ABS
A = abs(A);
otherwise % EEGGraphAnalysis.NEG_NONE
end
endWhat this accomplishes is to modify the Kendall correlation option in the graphical interface to use the adjacency matrix you provide instead of calculating correlation coefficient. Therefore, please choose this option of the rest of your analysis. If you choose any of the other four options, they would still work as coded originally; they would treat your adjacency matrix as time series and calculate correlation coefficient between different columns.
3) This modification is not specific to EEG analysis or to Kendall option. If you would actually need to use Kendall correlation coefficient you could modify any of the other option as explained above and this method would still work. Moreover, if you would like to use the fMRI analysis part, you can modify the fMRIGraphAnalysis.m file analogously.
I hope that this explanation helps you and you will be able to modify Braph to suit your analysis. If you need any additional help with this issue or any other question please do not hesitate to ask and I will do my best to help.
Best,
MiteChe LiuGuestHello Mite,
Braph makes the analysis much easier. Now, I want to load connectivity matrix from fMRI data, because I want to control for age and gender. I read the one you posted about how to modify the Braph toolbox (http://braph.org/forums/topic/eeggraphanalysis/). I followed each steps. However, there is still errors as below:
Matrix dimensions must agree.
Error in GUIfMRIGraphAnalysis/update_matrix (line 714)
A = A+ga.getA(indices(i));
Error in GUIfMRIGraphAnalysis/cb_calc_corr (line 439)
update_matrix()
Error while evaluating UIControl Callback.
Matrix dimensions must agree.
Error in GUIfMRIGraphAnalysis/update_matrix (line 714)
A = A+ga.getA(indices(i));
Error in GUIfMRIGraphAnalysis/cb_calc_graph (line 434)
update_matrix()
Error while evaluating UIControl Callback.
Matrix dimensions must agree.
Error in GUIfMRIGraphAnalysis/update_matrix (line 714)
A = A+ga.getA(indices(i));
Error in GUIfMRIGraphAnalysis/cb_calc_corr (line 439)
update_matrix()
Error while evaluating UIControl Callback.Do you know how to fix the errors? I think need to change something in the updatamatrix.m too.
Thanks a lot.
CheMite MijalkovKeymasterDear Che,
Thank you for using Braph and your kind words. Hopefully it will be a very useful tool for you during your research.
I am not sure what the mistake it currently, but if you send me an email, I could send you a modified version of Braph that is able to upload precalculated connectivity matrices.
Looking forward to hearing from you.
Best,
Mite 
AuthorPosts