From fc7806314f39d169777b56fb72b28703dffa27c3 Mon Sep 17 00:00:00 2001
From: Arnaud Delorme
Date: Thu, 21 Mar 2024 18:18:51 -0700
Subject: [PATCH 1/2] Update README.md
---
README.md | 34 ++++++++++++++++++++++++++++++++++
1 file changed, 34 insertions(+)
diff --git a/README.md b/README.md
index 17e6ef0..a90f094 100644
--- a/README.md
+++ b/README.md
@@ -145,6 +145,40 @@ pop_roi_connectplot(EEG, 'measure', 'mim', 'plotcortex', 'on', 'freqrange', [8 1
+### Group analysis
+
+The ROIconnect plugin is compatible EEGLAB STUDY. This means that if you have a STUDY for group analysis, you can select ROIconnect menus to compute connectivity on a group of datasets. Once connectivity has been computed, there are two ways to aggregate results for ROIconnect at the group level. At this stage, both ways involve command line code. The simplest way is to run ROIconnect on all datasets and then gather the matrices and run stats on them.
+
+Assuming that you have computed connectivity (for example the multivariate interaction measure) for all datasets and that for each subject, you have a dataset for condition 1 and dataset for condition 2 (so in sequence the first dataset is subject 1 condition 1, the second subject 1 condition 2, the third is subject 2 condition 1 etc, you could use the code (not tested)
+
+```matlab
+% agregate all subject for each condition in one matrix
+numSubject = length(ALLEEG)/2; % number os subjects
+cond1 = zeros( [ size(ALLEEG(1).roi.MIM) numSubject] ); % dimensions are frequency x roi x roi x subject
+cond2 = zeros( [ size(ALLEEG(1).roi.MIM) numSubject] );
+for iSubj = 1:numSubject
+ cond1(:,:,:,iSubj) = ALLEEG(((iSubj-1)*2+1)).roi.MIM; % get the MIM (multivariate interaction measure) for all odd datasets
+ cond2(:,:,:,iSubj) = ALLEEG(((iSubj-1)*2+2)).roi.MIM; % get the MIM (multivariate interaction measure) for all even datasets
+end
+
+% compute statistics and plot
+[t,df,p] = statcond({ cond1 cond2 }); % parametric here but you can also use permutations
+[~,indAlpha] = min(abs(ALLEEG(1).roi.freqs - 10));
+tAlpha = squeeze(t(indAlpha,:,:));
+pAlpha = squeeze(pFdr(indAlpha,:,:));
+figure; subplot(1,2,1); imagesc(tAlpha); title('t-value');
+figure; subplot(1,2,2); imagesc(-log10(pAlpha)); title('p-value (0 for p=1; 1 for p=0.1; 2 for p=0.01 ...)');
+% or replace matrix MIM in one of the dataset and plot using the ROIconnect menus or command line functions
+```
+
+Alternatively, to get ROIconnect data from an arbitrary study design (including 2-way ANOVA), you can use the powerful std_readdata function as outlined in the documentation of the [eegstats plugin](https://github.com/sccn/eegstats).
+
+```matlab
+[~,condsMat] = std_readdata(STUDY, ALLEEG, 'customread', 'std_readeegfield', 'customparams', {{ 'roi', 'MIM' }}, 'ndim', 4, 'singletrials', 'on’);
+```
+
+Then proceed to use the compute statistics and plot as above (in this case condsMat = { cond1 cond2 }). For more information on how to create a STUDY and STUDY design, refer to the [EEGLAB documentation](https://eeglab.org/tutorials/10_Group_analysis/study_creation.html).
+
# References
[1]
Pellegrini, F., Delorme, A., Nikulin, V., & Haufe, S. (2023). Identifying good practices for detecting inter-regional linear functional connectivity from EEG. NeuroImage, 120218. [doi: 10.1016/j.neuroimage.2023.120218](https://doi.org/10.1016/j.neuroimage.2023.120218)
From fb71d33e91952b5a70a8988fc0b7af9b0b5cb8a1 Mon Sep 17 00:00:00 2001
From: Arnaud Delorme
Date: Thu, 21 Mar 2024 18:21:06 -0700
Subject: [PATCH 2/2] Update README.md
---
README.md | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/README.md b/README.md
index a90f094..a23af80 100644
--- a/README.md
+++ b/README.md
@@ -147,12 +147,12 @@ pop_roi_connectplot(EEG, 'measure', 'mim', 'plotcortex', 'on', 'freqrange', [8 1
### Group analysis
-The ROIconnect plugin is compatible EEGLAB STUDY. This means that if you have a STUDY for group analysis, you can select ROIconnect menus to compute connectivity on a group of datasets. Once connectivity has been computed, there are two ways to aggregate results for ROIconnect at the group level. At this stage, both ways involve command line code. The simplest way is to run ROIconnect on all datasets and then gather the matrices and run stats on them.
+The ROIconnect plugin is compatible with EEGLAB STUDY framework. This means that if you have created a STUDY for group analysis, you can select ROIconnect menus to compute connectivity on a group of datasets. Once connectivity has been computed, there are two ways to aggregate results for ROIconnect at the group level. At this stage, both ways involve command line code. The simplest way is to run ROIconnect on all datasets and then gather the matrices and run statistics on them.
-Assuming that you have computed connectivity (for example the multivariate interaction measure) for all datasets and that for each subject, you have a dataset for condition 1 and dataset for condition 2 (so in sequence the first dataset is subject 1 condition 1, the second subject 1 condition 2, the third is subject 2 condition 1 etc, you could use the code (not tested)
+Assuming that you have computed connectivity (for example, the multivariate interaction measure) for all datasets and that for each subject, you have a dataset for condition 1 and a dataset for condition 2 (so in sequence, the first dataset is subject 1 condition 1, the second subject 1 condition 2, the third is subject 2 condition 1, etc, you could use the code:
```matlab
-% agregate all subject for each condition in one matrix
+% aggregate all subjects for each condition in one matrix
numSubject = length(ALLEEG)/2; % number os subjects
cond1 = zeros( [ size(ALLEEG(1).roi.MIM) numSubject] ); % dimensions are frequency x roi x roi x subject
cond2 = zeros( [ size(ALLEEG(1).roi.MIM) numSubject] );
@@ -177,7 +177,7 @@ Alternatively, to get ROIconnect data from an arbitrary study design (including
[~,condsMat] = std_readdata(STUDY, ALLEEG, 'customread', 'std_readeegfield', 'customparams', {{ 'roi', 'MIM' }}, 'ndim', 4, 'singletrials', 'on’);
```
-Then proceed to use the compute statistics and plot as above (in this case condsMat = { cond1 cond2 }). For more information on how to create a STUDY and STUDY design, refer to the [EEGLAB documentation](https://eeglab.org/tutorials/10_Group_analysis/study_creation.html).
+Then, proceed to use the compute statistics and plot as above (in this case *condsMat = { cond1 cond2 }*). For more information on how to create a STUDY and STUDY design, refer to the [EEGLAB documentation](https://eeglab.org/tutorials/10_Group_analysis/study_creation.html).
# References
[1]