How to do comparison using TTEST2 to get the p-value between two 4-D connectivity matrices.

10 views (last 30 days)
(Hello, I'm fairly new to statistical analysis and EEG data analysis)
I have two connectivity matrices of EEG data that I want to compare. The thing that confuses me is the dimension of the matrices (4D - single), does anyone know what each of the dimensions represent? And how to find the p-value for the comparison (t-test)?
I've tried:
DTF_trial1 % connectivity matrix 1 (4-D single)
DTF_trial2 % connectivity matrix 2 (4-D single)
[H,P] = ttest2(DTF_trial1, DTF_trial2)
but it returned thousands of lines of 5 values:
P(:,:,96,151) =
0.6100 0.0308 0.0899 0.2211 0.2078
P(:,:,97,151) =
0.3384 0.0222 0.0878 0.2718 0.1502
P(:,:,98,151) =
0.2317 0.0190 0.0871 0.3884 0.1364
P(:,:,99,151) =
0.1713 0.0237 0.0869 0.5536 0.1350
Thank you.

Answers (1)

Paras Gupta
Paras Gupta on 22 Sep 2023
Hi Sandy,
I understand that you want to know, what the different dimensions used in 4D connectivity analysis matrices represent, and how we can compute the p-value for comparison using a t-test.
In the context of EEG data, a connectivity matrix represents the functional connectivity between different brain regions or electrodes. Each dimension of the 4D connectivity matrix has a specific meaning:
  • Dimension 1: Represents the source region or electrode from which the connectivity is measured.
  • Dimension 2: Represents the target region or electrode to which the connectivity is measured.
  • Dimension 3: Represents the frequency or frequency band at which the connectivity is measured.
  • Dimension 4: Represents the trial or sample number
Since you want to compare the connectivity matrices across all dimensions, you can reshape the matrices into 2D arrays before performing the t-test and compare connectivity across all trials (4th dimension).
% Reshape the connectivity matrices into 2D arrays
DTF_trial1_2D = reshape(DTF_trial1, [], size(DTF_trial1, 4));
DTF_trial2_2D = reshape(DTF_trial2, [], size(DTF_trial2, 4));
% Perform the t-test
[H, P] = ttest2(DTF_trial1_2D, DTF_trial2_2D);
Please refer to the following documentation for more information on the functions used in the code above.
Hope this helps.

Categories

Find more on EEG/MEG/ECoG in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!