How to use BGGM to Estimate Bayesian Gaussian Graphical Models

Bayesian version of GGM allows multiple Bayesian techniques to be used in psychological network.

R
Bayesian
Tutorial
Network Analysis
Author

Jihong Zhang

Published

March 5, 2024

This is a quick note illustrate some importance functions of BGGM and illustrate them using one or more example(s).

Overview

1. The Github page showcases some publications regarding algorithms of GGGM
2. Donny Williams’s website has more examples

Illustrative Example 1

Click to see the code
pcor_to_df <- function(x, names = paste0("B", 1:5)) {
colnames(x) = rownames(x) = names
x_upper <- x
x_upper[lower.tri(x_upper)] <- 0
as.data.frame(x_upper) |>
rownames_to_column('Start') |>
pivot_longer(-Start, names_to = 'End', values_to = 'Mean') |>
filter(Mean != 0) |>
mutate(Label = paste0(Start,'-', End))
}

A dataset containing items that measure Post-traumatic stress disorder symptoms (Armour et al. 2017). There are 20 variables (p) and 221 observations (n).

Estimation of Partial Correlation Matrix

The GGM can be estimated using estimate function with some important arguments:

• type: could be continuous, binary, ordinal, or mixed

• iter: Number of iterations (posterior samples; defaults to 5000).

• prior_sd: Scale of the prior distribution, approximately the standard deviation of a beta distribution (defaults to 0.50).

Click to see the code
library(BGGM)
library(tidyverse) # for ggplot2 and dplyr
library(psychonetrics) # the frequentist way for GGM

# data
Y <- ptsd[, 1:5] + 1 # add + 1 to make sure the ordinal variable start from '1'

# ordinal model
fit <- estimate(Y, type = 'ordinal', analytic = FALSE)
fit_cont <- estimate(Y, type = 'continuous', analytic = FALSE)

#summary(fit)
pcor_mat(fit)
      B1     B2    B3     B4    B5
B1 0.000  0.240 0.054  0.338 0.127
B2 0.240  0.000 0.502 -0.061 0.128
B3 0.054  0.502 0.000  0.245 0.190
B4 0.338 -0.061 0.245  0.000 0.353
B5 0.127  0.128 0.190  0.353 0.000

Let’s compare the partial correlation estimates to psychonetrics

Click to see the code
mod_saturated_ord <- ggm(Y, ordered = TRUE)
mod_saturated_cont <- ggm(Y)
getmatrix(mod_saturated_ord, 'omega')
           [,1]       [,2]       [,3]       [,4]      [,5]
[1,] 0.00000000  0.2655136 0.01768286  0.3593433 0.1242903
[2,] 0.26551363  0.0000000 0.55895807 -0.1174681 0.1195668
[3,] 0.01768286  0.5589581 0.00000000  0.2819463 0.1845554
[4,] 0.35934330 -0.1174681 0.28194629  0.0000000 0.3738825
[5,] 0.12429026  0.1195668 0.18455542  0.3738825 0.0000000
Click to see the code
freqEst <- pcor_to_df(getmatrix(mod_saturated_ord, 'omega'))
freqEst_cont <- pcor_to_df(getmatrix(mod_saturated_cont, 'omega'))

# transform partial corr. mat. of BGGM into df.
BayesEst <- pcor_to_df(pcor_mat(fit))
BayesEst_cont <- pcor_to_df(pcor_mat(fit_cont))

combEst <- rbind(
freqEst |> mutate(Type = 'psychonetrics_ord'),
BayesEst |> mutate(Type = 'BGGM_ord'),
freqEst_cont |> mutate(Type = 'psychonetrics_cont'),
BayesEst_cont |> mutate(Type = 'BGGM_cont')
) |>
mutate(Type = factor(Type, levels = c("psychonetrics_ord", "BGGM_ord", "psychonetrics_cont","BGGM_cont")))
ggplot(combEst) +
geom_col(aes(x = fct_rev(Label), y = Mean, fill = Type, col = Type), position = position_dodge()) +
geom_text(aes(x = fct_rev(Label), y = ifelse(Mean>0, Mean+.03, Mean-.03), label = round(Mean, 3), group = Type), position = position_dodge(width = .9)) +
labs(x = '') +
coord_flip() +
theme_classic()

We can find that:

