Learn R Programming

CommKern: Analysis of Network Community Structures

An R package for implementing the hierarchical multimodal spinglass (HMS) algorithm and semiparametric kernel machine methods, with specific applications to neuroimaging data. The HMS algorithm allows for multimodal inputs and creates a hierarchical structure of nested communities through modification of the spinglass algorithm first proposed in a 2006 paper by Reichardt and Bornholdt. The combined flexibility of specifying the maximum possible number of communities a priori (as opposed to an exact number), allowing for more than one source of information in the algorithm, and creation of a nested, hierarchical structure of communities addresses many of the limitations that exist within other community detection algorithms when applied to neuroimaging data. The semiparametric kernel machine methods can then be used to conduct statistical inference to understand if the partitioning of the network nodes to communities is associated with an outcome (whether binary or continuous) while controlling for potential confounders. Extrinsic or intrinsic cluster evaluation metrics have been provided in the package but the kernel approach is flexible enough for the end user to specify their own distance-based metric.

Learn more about CommKern

The community detection algorithm and semiparametric kernel machine methods were developed as part of Alexandria Jensen's PhD dissertation work.

Vignettes

There is one vignette included with the package, for now. Additional details will be added to this vignette.

vignette('CommKern', package = 'CommKern')

Additional vignettes may also be authored soon.

Installation

You can install CommKern from GitHub. This will require you to have devtools installed, and, if you are using Windows, you'll need Rtools installed as well.

library(devtools)
install_github("aljensen89/CommKern", build_vignettes = TRUE)

Hierarchical Multimodal Spinglass (HMS) Algorithm

Details of the HMS algorithm can be found in the vignette. Specific application to brain connectivity data will be briefly summarized here. Starting from a common brain atlas (e.g., Automated Anatomical Labeling (AAL), Harvard-Oxford (HO), Craddock 200 (CC200), etc.), adjacency matrices representing functional and structural connectivity are derived from the correlation between resting state functional MRI (rs-FMRI) blood oxygen level dependent (BOLD) time series or the number of white matter fiber tracks computed from diffusion tensor MRI, respectively. Previous studies have observed that functional connectivity can be detected between brain regions that lack a direct structural connection. However, the propensity for two areas to interact on a functional level has been shown to vary in proportion to their structural connectivity, leading to the widely held assumption that functional configurations are assumed to be a reflection of underlying structural linkages. As such, we have utilized the multimodal aspect to the HMS algorithm to create structurally-informed functional connectivity communities.

However, the flexibility of the HMS algorithm does not require either brain network data or multiple inputs. In his 2010 paper, Fortunato showed that the spinglass algorithm is both precise and accurate at recovering community structures but, due its computational complexity, should not be used on networks that exceed several thousand nodes. The HMS algorithm is flexible enough so that its hierarchical and/or multimodal aspects can be suppressed. We recommend that the end user find a balance between computation time and algorithmic specifications in all applications, paying special attention when applying to large networks.

Semiparametric Kernel Machine Methods

Details of the semiparametric kernel machine methods can be found in the vignette. Bringing the partitioning of nodes to communities (via the HMS algorithm or another community detection algorithm, if desired) into a format for analysis using a distance-based kernel will be briefly overviewed here. For group-level network data, a community detection algorithm is run, providing the clustering of nodes to communities. From there, a variety of cluster evaluation metrics can be chosen. Extrinsic metrics require some form of ground truth labeling; however, in neuroimaging, a ground truth is not available. For the appropriate extrinsic metrics, a harmonic mean is calculated such that for each pair of partitions A and B, each takes a turn being the ground truth label. Intrinsic metrics, on the other hand, do not require a ground truth labeling. Within this package, we utilize the Hamiltonian value from the HMS algorithm. Once the metric has been applied to the set of network community data, it is ready for input into the semiparametric kernel machine methods. Options are available for both a binary and continuous outcome of interest and for a fully nonparametric or semiparametric approach, depending on whether the end user wishes to include other covariates of interest.

Copy Link

Version

Install

install.packages('CommKern')

Monthly Downloads

203

Version

1.0.1

License

GPL (>= 2)

Issues

Pull Requests

Stars

Forks

Maintainer

Alexandria Jensen

Last Published

September 23rd, 2022

Functions in CommKern (1.0.1)

ext_distance

Extrinsic evaluation distance matrix creation
find_start_temp

Starting temperature
group_adj_perturb

Group adjacency matrices
group_network_perturb

Simulated group networks
ham_distance

Hamiltonian distance matrix creation
degree

Node degree calculation
get_weights

Simulated network edge weights
heatbath_multimodal

Multimodal heatbath algorithm
entropy

Entropy
hms

Hierarchical multimodal spinglass algorithm
kernel

Distance-based kernel
matrix_plot

Functional and Structural Matrix Plot
matrix_to_df

Convert matrices to dataframe list for network
up_low

Bounds of grid search function
zrand

Rand z-score
simasd_covars

Simulated demographics dataset modeled of a subset of the preprocessed ABIDE database
sort_pairs

Sort pairs
simnet_df_perturb

Simulated network data frame
purity

Purity
simasd_comm_df

Simulated partitions of nodes to communities from HMS algorithm
simasd_hamil_df

Simulated Hamiltonian values from HMS algorithm
simasd_array

Simulated Array
score_cont_nonparam

Nonparametric score function for distance-based kernel and continuous outcome.
score_cont_semiparam

Semiparametric score function for distance-based kernel and continuous outcome.
subset_matrix_to_df

Convert matrices to list of data frames for subnetworks
score_log_nonparam

Nonparametric score function for distance-based kernel and binary outcome
score_log_semiparam

Semiparametric score function for distance-based kernel
tr

Trace
count_pairs

Count pairs
community_plot

Communities by layer plot
SBM_net

Simulated functional and structural connectivity with nested hierarchical community structure
CommKern

CommKern
consensus_similarity

Consensus Similarity
adj_RI

Adjusted Rand Index (ARI)
community_allegiance

Community Allegiance
NMI

Normalized mutual information (NMI)
compute_modularity_matrix

Compute modularity matrix
compute_multimodal_mod

Compute multimodal modularity matrix