The fitted model from ggmncv contains a lot of information, most of which is not immediately useful for most use cases. This function extracts the weighted adjacency (partial correlation network) and adjacency matrices.

get_graph(x, ...)

Arguments

x

An object of class ggmncv.

...

Currently ignored.

Value

  • P: Weighted adjacency matrix (partial correlation network)

  • adj: Adjacency matrix

Examples

Y <- na.omit(bfi[,1:5])

fit <- ggmncv(cor(Y),
              n = nrow(Y),
              progress = FALSE)

get_graph(fit)
#> $P
#>            [,1]       [,2]       [,3]      [,4]      [,5]
#> [1,]  0.0000000 -0.2435686 -0.1110675 0.0000000 0.0000000
#> [2,] -0.2435686  0.0000000  0.2849497 0.1659666 0.1578954
#> [3,] -0.1110675  0.2849497  0.0000000 0.1787385 0.3600141
#> [4,]  0.0000000  0.1659666  0.1787385 0.0000000 0.1204465
#> [5,]  0.0000000  0.1578954  0.3600141 0.1204465 0.0000000
#> 
#> $adj
#>      [,1] [,2] [,3] [,4] [,5]
#> [1,]    1    1    1    0    0
#> [2,]    1    1    1    1    1
#> [3,]    1    1    1    1    1
#> [4,]    0    1    1    1    1
#> [5,]    0    1    1    1    1
#> 
#> attr(,"class")
#> [1] "graph"