1. Partial correlations with ordinal responses estimated by psychonetric do not align well with partial correlations with ordinal responses estimated by BGGM
2. Partial correlations with continuous responses estimated by psychonetric align well with partial correlations with continuous responses estimated by BGGM
3. Violating the continuous assumption of items responses usually underestimate the partial correlations (see BGGM_cont vs. BGGM_ord)

Regularization

It is easy to conduct regularization using Graph Selection using hypothesis testing

Click to see the code
fit_reg <- BGGM::select(fit, alternative = "greater")
plot(fit_reg)
$plt Hypothesis testing Using BGGM, we can perform hypothesis testing like whether edge A is more strong than edge B, whether edge A is “significant” higher or smaller than 0, whether group A and group B have differences in partial correlations. Testing Edge A vs. Edge B Click to see the code # example hypotheses hyp1 <- c("B2--B3 > B1--B4 > 0") # hypothesis 1 hyp2 <- c("B1--B5 > B2--B5 > 0") # hypothesis 2 hyp3 <- c("B2--B4 < 0") # hypothesis 3 hyp4 <- c("B1--B3 < 0") # hypothesis 4 ## Posterior hypothesis probabilities. extract_php <- function(Y = Y, hypothesis = hyp, type = 'ordinal') { x <- confirm(Y = Y, hypothesis = hypothesis, type = type) x_info <- x$info
PHP_confirmatory <- as.matrix(x_info$PHP_confirmatory) rownames(PHP_confirmatory) <- c(x$hypothesis, "complement")
PHP_confirmatory
}

extract_php(Y = Y, hypothesis = hyp1, type = 'ordinal')
                     [,1]
B2--B3 > B1--B4 > 0 0.989
complement          0.011
Click to see the code
extract_php(Y = Y, hypothesis = hyp2, type = 'ordinal')
                     [,1]
B1--B5 > B2--B5 > 0 0.866
complement          0.134
Click to see the code
extract_php(Y = Y, hypothesis = hyp3, type = 'ordinal')
            [,1]
B2--B4 < 0 0.708
complement 0.292
Click to see the code
extract_php(Y = Y, hypothesis = hyp4, type = 'ordinal')
            [,1]
B1--B3 < 0 0.253
complement 0.747

There are four hypothesis tested here:

1. The first expresses that the relation B2--B3 is larger than B1--B4 . In other words, that the partial correlation is larger for B2--B3. The p(H1|data) = 0.991 means the posterior hypothesis probability (PHP) is 0.991 which provides evidence for the hypothesis: the partial correlation for B2-B3 is larger;
2. The second expresses that the relation B1--B5 is larger than B2--B5 . The results of PHP suggests the hypothesis can be accepted;
3. The third expresses that the relation B2--B4 is larger than 0 . The results of PHP suggests the hypothesis can be accepted;
4. The fourth expresses that the relation B1--B3 is lower than 0 . The results of PHP suggests the hypothesis should be rejected given p(H_1) < p(complement);

Group Comparison

Click to see the code
# data
Y <- bfi

# males
Ymales <- subset(Y, gender == 1,
select = -c(gender, education))

# females
Yfemales <- subset(Y, gender == 2,
select = -c(gender, education))

# model fit
fit <- ggm_compare_estimate(Ymales, Yfemales)

# plot summary
summary(fit)
BGGM: Bayesian Gaussian Graphical Models
---
Type: continuous
Analytic: FALSE
Formula:
Posterior Samples: 5000
Observations (n):
Group 1: 805
Group 2: 1631
Nodes (p): 25
Relations: 300
---
Call:
ggm_compare_estimate(Ymales, Yfemales)
---
Estimates:

