help > RE: second-level analyses using existing connectivity matrices in CONN
May 25, 2023  06:05 AM | Warren Logge - University of Sydney
RE: second-level analyses using existing connectivity matrices in CONN
Hi Alfonso,

thanks for your assistance - with your solutions I was able troubleshoot it and successfully analyse the data.

Just posting up issues and solutions here as assistance to others:

1. You were correct that there was an issue with my array - there was an issue with my coding to concatenate the separate matrices per subject which led to matrices concatenating across the wrong dimension initially. Once I corrected for this the expected diagonal was shown for the 3D array.

I also had an extra subject in there who should have been excluded so that was also removed, although it did not cause the concatenation issue (but would have unbalanced the array in any case). They were easily removed from the original concatenation and caused no further issues

2. Your interpretation of the model was correct and I was inputting a vector that was too large (should have been 23 x2 rather than 48x1), and for some reason I managed to code in some semi-colons between the co-efficients per subject which created further issues. Thanks for supplying the correct design vector, this makes sense to me now and I should be able to run these without too much issue.

I have to also build in the interaction of the within and between subject contrasts but I will fiddle around with the coding for that following the manual etc. and should hopefully be able to script it successfully.

I have one further issue regarding adding a Schaeffer atlas to the results, as I was unable to get this to successfully function when added during conn_mtx_write but I will troubleshoot this a bit further first following other related forum posts before raising it as a separate query post.

Thanks again Alfonso - I really appreciate your help,

Best
Warren
Originally posted by Alfonso Nieto-Castanon:
Hi Warren,


I believe there may be a couple of different issues here:

1) the data in the allsub*.nii file does not appear to be concatenated correctly. For example if you run:

   [a,b]=conn_mtx_read('allsubses01ses02_threedim_connmat.mat.nii');
   figure;
   imagesc(a(:,:,1))

that should display the 400x400 connectivity matrix for subject #1 session #1, but the resulting plot does not show the expected diagonal 1's matrix. This probably indicates that the data was likely concatenated across the wrong dimension, when combining the matrices across all subjects and sessions. Perhaps relatedly it is unclear how the 23 subjects (14 in group 1 and 9 in group 2) got transformed into 48 elements in this file (combining 23 subjects and 2 sessions)

and 2) If I am interpreting correctly your design matrix should be a [23 x 2] matrix, instead of the [48 x 1] vector that you are currently entering in the 'design_matrix' field. I would try the syntax:

X = [1 0;1 0;1 0;1 0;1 0;1 0;1 0;1 0;1 0;1 0;1 0;1 0;1 0;1 0;0 1;0 1;0 1;0 1;0 1;0 1;0 1;0 1;0 1];  % design matrix (e.g. #subjects x #groups) 

conn_module('GLM',...
   'design_matrix', X, ...
   'data',{'allsubses01ses02_threedim_connmat.mat.nii'},...
   'contrast_between',[-1 1],...
   'contrast_within',[-1 1]);



Hope this helps
Alfonso
Originally posted by Warren Logge:
Hi there,

I'm trying to use CONN to analyse post-processed ROI-to-ROI connectivity matrices that were processed using xcp-d (processed using fmriprep pre-processed data). 

I've followed the strategy supplied in this previous post (https://www.nitrc.org/forum/message.php?...) as best I could. 

1. I've converted the matrix data of 23 subjects in two groups (treatmentgp 1 = 14; treatmentgp 2 =9) with 2 sessions (pre-treatment = ses-01/post-treatment = ses-02), so that each subject has two 400x400 matrices (based on the Schaefer atlas) which I concatenated into a 4D array using 

conn_mtx_write

which created a 400:400:48 4D array (:,:,1 to :,:,24 were all subjects ses-01, :,:,25 to :,:,48 were all subjects ses-02)

2. I then attempted to conduct the group-level analyses with the following script    


conn_module('GLM',...
'design_matrix',[1;0;1;0;1;0;0;1;1;0;1;0;0;1;0;1;1;0;1;0;1;0;1;0;1;0;0;1;0;1;1;0;0;1;0;1;1;0;0;1;1;0;0;1;1;0;0;1;],...
'data',{'allsubses01ses02_threedim_connmat.mat.nii'},...
'contrast_between',[-1 1],...
'contrast_within',[-1 1]);

but it ran into an error - I'm guessing that my contrasts are incorrect, and/or there is an issue reading my 4D nifti file. 

Here was the output
conn_module options:
design_matrix: [48×1 double]
data: {'allsubses01ses02_threedim_connmat.mat.nii'}
contrast_between: [-1 1]
contrast_within: [-1 1]

Error using conn_module (line 655)
mismatch number of columns in #contrast_within (2) and number of measures in #data (1)

I want to evaluate the differences between the two treatment groups (between contrast), and differences between the sessions (within contrast); I also want to examine the interaction but I haven't built it up so far yet as I'm having issues at the main effects stage.

Any assistance appreciated - I've attached a zip of the nifti and json files created through conn_write_mtx as well 

Thanks in advance,

Best
Warren

Threaded View

TitleAuthorDate
Warren Logge May 19, 2023
Alfonso Nieto-Castanon May 24, 2023
RE: second-level analyses using existing connectivity matrices in CONN
Warren Logge May 25, 2023