Custom Network Statistics

Donny Williams

5/19/2020

Background

This vignette describes a new feature to BGGM (2.0.0) that allows for computing custom network statistics (e.g., centrality). The new function is called roll_your_own and it was suggested by a user of BGGM (see feature request here).

Basic Idea

The basic idea is to compute the chosen network statistic for each of the sampled partial correlation matrices, resulting in a distribution. All that is required is to define a function that takes either a partial correlation matrix or a weighted adjacency matrix (the partial correlation matrix with values set to zero) as the first argument. Several examples are provided below.

R packages

Data

In all examples, a subset of ptsd data is used. The subset includes two of the “communities” of symptoms (details for these data can be found in Armour et al. 2017). The data are ordinal (5-level Likert).

Fit Model

For these data, the GGM is estimated with a semi-parametric copula (Hoff 2007). In BGGM, this implemented with type = mixed which is kind of a misnomer because the data do not have to be “mixed” (consisting of continuous and discrete variables). Note that the model is fitted only once which highlights that only the posterior samples are needed to compute any network statistic.

Examples

Expected Influence

The first example computes expected influence (Robinaugh, Millner, and McNally 2016). The first step is to define a function

Note that x takes the matrix which is then passed to expectedInf. The ... allows for passing additional arguments to the expectedInf function. An example is provided below. With the function defined, the next step is to compute the network statistic.

The option select = FALSE indicates to compute the statistics from the partial correlation matrices (nothing set to zero). This can be changed with select = TRUE. Internally, each of the sampled partial correlation matrices is multiplied by the adjacency matrix.

The results are then plotted with

Bridge Strength

The next example computes bridge strength (Jones, Ma, and McNally 2019). This requires the user to define clusters or “communities”.

Notice communities. This is passed to ... in the function f, which, in turn, is passed to the function bridge. Any number of arguments can be passed this way. Here are the results

This can then be plotted and further customized (the returned object is a ggplot)

Assortment

The next example computes assortment (Newman 2003).

This example demonstrate that ... can take several arguments. The results are stored in the net_stat object. They can be accessed with

Note

The function roll_your_own is expecting the custom function to return either a single number or a number for each node. This ensures all the printing and plotting functions work. However, you could return anything you want and then access the results to plot, summarize, etc.

References

Armour, Cherie, Eiko I Fried, Marie K Deserno, Jack Tsai, and Robert H Pietrzak. 2017. “A Network Analysis of Dsm-5 Posttraumatic Stress Disorder Symptoms and Correlates in Us Military Veterans.” Journal of Anxiety Disorders 45: 49–59. https://doi.org/10.31234/osf.io/p69m7.

Hoff, Peter D. 2007. “Extending the Rank Likelihood for Semiparametric Copula Estimation.” The Annals of Applied Statistics 1 (1): 265–83. https://doi.org/10.1214/07-AOAS107.

Jones, Payton J, Ruofan Ma, and Richard J McNally. 2019. “Bridge Centrality: A Network Approach to Understanding Comorbidity.” Multivariate Behavioral Research, 1–15. https://doi.org/10.1080/00273171.2019.1614898.

Newman, Mark EJ. 2003. “Mixing Patterns in Networks.” Physical Review E 67 (2): 026126.

Robinaugh, Donald J, Alexander J Millner, and Richard J McNally. 2016. “Identifying Highly Influential Nodes in the Complicated Grief Network.” Journal of Abnormal Psychology 125 (6): 747.