Relation Post.mean Post.sd Cred.lb Cred.ub
A1--A2    0.048    0.039   -0.029   0.125
A1--A3   -0.022    0.040   -0.101   0.054
A2--A3   -0.033    0.038   -0.111   0.044
A1--A4   -0.006    0.041   -0.088   0.075
A2--A4   -0.049    0.040   -0.128   0.028
A3--A4    0.038    0.039   -0.039   0.114
A1--A5    0.000    0.041   -0.082   0.081
A2--A5    0.086    0.041    0.004   0.165
A3--A5    0.063    0.038   -0.011   0.138
A4--A5   -0.024    0.040   -0.102   0.057
A1--C1   -0.020    0.041   -0.101   0.058
A2--C1   -0.027    0.041   -0.110   0.052
A3--C1    0.025    0.041   -0.054   0.106
A4--C1    0.010    0.041   -0.070   0.091
A5--C1    0.051    0.041   -0.029   0.133
A1--C2   -0.025    0.041   -0.105   0.054
A2--C2    0.013    0.041   -0.068   0.094
A3--C2    0.003    0.041   -0.074   0.082
A4--C2    0.046    0.040   -0.036   0.125
A5--C2    0.014    0.041   -0.063   0.094
C1--C2    0.024    0.038   -0.049   0.100
A1--C3    0.012    0.040   -0.066   0.091
A2--C3    0.022    0.040   -0.057   0.100
A3--C3   -0.032    0.042   -0.113   0.051
A4--C3    0.034    0.041   -0.046   0.113
A5--C3   -0.019    0.041   -0.101   0.062
C1--C3    0.041    0.040   -0.036   0.119
C2--C3    0.023    0.040   -0.055   0.101
A1--C4    0.015    0.040   -0.061   0.095
A2--C4    0.021    0.041   -0.059   0.101
A3--C4    0.103    0.040    0.024   0.184
A4--C4   -0.038    0.041   -0.119   0.043
A5--C4   -0.047    0.040   -0.125   0.031
C1--C4    0.062    0.041   -0.017   0.142
C2--C4    0.029    0.038   -0.045   0.102
C3--C4    0.003    0.040   -0.075   0.083
A1--C5   -0.039    0.041   -0.118   0.042
A2--C5   -0.005    0.041   -0.085   0.075
A3--C5    0.034    0.041   -0.047   0.114
A4--C5    0.048    0.040   -0.032   0.125
A5--C5    0.048    0.041   -0.032   0.128
C1--C5   -0.084    0.041   -0.164  -0.005
C2--C5    0.074    0.041   -0.008   0.155
C3--C5    0.098    0.040    0.018   0.174
C4--C5    0.050    0.038   -0.024   0.123
A1--E1    0.051    0.041   -0.030   0.129
A2--E1    0.017    0.041   -0.064   0.097
A3--E1    0.024    0.041   -0.057   0.102
A4--E1    0.001    0.041   -0.078   0.082
A5--E1    0.006    0.041   -0.073   0.086
C1--E1    0.062    0.041   -0.019   0.143
C2--E1    0.005    0.040   -0.075   0.084
C3--E1    0.068    0.040   -0.012   0.147
C4--E1   -0.007    0.041   -0.087   0.074
C5--E1    0.010    0.040   -0.071   0.090
A1--E2    0.009    0.041   -0.069   0.089
A2--E2    0.041    0.041   -0.040   0.121
A3--E2   -0.011    0.041   -0.091   0.066
A4--E2   -0.051    0.040   -0.130   0.027
A5--E2   -0.027    0.041   -0.106   0.053
C1--E2   -0.002    0.041   -0.083   0.079
C2--E2    0.039    0.041   -0.042   0.119
C3--E2   -0.159    0.040   -0.238  -0.078
C4--E2   -0.018    0.041   -0.101   0.063
C5--E2    0.081    0.040    0.003   0.159
E1--E2    0.012    0.039   -0.064   0.088
A1--E3   -0.033    0.041   -0.115   0.045
A2--E3   -0.067    0.041   -0.148   0.015
A3--E3   -0.037    0.040   -0.115   0.043
A4--E3   -0.005    0.040   -0.082   0.074
A5--E3   -0.034    0.041   -0.114   0.046
C1--E3    0.069    0.041   -0.011   0.149
C2--E3   -0.001    0.040   -0.079   0.078
C3--E3   -0.034    0.041   -0.114   0.045
C4--E3   -0.007    0.041   -0.088   0.071
C5--E3    0.000    0.040   -0.080   0.078
E1--E3   -0.032    0.041   -0.109   0.049
E2--E3   -0.063    0.041   -0.147   0.014
A1--E4    0.033    0.041   -0.046   0.115
A2--E4    0.031    0.042   -0.051   0.112
A3--E4    0.026    0.040   -0.054   0.105
A4--E4   -0.063    0.040   -0.143   0.017
A5--E4   -0.025    0.039   -0.103   0.052
C1--E4   -0.004    0.041   -0.084   0.077
C2--E4   -0.077    0.041   -0.159   0.002
C3--E4    0.023    0.041   -0.057   0.104
C4--E4   -0.026    0.041   -0.106   0.052
C5--E4   -0.022    0.041   -0.101   0.057
E1--E4   -0.036    0.039   -0.114   0.040
E2--E4    0.031    0.039   -0.047   0.107
E3--E4    0.029    0.041   -0.051   0.110
A1--E5   -0.013    0.041   -0.093   0.065
A2--E5    0.022    0.040   -0.057   0.101
A3--E5   -0.023    0.040   -0.098   0.056
A4--E5    0.121    0.041    0.040   0.200
A5--E5   -0.023    0.041   -0.104   0.059
C1--E5   -0.018    0.041   -0.099   0.063
C2--E5    0.005    0.041   -0.073   0.084
C3--E5   -0.028    0.041   -0.107   0.051
C4--E5    0.007    0.041   -0.074   0.089
C5--E5   -0.024    0.041   -0.102   0.058
E1--E5    0.004    0.041   -0.077   0.084
E2--E5    0.000    0.041   -0.080   0.080
E3--E5    0.063    0.040   -0.015   0.139
E4--E5    0.090    0.040    0.011   0.172
A1--N1    0.059    0.040   -0.019   0.138
A2--N1    0.060    0.041   -0.021   0.141
A3--N1   -0.048    0.041   -0.130   0.032
A4--N1    0.025    0.041   -0.057   0.105
A5--N1   -0.004    0.041   -0.084   0.078
C1--N1   -0.039    0.041   -0.119   0.043
C2--N1   -0.001    0.041   -0.081   0.076
C3--N1    0.069    0.041   -0.013   0.150
C4--N1   -0.037    0.041   -0.118   0.041
C5--N1   -0.021    0.041   -0.105   0.059
E1--N1    0.068    0.041   -0.015   0.148
E2--N1   -0.022    0.042   -0.102   0.061
E3--N1   -0.010    0.042   -0.091   0.070
E4--N1   -0.008    0.041   -0.087   0.074
E5--N1   -0.018    0.041   -0.099   0.062
A1--N2   -0.041    0.040   -0.119   0.037
A2--N2   -0.121    0.041   -0.198  -0.041
A3--N2    0.074    0.041   -0.007   0.154
A4--N2   -0.049    0.040   -0.127   0.032
A5--N2    0.061    0.042   -0.021   0.143
C1--N2    0.042    0.040   -0.038   0.121
C2--N2   -0.051    0.041   -0.129   0.029
C3--N2   -0.030    0.041   -0.110   0.050
C4--N2   -0.028    0.041   -0.108   0.053
C5--N2    0.037    0.041   -0.042   0.119
E1--N2    0.006    0.041   -0.074   0.087
E2--N2   -0.034    0.041   -0.114   0.046
E3--N2   -0.048    0.041   -0.131   0.031
E4--N2    0.043    0.042   -0.039   0.124
E5--N2    0.044    0.041   -0.035   0.126
N1--N2    0.049    0.028   -0.008   0.103
A1--N3   -0.072    0.040   -0.152   0.005
A2--N3    0.060    0.042   -0.023   0.141
A3--N3   -0.031    0.041   -0.113   0.048
A4--N3    0.024    0.041   -0.056   0.103
A5--N3    0.051    0.041   -0.031   0.130
C1--N3    0.036    0.041   -0.046   0.116
C2--N3   -0.007    0.040   -0.084   0.073
C3--N3    0.043    0.041   -0.038   0.123
C4--N3    0.074    0.041   -0.008   0.153
C5--N3    0.042    0.041   -0.037   0.124
E1--N3   -0.082    0.041   -0.162  -0.001
E2--N3   -0.032    0.040   -0.110   0.047
E3--N3   -0.081    0.041   -0.161   0.001
E4--N3   -0.117    0.041   -0.197  -0.034
E5--N3    0.045    0.041   -0.034   0.126
N1--N3   -0.005    0.039   -0.082   0.068
N2--N3   -0.100    0.040   -0.177  -0.021
A1--N4    0.054    0.041   -0.027   0.135
A2--N4    0.018    0.041   -0.062   0.098
A3--N4    0.039    0.041   -0.041   0.122
A4--N4    0.025    0.042   -0.059   0.106
A5--N4   -0.096    0.041   -0.174  -0.013
C1--N4    0.054    0.041   -0.025   0.131
C2--N4   -0.033    0.041   -0.115   0.048
C3--N4   -0.086    0.041   -0.167  -0.006
C4--N4   -0.102    0.041   -0.181  -0.023
C5--N4    0.034    0.040   -0.046   0.112
E1--N4    0.007    0.040   -0.073   0.085
E2--N4   -0.016    0.041   -0.098   0.062
E3--N4    0.156    0.041    0.075   0.236
E4--N4    0.091    0.041    0.012   0.170
E5--N4   -0.090    0.041   -0.169  -0.010
N1--N4   -0.067    0.041   -0.149   0.012
N2--N4    0.066    0.041   -0.014   0.146
N3--N4    0.086    0.037    0.014   0.157
A1--N5   -0.065    0.040   -0.143   0.012
A2--N5   -0.034    0.042   -0.115   0.049
A3--N5   -0.010    0.041   -0.092   0.070
A4--N5   -0.041    0.041   -0.120   0.039
A5--N5   -0.031    0.041   -0.112   0.049
C1--N5   -0.016    0.041   -0.097   0.063
C2--N5   -0.024    0.041   -0.103   0.054
C3--N5    0.045    0.041   -0.035   0.125
C4--N5    0.070    0.040   -0.008   0.150
C5--N5   -0.106    0.041   -0.185  -0.025
E1--N5   -0.016    0.041   -0.097   0.066
E2--N5    0.032    0.040   -0.045   0.109
E3--N5    0.002    0.041   -0.081   0.081
E4--N5   -0.017    0.040   -0.095   0.063
E5--N5    0.032    0.040   -0.045   0.110
N1--N5   -0.054    0.041   -0.136   0.027
N2--N5    0.013    0.041   -0.067   0.094
N3--N5   -0.013    0.040   -0.092   0.066
N4--N5    0.028    0.040   -0.048   0.108
A1--O1   -0.022    0.040   -0.102   0.058
A2--O1   -0.008    0.041   -0.088   0.072
A3--O1    0.043    0.040   -0.036   0.123
A4--O1    0.019    0.041   -0.061   0.099
A5--O1   -0.086    0.040   -0.165  -0.009
C1--O1   -0.008    0.041   -0.089   0.073
C2--O1    0.045    0.040   -0.033   0.123
C3--O1   -0.096    0.041   -0.176  -0.016
C4--O1    0.001    0.042   -0.081   0.084
C5--O1   -0.040    0.041   -0.121   0.041
E1--O1   -0.053    0.040   -0.130   0.025
E2--O1    0.054    0.041   -0.028   0.135
E3--O1   -0.063    0.040   -0.143   0.016
E4--O1    0.004    0.040   -0.075   0.083
E5--O1   -0.041    0.040   -0.120   0.039
N1--O1   -0.034    0.041   -0.114   0.049
N2--O1   -0.007    0.041   -0.087   0.074
N3--O1    0.065    0.041   -0.014   0.143
N4--O1   -0.002    0.041   -0.085   0.078
N5--O1   -0.021    0.041   -0.104   0.059
A1--O2    0.002    0.040   -0.076   0.080
A2--O2    0.036    0.041   -0.042   0.116
A3--O2    0.048    0.041   -0.032   0.126
A4--O2    0.021    0.040   -0.058   0.100
A5--O2   -0.039    0.041   -0.119   0.040
C1--O2   -0.014    0.040   -0.096   0.064
C2--O2   -0.064    0.041   -0.144   0.015
C3--O2   -0.015    0.042   -0.098   0.063
C4--O2   -0.008    0.040   -0.087   0.073
C5--O2   -0.072    0.041   -0.153   0.007
E1--O2    0.072    0.041   -0.010   0.153
E2--O2    0.093    0.041    0.014   0.173
E3--O2    0.024    0.041   -0.057   0.103
E4--O2    0.021    0.040   -0.058   0.099
E5--O2    0.038    0.041   -0.041   0.119
N1--O2   -0.013    0.041   -0.095   0.065
N2--O2   -0.005    0.041   -0.086   0.075
N3--O2    0.034    0.040   -0.044   0.112
N4--O2   -0.030    0.041   -0.109   0.050
N5--O2    0.011    0.041   -0.070   0.092
O1--O2    0.049    0.040   -0.031   0.127
A1--O3    0.042    0.041   -0.041   0.120
A2--O3    0.044    0.041   -0.038   0.126
A3--O3    0.032    0.041   -0.048   0.111
A4--O3    0.003    0.041   -0.077   0.084
A5--O3    0.005    0.041   -0.076   0.084
C1--O3   -0.035    0.041   -0.116   0.046
C2--O3    0.036    0.040   -0.043   0.114
C3--O3    0.012    0.041   -0.068   0.091
C4--O3   -0.056    0.041   -0.137   0.023
C5--O3    0.034    0.041   -0.046   0.114
E1--O3    0.004    0.041   -0.076   0.084
E2--O3    0.081    0.041   -0.003   0.161
E3--O3    0.020    0.040   -0.059   0.097
E4--O3   -0.022    0.041   -0.101   0.056
E5--O3   -0.100    0.041   -0.180  -0.021
N1--O3    0.051    0.041   -0.028   0.131
N2--O3   -0.027    0.042   -0.108   0.054
N3--O3   -0.018    0.040   -0.096   0.062
N4--O3   -0.040    0.041   -0.121   0.041
N5--O3    0.038    0.041   -0.045   0.118
O1--O3    0.066    0.039   -0.012   0.144
O2--O3    0.015    0.040   -0.063   0.095
A1--O4    0.121    0.041    0.040   0.199
A2--O4    0.010    0.041   -0.070   0.092
A3--O4    0.041    0.040   -0.038   0.120
A4--O4    0.049    0.041   -0.033   0.128
A5--O4   -0.024    0.041   -0.104   0.056
C1--O4   -0.021    0.041   -0.101   0.060
C2--O4   -0.032    0.041   -0.111   0.049
C3--O4   -0.031    0.042   -0.115   0.049
C4--O4    0.012    0.040   -0.066   0.089
C5--O4    0.028    0.040   -0.050   0.107
E1--O4    0.064    0.041   -0.015   0.142
E2--O4    0.024    0.041   -0.056   0.105
E3--O4    0.055    0.041   -0.028   0.133
E4--O4    0.002    0.040   -0.075   0.081
E5--O4    0.011    0.040   -0.070   0.090
N1--O4   -0.018    0.041   -0.097   0.063
N2--O4    0.018    0.041   -0.062   0.098
N3--O4   -0.062    0.041   -0.140   0.016
N4--O4   -0.006    0.040   -0.086   0.072
N5--O4   -0.016    0.040   -0.097   0.063
O1--O4    0.071    0.040   -0.008   0.151
O2--O4   -0.043    0.041   -0.123   0.037
O3--O4   -0.027    0.040   -0.105   0.052
A1--O5    0.059    0.041   -0.024   0.136
A2--O5   -0.015    0.041   -0.095   0.064
A3--O5   -0.003    0.041   -0.085   0.076
A4--O5    0.040    0.040   -0.038   0.118
A5--O5    0.069    0.041   -0.009   0.151
C1--O5   -0.061    0.041   -0.141   0.019
C2--O5    0.041    0.041   -0.038   0.124
C3--O5   -0.016    0.041   -0.094   0.065
C4--O5    0.006    0.040   -0.073   0.084
C5--O5    0.093    0.040    0.012   0.172
E1--O5    0.018    0.040   -0.061   0.097
E2--O5    0.013    0.041   -0.067   0.093
E3--O5    0.020    0.041   -0.060   0.100
E4--O5    0.063    0.040   -0.016   0.141
E5--O5   -0.063    0.040   -0.141   0.015
N1--O5    0.023    0.040   -0.057   0.100
N2--O5   -0.039    0.041   -0.119   0.040
N3--O5    0.083    0.041    0.005   0.165
N4--O5   -0.025    0.041   -0.106   0.054
N5--O5    0.009    0.041   -0.071   0.089
O1--O5   -0.024    0.041   -0.104   0.059
O2--O5   -0.026    0.039   -0.105   0.049
O3--O5   -0.008    0.039   -0.084   0.070
O4--O5    0.043    0.040   -0.035   0.123
--- 

The regularized group difference network plot can be visualized as:

Click to see the code
plot(BGGM::select(fit))
[[1]]