Applies the Triangulated Maximally Filtered Graph (TMFG) filtering method (see Massara et al., 2016). The TMFG method uses a structural constraint that limits the number of zero-order correlations included in the network (3n - 6; where n is the number of variables). The TMFG algorithm begins by identifying four variables which have the largest sum of correlations to all other variables. Then, it iteratively adds each variable with the largest sum of three correlations to nodes already in the network until all variables have been added to the network. This structure can be associated with the inverse correlation matrix (i.e., precision matrix) to be turned into a GGM (i.e., partial correlation network) by using Local-Global Inversion Method (LoGo; see Barfuss et al., 2016 for more details). See Details for more information
Arguments
- data
Matrix or data frame. Should consist only of variables to be used in the analysis. Can be raw data or correlation matrix
- n
Numeric (length = 1). Sample size for when a correlation matrix is input into
data
. Defaults toNULL
.n
is not necessary and is provided for better functionality inEGAnet
- corr
Character (length = 1). Method to compute correlations. Defaults to
"auto"
. Available options:"auto"
— Automatically computes appropriate correlations for the data using Pearson's for continuous, polychoric for ordinal, tetrachoric for binary, and polyserial/biserial for ordinal/binary with continuous. To change the number of categories that are considered ordinal, useordinal.categories
(seepolychoric.matrix
for more details)"cor_auto"
— Usescor_auto
to compute correlations. Arguments can be passed along to the function"cosine"
— Usescosine
to compute cosine similarity"pearson"
— Pearson's correlation is computed for all variables regardless of categories"spearman"
— Spearman's rank-order correlation is computed for all variables regardless of categories
For other similarity measures, compute them first and input them into
data
with the sample size (n
)- na.data
Character (length = 1). How should missing data be handled? Defaults to
"pairwise"
. Available options:"pairwise"
— Computes correlation for all available cases between two variables"listwise"
— Computes correlation for all complete cases in the dataset
- partial
Boolean (length = 1). Whether partial correlations should be output. Defaults to
FALSE
. The TMFG method is based on the zero-order correlations; the Local-Global Inversion Method (LoGo; see Barfuss et al., 2016 for more details) uses the decomposability of the TMFG network to obtain the inverse covariance structure of the network (which is then converted to partial correlations). Set toTRUE
to obtain the partial correlations from the LoGo method- returnAllResults
Boolean (length = 1). Whether all results should be returned. Defaults to
FALSE
(network only). Set toTRUE
to access separators and cliques- verbose
Boolean (length = 1). Whether messages and (insignificant) warnings should be output. Defaults to
FALSE
(silent calls). Set toTRUE
to see all messages and warnings for every function call- ...
Additional arguments to be passed on to
auto.correlate
Value
Returns a network or list containing:
- network
The filtered adjacency matrix
- separators
The separators (3-cliques) in the network
- cliques
The cliques (4-cliques) in the network
Details
The TMFG method applies a structural constraint on the network, which restrains the network to retain a certain number of edges (3n-6, where n is the number of nodes; Massara et al., 2016). The network is also composed of 3- and 4-node cliques (i.e., sets of connected nodes; a triangle and tetrahedron, respectively). The TMFG method constructs a network using zero-order correlations and the resulting network can be associated with the inverse covariance matrix (yielding a GGM; Barfuss, Massara, Di Matteo, & Aste, 2016). Notably, the TMFG can use any association measure and thus does not assume the data is multivariate normal.
Construction begins by forming a tetrahedron of the four nodes that have the highest sum of correlations that are greater than the average correlation in the correlation matrix. Next, the algorithm iteratively identifies the node that maximizes its sum of correlations to a connected set of three nodes (triangles) already included in the network and then adds that node to the network. The process is completed once every node is connected in the network. In this process, the network automatically generates what's called a planar network. A planar network is a network that could be drawn on a sphere with no edges crossing (often, however, the networks are depicted with edges crossing; Tumminello, Aste, Di Matteo, & Mantegna, 2005).
References
Local-Global Inversion Method
Barfuss, W., Massara, G. P., Di Matteo, T., & Aste, T. (2016).
Parsimonious modeling with information filtering networks.
Physical Review E, 94, 062306.
Psychometric network introduction to TMFG
Christensen, A. P., Kenett, Y. N., Aste, T., Silvia, P. J., & Kwapil, T. R. (2018).
Network structure of the Wisconsin Schizotypy Scales-Short Forms: Examining psychometric network filtering approaches.
Behavior Research Methods, 50, 2531-2550.
Triangulated Maximally Filtered Graph
Massara, G. P., Di Matteo, T., & Aste, T. (2016).
Network filtering for big data: Triangulated maximally filtered graph.
Journal of Complex Networks, 5, 161-178.
Examples
# TMFG filtered network
TMFG(wmt2[,7:24])
#> wmt1 wmt2 wmt3 wmt4 wmt5 wmt6 wmt7
#> wmt1 1.0000000 0.5308147 0.4204303 0.0000000 0.4476835 0.0000000 0.0000000
#> wmt2 0.5308147 1.0000000 0.6486396 0.0000000 0.5570605 0.5152450 0.0000000
#> wmt3 0.4204303 0.6486396 1.0000000 0.0000000 0.4143219 0.5268500 0.0000000
#> wmt4 0.0000000 0.0000000 0.0000000 1.0000000 0.0000000 0.4730469 0.4453915
#> wmt5 0.4476835 0.5570605 0.4143219 0.0000000 1.0000000 0.4347379 0.0000000
#> wmt6 0.0000000 0.5152450 0.5268500 0.4730469 0.4347379 1.0000000 0.5447217
#> wmt7 0.0000000 0.0000000 0.0000000 0.4453915 0.0000000 0.5447217 1.0000000
#> wmt8 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.4894769 0.5081548
#> wmt9 0.0000000 0.4637356 0.0000000 0.0000000 0.0000000 0.5220343 0.3961022
#> wmt10 0.0000000 0.5163552 0.4776316 0.4881654 0.0000000 0.5496942 0.4761164
#> wmt11 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.3686565 0.4130321
#> wmt12 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.3693883
#> wmt13 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000
#> wmt14 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.4677051
#> wmt15 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.4499222
#> wmt16 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000
#> wmt17 0.0000000 0.0000000 0.0000000 0.3468635 0.0000000 0.4349659 0.3866176
#> wmt18 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000
#> wmt8 wmt9 wmt10 wmt11 wmt12 wmt13 wmt14
#> wmt1 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000
#> wmt2 0.0000000 0.4637356 0.5163552 0.0000000 0.0000000 0.0000000 0.0000000
#> wmt3 0.0000000 0.0000000 0.4776316 0.0000000 0.0000000 0.0000000 0.0000000
#> wmt4 0.0000000 0.0000000 0.4881654 0.0000000 0.0000000 0.0000000 0.0000000
#> wmt5 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000
#> wmt6 0.4894769 0.5220343 0.5496942 0.3686565 0.0000000 0.0000000 0.0000000
#> wmt7 0.5081548 0.3961022 0.4761164 0.4130321 0.3693883 0.0000000 0.4677051
#> wmt8 1.0000000 0.4857008 0.0000000 0.3605484 0.0000000 0.0000000 0.0000000
#> wmt9 0.4857008 1.0000000 0.5677137 0.0000000 0.4362098 0.4378465 0.5266469
#> wmt10 0.0000000 0.5677137 1.0000000 0.0000000 0.0000000 0.4171669 0.4578349
#> wmt11 0.3605484 0.0000000 0.0000000 1.0000000 0.0000000 0.0000000 0.0000000
#> wmt12 0.0000000 0.4362098 0.0000000 0.0000000 1.0000000 0.0000000 0.0000000
#> wmt13 0.0000000 0.4378465 0.4171669 0.0000000 0.0000000 1.0000000 0.0000000
#> wmt14 0.0000000 0.5266469 0.4578349 0.0000000 0.0000000 0.0000000 1.0000000
#> wmt15 0.0000000 0.4350710 0.0000000 0.0000000 0.4490240 0.0000000 0.4541116
#> wmt16 0.0000000 0.4457227 0.4401890 0.0000000 0.0000000 0.4150783 0.3890664
#> wmt17 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000
#> wmt18 0.0000000 0.0000000 0.2864095 0.0000000 0.0000000 0.0000000 0.3283947
#> wmt15 wmt16 wmt17 wmt18
#> wmt1 0.0000000 0.0000000 0.0000000 0.0000000
#> wmt2 0.0000000 0.0000000 0.0000000 0.0000000
#> wmt3 0.0000000 0.0000000 0.0000000 0.0000000
#> wmt4 0.0000000 0.0000000 0.3468635 0.0000000
#> wmt5 0.0000000 0.0000000 0.0000000 0.0000000
#> wmt6 0.0000000 0.0000000 0.4349659 0.0000000
#> wmt7 0.4499222 0.0000000 0.3866176 0.0000000
#> wmt8 0.0000000 0.0000000 0.0000000 0.0000000
#> wmt9 0.4350710 0.4457227 0.0000000 0.0000000
#> wmt10 0.0000000 0.4401890 0.0000000 0.2864095
#> wmt11 0.0000000 0.0000000 0.0000000 0.0000000
#> wmt12 0.4490240 0.0000000 0.0000000 0.0000000
#> wmt13 0.0000000 0.4150783 0.0000000 0.0000000
#> wmt14 0.4541116 0.3890664 0.0000000 0.3283947
#> wmt15 1.0000000 0.0000000 0.0000000 0.0000000
#> wmt16 0.0000000 1.0000000 0.0000000 0.3348244
#> wmt17 0.0000000 0.0000000 1.0000000 0.0000000
#> wmt18 0.0000000 0.3348244 0.0000000 1.0000000
#> attr(,"methods")
#> attr(,"methods")$corr
#> [1] "auto"
#>
#> attr(,"methods")$partial
#> [1] FALSE
#>
# Partial correlations using the LoGo method
TMFG(wmt2[,7:24], partial = TRUE)
#> wmt1 wmt2 wmt3 wmt4 wmt5 wmt6
#> wmt1 0.00000000 0.26318198 0.097775847 0.0000000 0.204527092 0.00000000
#> wmt2 0.26318198 0.00000000 0.386184801 0.0000000 0.283583405 0.04565927
#> wmt3 0.09777585 0.38618480 0.000000000 0.0000000 0.003334298 0.19477357
#> wmt4 0.00000000 0.00000000 0.000000000 0.0000000 0.000000000 0.14187094
#> wmt5 0.20452709 0.28358341 0.003334298 0.0000000 0.000000000 0.15313759
#> wmt6 0.00000000 0.04565927 0.194773567 0.1418709 0.153137594 0.00000000
#> wmt7 0.00000000 0.00000000 0.000000000 0.1466689 0.000000000 0.14721836
#> wmt8 0.00000000 0.00000000 0.000000000 0.0000000 0.000000000 0.13519759
#> wmt9 0.00000000 0.10810521 0.000000000 0.0000000 0.000000000 0.12925700
#> wmt10 0.00000000 0.13690147 0.101979977 0.2257212 0.000000000 0.09105689
#> wmt11 0.00000000 0.00000000 0.000000000 0.0000000 0.000000000 0.11574943
#> wmt12 0.00000000 0.00000000 0.000000000 0.0000000 0.000000000 0.00000000
#> wmt13 0.00000000 0.00000000 0.000000000 0.0000000 0.000000000 0.00000000
#> wmt14 0.00000000 0.00000000 0.000000000 0.0000000 0.000000000 0.00000000
#> wmt15 0.00000000 0.00000000 0.000000000 0.0000000 0.000000000 0.00000000
#> wmt16 0.00000000 0.00000000 0.000000000 0.0000000 0.000000000 0.00000000
#> wmt17 0.00000000 0.00000000 0.000000000 0.1298545 0.000000000 0.20469347
#> wmt18 0.00000000 0.00000000 0.000000000 0.0000000 0.000000000 0.00000000
#> wmt7 wmt8 wmt9 wmt10 wmt11 wmt12 wmt13
#> wmt1 0.00000000 0.0000000 0.0000000 0.00000000 0.0000000 0.0000000 0.0000000
#> wmt2 0.00000000 0.0000000 0.1081052 0.13690147 0.0000000 0.0000000 0.0000000
#> wmt3 0.00000000 0.0000000 0.0000000 0.10197998 0.0000000 0.0000000 0.0000000
#> wmt4 0.14666893 0.0000000 0.0000000 0.22572120 0.0000000 0.0000000 0.0000000
#> wmt5 0.00000000 0.0000000 0.0000000 0.00000000 0.0000000 0.0000000 0.0000000
#> wmt6 0.14721836 0.1351976 0.1292570 0.09105689 0.1157494 0.0000000 0.0000000
#> wmt7 0.00000000 0.2332657 -0.1418146 0.09702665 0.1935173 0.1183172 0.0000000
#> wmt8 0.23326567 0.0000000 0.2237212 0.00000000 0.1400661 0.0000000 0.0000000
#> wmt9 -0.14181458 0.2237212 0.0000000 0.15971303 0.0000000 0.2050178 0.1783173
#> wmt10 0.09702665 0.0000000 0.1597130 0.00000000 0.0000000 0.0000000 0.1466414
#> wmt11 0.19351735 0.1400661 0.0000000 0.00000000 0.0000000 0.0000000 0.0000000
#> wmt12 0.11831721 0.0000000 0.2050178 0.00000000 0.0000000 0.0000000 0.0000000
#> wmt13 0.00000000 0.0000000 0.1783173 0.14664137 0.0000000 0.0000000 0.0000000
#> wmt14 0.17855513 0.0000000 0.2141408 0.07059072 0.0000000 0.0000000 0.0000000
#> wmt15 0.18110329 0.0000000 0.1141128 0.00000000 0.0000000 0.2571845 0.0000000
#> wmt16 0.00000000 0.0000000 0.1271244 0.13320286 0.0000000 0.0000000 0.2219959
#> wmt17 0.13902348 0.0000000 0.0000000 0.00000000 0.0000000 0.0000000 0.0000000
#> wmt18 0.00000000 0.0000000 0.0000000 0.07521198 0.0000000 0.0000000 0.0000000
#> wmt14 wmt15 wmt16 wmt17 wmt18
#> wmt1 0.00000000 0.0000000 0.0000000 0.0000000 0.00000000
#> wmt2 0.00000000 0.0000000 0.0000000 0.0000000 0.00000000
#> wmt3 0.00000000 0.0000000 0.0000000 0.0000000 0.00000000
#> wmt4 0.00000000 0.0000000 0.0000000 0.1298545 0.00000000
#> wmt5 0.00000000 0.0000000 0.0000000 0.0000000 0.00000000
#> wmt6 0.00000000 0.0000000 0.0000000 0.2046935 0.00000000
#> wmt7 0.17855513 0.1811033 0.0000000 0.1390235 0.00000000
#> wmt8 0.00000000 0.0000000 0.0000000 0.0000000 0.00000000
#> wmt9 0.21414082 0.1141128 0.1271244 0.0000000 0.00000000
#> wmt10 0.07059072 0.0000000 0.1332029 0.0000000 0.07521198
#> wmt11 0.00000000 0.0000000 0.0000000 0.0000000 0.00000000
#> wmt12 0.00000000 0.2571845 0.0000000 0.0000000 0.00000000
#> wmt13 0.00000000 0.0000000 0.2219959 0.0000000 0.00000000
#> wmt14 0.00000000 0.1920542 0.1052853 0.0000000 0.16557114
#> wmt15 0.19205422 0.0000000 0.0000000 0.0000000 0.00000000
#> wmt16 0.10528526 0.0000000 0.0000000 0.0000000 0.19041163
#> wmt17 0.00000000 0.0000000 0.0000000 0.0000000 0.00000000
#> wmt18 0.16557114 0.0000000 0.1904116 0.0000000 0.00000000
#> attr(,"methods")
#> attr(,"methods")$corr
#> [1] "auto"
#>
#> attr(,"methods")$partial
#> [1] TRUE
#>