Chapter 5 Example box: Calculating subject and group network matrices

Introduction

The aim of this example is to familiarise yourself with the types of results obtained from a network modelling analysis.

This example is based on the FSLnets package for Matlab that is available as part of FSL. Note that similar analyses can be performed in other neuroimaging software packages, and using custom code.

Please download the dataset for this example here:

Data download

The dataset you downloaded contains the output from a dual regression analysis driven by group ICA maps (where 100 group ICA components were extracted).

Please make sure that you have Matlab installed on your machine, and download the FSLnets script here: https://fsl.fmrib.ox.ac.uk/fsl/fslwiki/FSLNets. You may need to set up the matlab paths and environment variables to interact with FSL properly (this can be configured in Matlab, see https://fsl.fmrib.ox.ac.uk/fsl/fslwiki/FslInstallation for instructions).


Estimating a network matrix for each subject

In the terminal, navigate to the directory where the data you downloaded are called 'Data_5.2' (using cd), and start Matlab. We also need to tell MATLAB where to find the FSLNets scripts, please use addpath to add the full path to you unzipped FSLnets folder.

Now we are ready to start setting up some important parts for our network modeling analysis. To load in all subjects' timeseries data files from the dual-regression output directory, run:

ts = nets_load('groupICA100.dr', 0.72, 0);

We will now have a quick look at the temporal spectra of the RSNs, as a quick check that these look reasonable. Running the following command will show you a figure in which the left part of the plot shows one spectrum per group-ICA component, each averaged across all subjects. The right part shows the same thing, but with all spectra overlapping.

ts_spectra = nets_spectra(ts);

There is now the option to remove nodes' timeseries that correspond to artefacts rather than plausible nodes. Similar to single-subject ICA cleanup, this is decided by looking at the spatial maps, timecourses, and frequency spectra. To save time, we have listed the good components for you. Run the following commands to list the good components and apply the cleanup:

ts.DD = [1:3,5,6:9,11:13,17:23,25:38,40,42,43,47:50,52,53,55:59,61,...
62,64:66,70:74,77,80,81,86,87,93,97];
ts = nets_tsclean(ts,1);

Now you are ready to compute a network matrix for each subject, which is in general a matrix of connection strengths (of size number of nodes by number of nodes). We will compute two different versions of these netmats for each subject: a simple full correlation ('corr'), and a partial correlation that has been regularised in order to potentially improve the mathematical robustness of the estimation ('ridgep'). The partial correlation matrix should do a better job of only estimating the direct network connections than the full correlation does.

Fnetmats = nets_netmats(ts,1,'corr');
Pnetmats = nets_netmats(ts,1,'ridgep',0.1);

The full and partial netmats are now calculated for all subjects. In the next section, you are going to compute the group average and take a look at the average network matrix.


Group-average netmat summaries

This next command takes the subject network matrices you just calculated as inputs, and calculates the group average netmat. A figure should show up, displaying the partial group-average netmat.

[Znet_F,Mnet_F]=nets_groupmean(Fnetmats,0);
[Znet_P,Mnet_P]=nets_groupmean(Pnetmats,1);

The next thing we can look at is how nodes cluster together to form larger resting state networks. For this we run a clustering method that groups nodes together based on their timeseries. To view this network hierarchy, run:

nets_hierarchy(Znet_F,Znet_P,ts.DD,'groupICA100.sum');

You can see, for example, that the nodes group together in the dark blue tree on the far left are part of a large-scale resting state network called the default mode network that you may have heard about.


Cross-subject comparison with netmats

We are now able to test whether the netmats differ significantly between healthy controls and patients with a tumor using a two-sample t-test. This is a 'univariate' test, as we will test each network matrix edge separately for a group-difference, and then we will estimate p- values for these tests, correcting for the multiple comparisons across all edges. To perform the comparison please run the following command (which calls randomise from within Matlab):

[p_uncorr,p_corr]=nets_glm(Pnetmats,'design/unpaired_ttest_1con.mat','design/unpaired_ttest_1con.con',1);

Once randomise has finished, you will see a figure showing "netmats" containing corrected p-values. The results above the diagonal show edges where the two-group t-test is significant, at corrected-p<0.05.

We will now run a command that shows which nodes were linked to the significant result:

nets_edgepics(ts,'groupICA100.sum',Znet_P,reshape(p_corr,ts.Nnodes,ts.Nnodes),1);

In addition, we also want to show how the partial correlation differs between the patients and the controls and these two significant edges. To do this, run:

nets_boxplots(ts,Pnetmats,57,33,6);

The boxplots summarize the distributions of the correlation values (connections strengths) in the two groups - A being healthy controls and B being tumour patients - for this one particular node-pair (57,33).


Data credits

We are grateful to Natalie Voets for the data that was used in this example.