Title: | Covariate Dependent Graph Estimation |
---|---|
Description: | A covariate-dependent approach to Gaussian graphical modeling as described in Dasgupta et al. (2022). Employs a novel weighted pseudo-likelihood approach to model the conditional dependence structure of data as a continuous function of an extraneous covariate. The main function, covdepGE::covdepGE(), estimates a graphical representation of the conditional dependence structure via a block mean-field variational approximation, while several auxiliary functions (inclusionCurve(), matViz(), and plot.covdepGE()) are included for visualizing the resulting estimates. |
Authors: | Jacob Helwig [cre, aut], Sutanoy Dasgupta [aut], Peng Zhao [aut], Bani Mallick [aut], Debdeep Pati [aut] |
Maintainer: | Jacob Helwig <[email protected]> |
License: | GPL (>= 3) |
Version: | 1.0.1 |
Built: | 2024-11-21 03:50:12 UTC |
Source: | https://github.com/jacobhelwig/covdepge |
A covariate-dependent approach to Gaussian graphical modeling as described in Dasgupta et al. (2022). Employs a novel weighted pseudo-likelihood approach to model the conditional dependence structure of data as a continuous function of an extraneous covariate. The main function, covdepGE::covdepGE(), estimates a graphical representation of the conditional dependence structure via a block mean-field variational approximation, while several auxiliary functions (inclusionCurve(), matViz(), and plot.covdepGE()) are included for visualizing the resulting estimates.
Maintainer: Jacob Helwig [email protected]
Authors:
Sutanoy Dasgupta [email protected]
Peng Zhao [email protected]
Bani Mallick [email protected]
Debdeep Pati [email protected]
(1) Sutanoy Dasgupta, Peng Zhao, Jacob Helwig, Prasenjit Ghosh, Debdeep Pati, and Bani Mallick. An Approximate Bayesian Approach to Covariate-dependent Graphical Modeling. arXiv preprint, 1–64, 2023.
Useful links:
Report bugs at https://github.com/JacobHelwig/covdepGE/issues
Model the conditional dependence structure of X
as a function
of Z
as described in (1)
covdepGE( X, Z = NULL, hp_method = "hybrid", ssq = NULL, sbsq = NULL, pip = NULL, nssq = 5, nsbsq = 5, npip = 5, ssq_mult = 1.5, ssq_lower = 1e-05, snr_upper = 25, sbsq_lower = 1e-05, pip_lower = 1e-05, pip_upper = NULL, tau = NULL, norm = 2, center_X = TRUE, scale_Z = TRUE, alpha_tol = 1e-05, max_iter_grid = 10, max_iter = 100, edge_threshold = 0.5, sym_method = "mean", parallel = FALSE, num_workers = NULL, prog_bar = TRUE )
covdepGE( X, Z = NULL, hp_method = "hybrid", ssq = NULL, sbsq = NULL, pip = NULL, nssq = 5, nsbsq = 5, npip = 5, ssq_mult = 1.5, ssq_lower = 1e-05, snr_upper = 25, sbsq_lower = 1e-05, pip_lower = 1e-05, pip_upper = NULL, tau = NULL, norm = 2, center_X = TRUE, scale_Z = TRUE, alpha_tol = 1e-05, max_iter_grid = 10, max_iter = 100, edge_threshold = 0.5, sym_method = "mean", parallel = FALSE, num_workers = NULL, prog_bar = TRUE )
X |
|
Z |
Z <- rep(0, nrow(X)) If |
hp_method |
|
ssq |
ssq <- seq(ssq_lower, ssq_upper, length.out = nssq)
|
sbsq |
sbsq <- seq(sbsq_lower, sbsq_upper, length.out = nsbsq)
|
pip |
pip <- seq(pip_lower, pi_upper, length.out = npip)
|
nssq |
positive integer; number of points to generate for |
nsbsq |
positive integer; number of points to generate for |
npip |
positive integer; number of points to generate for |
ssq_mult |
positive numeric; if ssq_upper <- ssq_mult * stats::var(X_j) Then, |
ssq_lower |
positive numeric; if |
snr_upper |
positive numeric; upper bound on the signal-to-noise ratio.
If s2_sum <- sum(apply(X, 2, stats::var)) sbsq_upper <- snr_upper / (pip_upper * s2_sum) Then, |
sbsq_lower |
positive numeric; if |
pip_lower |
numeric in |
pip_upper |
lasso <- glmnet::cv.glmnet(X, X_j) non0 <- sum(glmnet::coef.glmnet(lasso, s = "lambda.1se")[-1] != 0) non0 <- min(max(non0, 1), p - 1) pip_upper <- non0 / p
|
tau |
|
norm |
numeric in |
center_X |
logical; if |
scale_Z |
logical; if |
alpha_tol |
positive numeric; end CAVI when the Frobenius norm of the
change in the alpha matrix is within |
max_iter_grid |
positive integer; if tolerance criteria has not been
met by |
max_iter |
positive integer; if tolerance criteria has not been met by
|
edge_threshold |
numeric in |
sym_method |
|
parallel |
logical; if doParallel::registerDoParallel(num_workers)
|
num_workers |
num_workers <- floor(parallel::detectCores() / 2)
|
prog_bar |
logical; if |
Returns object of class covdepGE
with the following values:
graphs |
list with the following values:
|
variational_params |
list with the following values:
|
hyperparameters |
list of
|
model_details |
list with the following values:
|
weights |
list with the following values:
|
(1) Sutanoy Dasgupta, Peng Zhao, Jacob Helwig, Prasenjit Ghosh, Debdeep Pati, and Bani Mallick. An Approximate Bayesian Approach to Covariate-dependent Graphical Modeling. arXiv preprint, 1–64, 2023.
(2) Sutanoy Dasgupta, Debdeep Pati, and Anuj Srivastava. A Two-Step Geometric Framework For Density Modeling. Statistica Sinica, 30(4):2155–2177, 2020.
## Not run: library(ggplot2) # get the data set.seed(12) data <- generateData() X <- data$X Z <- data$Z interval <- data$interval prec <- data$true_precision # get overall and within interval sample sizes n <- nrow(X) n1 <- sum(interval == 1) n2 <- sum(interval == 2) n3 <- sum(interval == 3) # visualize the distribution of the extraneous covariate ggplot(data.frame(Z = Z, interval = as.factor(interval))) + geom_histogram(aes(Z, fill = interval), color = "black", bins = n %/% 5) # visualize the true precision matrices in each of the intervals # interval 1 matViz(prec[[1]], incl_val = TRUE) + ggtitle(paste0("True precision matrix, interval 1, observations 1,...,", n1)) # interval 2 (varies continuously with Z) cat("\nInterval 2, observations ", n1 + 1, ",...,", n1 + n2, sep = "") int2_mats <- prec[interval == 2] int2_inds <- c(5, n2 %/% 2, n2 - 5) lapply(int2_inds, function(j) matViz(int2_mats[[j]], incl_val = TRUE) + ggtitle(paste("True precision matrix, interval 2, observation", j + n1))) # interval 3 matViz(prec[[length(prec)]], incl_val = TRUE) + ggtitle(paste0("True precision matrix, interval 3, observations ", n1 + n2 + 1, ",...,", n1 + n2 + n3)) # fit the model and visualize the estimated graphs (out <- covdepGE(X, Z)) plot(out) # visualize the posterior inclusion probabilities for variables (1, 3) and (1, 2) inclusionCurve(out, 1, 2) inclusionCurve(out, 1, 3) ## End(Not run)
## Not run: library(ggplot2) # get the data set.seed(12) data <- generateData() X <- data$X Z <- data$Z interval <- data$interval prec <- data$true_precision # get overall and within interval sample sizes n <- nrow(X) n1 <- sum(interval == 1) n2 <- sum(interval == 2) n3 <- sum(interval == 3) # visualize the distribution of the extraneous covariate ggplot(data.frame(Z = Z, interval = as.factor(interval))) + geom_histogram(aes(Z, fill = interval), color = "black", bins = n %/% 5) # visualize the true precision matrices in each of the intervals # interval 1 matViz(prec[[1]], incl_val = TRUE) + ggtitle(paste0("True precision matrix, interval 1, observations 1,...,", n1)) # interval 2 (varies continuously with Z) cat("\nInterval 2, observations ", n1 + 1, ",...,", n1 + n2, sep = "") int2_mats <- prec[interval == 2] int2_inds <- c(5, n2 %/% 2, n2 - 5) lapply(int2_inds, function(j) matViz(int2_mats[[j]], incl_val = TRUE) + ggtitle(paste("True precision matrix, interval 2, observation", j + n1))) # interval 3 matViz(prec[[length(prec)]], incl_val = TRUE) + ggtitle(paste0("True precision matrix, interval 3, observations ", n1 + n2 + 1, ",...,", n1 + n2 + n3)) # fit the model and visualize the estimated graphs (out <- covdepGE(X, Z)) plot(out) # visualize the posterior inclusion probabilities for variables (1, 3) and (1, 2) inclusionCurve(out, 1, 2) inclusionCurve(out, 1, 3) ## End(Not run)
Generate a -dimensional extraneous covariate
and
-dimensional Gaussian data with a precision matrix that varies as
a continuous function of the extraneous covariate. This data is distributed
similar to that used in the simulation study from (1)
generateData(p = 5, n1 = 60, n2 = 60, n3 = 60, Z = NULL, true_precision = NULL)
generateData(p = 5, n1 = 60, n2 = 60, n3 = 60, Z = NULL, true_precision = NULL)
p |
positive integer; number of variables in the data matrix. |
n1 |
positive integer; number of observations in the first interval.
|
n2 |
positive integer; number of observations in the second interval.
|
n3 |
positive integer; number of observations in the third interval.
|
Z |
|
true_precision |
|
Returns list with the following values:
X |
a |
Z |
a |
true_precision |
list of |
interval |
vector of length |
If Z = NULL
, then the generation of Z
is as follows:
The first n1
observations have from from a uniform
distribution on the interval
(the first interval).
Observations n1 + 1
to n1 + n2
have from from a uniform
distribution on the interval
(the second interval).
Observations n1 + n2 + 1
to n1 + n2 + n3
have from a
uniform distribution on the interval
(the third interval).
If true_precision = NULL
, then the generation of the true precision
matrices is as follows:
All precision matrices have on the diagonal and
in the
positions.
Observations in the first interval have a in the
positions, while observations in the third interval
have a
in the
positions.
Observations in the second interval have entries that vary as a
linear function of their extraneous covariate. Let
. Then, the
positions for
the
-th observation in the second interval are
, while the
entries are
.
Thus, as approaches
from the right, the associated
precision matrix becomes more similar to the matrix for observations in the
first interval. Similarly, as
approaches
from the left,
the matrix becomes more similar to the matrix for observations in the third
interval.
## Not run: library(ggplot2) # get the data set.seed(12) data <- generateData() X <- data$X Z <- data$Z interval <- data$interval prec <- data$true_precision # get overall and within interval sample sizes n <- nrow(X) n1 <- sum(interval == 1) n2 <- sum(interval == 2) n3 <- sum(interval == 3) # visualize the distribution of the extraneous covariate ggplot(data.frame(Z = Z, interval = as.factor(interval))) + geom_histogram(aes(Z, fill = interval), color = "black", bins = n %/% 5) # visualize the true precision matrices in each of the intervals # interval 1 matViz(prec[[1]], incl_val = TRUE) + ggtitle(paste0("True precision matrix, interval 1, observations 1,...,", n1)) # interval 2 (varies continuously with Z) cat("\nInterval 2, observations ", n1 + 1, ",...,", n1 + n2, sep = "") int2_mats <- prec[interval == 2] int2_inds <- c(5, n2 %/% 2, n2 - 5) lapply(int2_inds, function(j) matViz(int2_mats[[j]], incl_val = TRUE) + ggtitle(paste("True precision matrix, interval 2, observation", j + n1))) # interval 3 matViz(prec[[length(prec)]], incl_val = TRUE) + ggtitle(paste0("True precision matrix, interval 3, observations ", n1 + n2 + 1, ",...,", n1 + n2 + n3)) # fit the model and visualize the estimated graphs (out <- covdepGE(X, Z)) plot(out) # visualize the posterior inclusion probabilities for variables (1, 3) and (1, 2) inclusionCurve(out, 1, 2) inclusionCurve(out, 1, 3) ## End(Not run)
## Not run: library(ggplot2) # get the data set.seed(12) data <- generateData() X <- data$X Z <- data$Z interval <- data$interval prec <- data$true_precision # get overall and within interval sample sizes n <- nrow(X) n1 <- sum(interval == 1) n2 <- sum(interval == 2) n3 <- sum(interval == 3) # visualize the distribution of the extraneous covariate ggplot(data.frame(Z = Z, interval = as.factor(interval))) + geom_histogram(aes(Z, fill = interval), color = "black", bins = n %/% 5) # visualize the true precision matrices in each of the intervals # interval 1 matViz(prec[[1]], incl_val = TRUE) + ggtitle(paste0("True precision matrix, interval 1, observations 1,...,", n1)) # interval 2 (varies continuously with Z) cat("\nInterval 2, observations ", n1 + 1, ",...,", n1 + n2, sep = "") int2_mats <- prec[interval == 2] int2_inds <- c(5, n2 %/% 2, n2 - 5) lapply(int2_inds, function(j) matViz(int2_mats[[j]], incl_val = TRUE) + ggtitle(paste("True precision matrix, interval 2, observation", j + n1))) # interval 3 matViz(prec[[length(prec)]], incl_val = TRUE) + ggtitle(paste0("True precision matrix, interval 3, observations ", n1 + n2 + 1, ",...,", n1 + n2 + n3)) # fit the model and visualize the estimated graphs (out <- covdepGE(X, Z)) plot(out) # visualize the posterior inclusion probabilities for variables (1, 3) and (1, 2) inclusionCurve(out, 1, 2) inclusionCurve(out, 1, 3) ## End(Not run)
Plot the posterior inclusion probability of an edge between two variables as a function of observation index
inclusionCurve( out, col_idx1, col_idx2, line_type = "solid", line_size = 0.5, line_color = "black", point_shape = 21, point_size = 1.5, point_color = "#500000", point_fill = "white" )
inclusionCurve( out, col_idx1, col_idx2, line_type = "solid", line_size = 0.5, line_color = "black", point_shape = 21, point_size = 1.5, point_color = "#500000", point_fill = "white" )
out |
object of class |
col_idx1 |
integer in |
col_idx2 |
integer in |
line_type |
linetype; |
line_size |
positive numeric; thickness of the interpolating line.
|
line_color |
color; color of interpolating line. |
point_shape |
shape; shape of the points denoting observation-specific
inclusion probabilities; |
point_size |
positive numeric; size of probability points. |
point_color |
color; color of probability points. |
point_fill |
color; fill of probability points. Only applies to select
shapes. |
Returns ggplot2
visualization of inclusion probability curve
## Not run: library(ggplot2) # get the data set.seed(12) data <- generateData() X <- data$X Z <- data$Z interval <- data$interval prec <- data$true_precision # get overall and within interval sample sizes n <- nrow(X) n1 <- sum(interval == 1) n2 <- sum(interval == 2) n3 <- sum(interval == 3) # visualize the distribution of the extraneous covariate ggplot(data.frame(Z = Z, interval = as.factor(interval))) + geom_histogram(aes(Z, fill = interval), color = "black", bins = n %/% 5) # visualize the true precision matrices in each of the intervals # interval 1 matViz(prec[[1]], incl_val = TRUE) + ggtitle(paste0("True precision matrix, interval 1, observations 1,...,", n1)) # interval 2 (varies continuously with Z) cat("\nInterval 2, observations ", n1 + 1, ",...,", n1 + n2, sep = "") int2_mats <- prec[interval == 2] int2_inds <- c(5, n2 %/% 2, n2 - 5) lapply(int2_inds, function(j) matViz(int2_mats[[j]], incl_val = TRUE) + ggtitle(paste("True precision matrix, interval 2, observation", j + n1))) # interval 3 matViz(prec[[length(prec)]], incl_val = TRUE) + ggtitle(paste0("True precision matrix, interval 3, observations ", n1 + n2 + 1, ",...,", n1 + n2 + n3)) # fit the model and visualize the estimated graphs (out <- covdepGE(X, Z)) plot(out) # visualize the posterior inclusion probabilities for variables (1, 3) and (1, 2) inclusionCurve(out, 1, 2) inclusionCurve(out, 1, 3) ## End(Not run)
## Not run: library(ggplot2) # get the data set.seed(12) data <- generateData() X <- data$X Z <- data$Z interval <- data$interval prec <- data$true_precision # get overall and within interval sample sizes n <- nrow(X) n1 <- sum(interval == 1) n2 <- sum(interval == 2) n3 <- sum(interval == 3) # visualize the distribution of the extraneous covariate ggplot(data.frame(Z = Z, interval = as.factor(interval))) + geom_histogram(aes(Z, fill = interval), color = "black", bins = n %/% 5) # visualize the true precision matrices in each of the intervals # interval 1 matViz(prec[[1]], incl_val = TRUE) + ggtitle(paste0("True precision matrix, interval 1, observations 1,...,", n1)) # interval 2 (varies continuously with Z) cat("\nInterval 2, observations ", n1 + 1, ",...,", n1 + n2, sep = "") int2_mats <- prec[interval == 2] int2_inds <- c(5, n2 %/% 2, n2 - 5) lapply(int2_inds, function(j) matViz(int2_mats[[j]], incl_val = TRUE) + ggtitle(paste("True precision matrix, interval 2, observation", j + n1))) # interval 3 matViz(prec[[length(prec)]], incl_val = TRUE) + ggtitle(paste0("True precision matrix, interval 3, observations ", n1 + n2 + 1, ",...,", n1 + n2 + n3)) # fit the model and visualize the estimated graphs (out <- covdepGE(X, Z)) plot(out) # visualize the posterior inclusion probabilities for variables (1, 3) and (1, 2) inclusionCurve(out, 1, 2) inclusionCurve(out, 1, 3) ## End(Not run)
Create a visualization of a matrix
matViz( x, color1 = "white", color2 = "#500000", grid_color = "black", incl_val = FALSE, prec = 2, font_size = 3, font_color1 = "black", font_color2 = "white", font_thres = mean(x) )
matViz( x, color1 = "white", color2 = "#500000", grid_color = "black", incl_val = FALSE, prec = 2, font_size = 3, font_color1 = "black", font_color2 = "white", font_thres = mean(x) )
x |
matrix; matrix to be visualized |
color1 |
color; color for low entries. |
color2 |
color; color for high entries. |
grid_color |
color; color of grid lines. |
incl_val |
logical; if |
prec |
positive integer; number of decimal places to round entries to if
|
font_size |
positive numeric; size of font if |
font_color1 |
color; color of font for low entries if |
font_color2 |
color; color of font for high entries if |
font_thres |
numeric; values less than |
Returns ggplot2
visualization of matrix
## Not run: library(ggplot2) # get the data set.seed(12) data <- generateData() X <- data$X Z <- data$Z interval <- data$interval prec <- data$true_precision # get overall and within interval sample sizes n <- nrow(X) n1 <- sum(interval == 1) n2 <- sum(interval == 2) n3 <- sum(interval == 3) # visualize the distribution of the extraneous covariate ggplot(data.frame(Z = Z, interval = as.factor(interval))) + geom_histogram(aes(Z, fill = interval), color = "black", bins = n %/% 5) # visualize the true precision matrices in each of the intervals # interval 1 matViz(prec[[1]], incl_val = TRUE) + ggtitle(paste0("True precision matrix, interval 1, observations 1,...,", n1)) # interval 2 (varies continuously with Z) cat("\nInterval 2, observations ", n1 + 1, ",...,", n1 + n2, sep = "") int2_mats <- prec[interval == 2] int2_inds <- c(5, n2 %/% 2, n2 - 5) lapply(int2_inds, function(j) matViz(int2_mats[[j]], incl_val = TRUE) + ggtitle(paste("True precision matrix, interval 2, observation", j + n1))) # interval 3 matViz(prec[[length(prec)]], incl_val = TRUE) + ggtitle(paste0("True precision matrix, interval 3, observations ", n1 + n2 + 1, ",...,", n1 + n2 + n3)) # fit the model and visualize the estimated graphs (out <- covdepGE(X, Z)) plot(out) # visualize the posterior inclusion probabilities for variables (1, 3) and (1, 2) inclusionCurve(out, 1, 2) inclusionCurve(out, 1, 3) ## End(Not run)
## Not run: library(ggplot2) # get the data set.seed(12) data <- generateData() X <- data$X Z <- data$Z interval <- data$interval prec <- data$true_precision # get overall and within interval sample sizes n <- nrow(X) n1 <- sum(interval == 1) n2 <- sum(interval == 2) n3 <- sum(interval == 3) # visualize the distribution of the extraneous covariate ggplot(data.frame(Z = Z, interval = as.factor(interval))) + geom_histogram(aes(Z, fill = interval), color = "black", bins = n %/% 5) # visualize the true precision matrices in each of the intervals # interval 1 matViz(prec[[1]], incl_val = TRUE) + ggtitle(paste0("True precision matrix, interval 1, observations 1,...,", n1)) # interval 2 (varies continuously with Z) cat("\nInterval 2, observations ", n1 + 1, ",...,", n1 + n2, sep = "") int2_mats <- prec[interval == 2] int2_inds <- c(5, n2 %/% 2, n2 - 5) lapply(int2_inds, function(j) matViz(int2_mats[[j]], incl_val = TRUE) + ggtitle(paste("True precision matrix, interval 2, observation", j + n1))) # interval 3 matViz(prec[[length(prec)]], incl_val = TRUE) + ggtitle(paste0("True precision matrix, interval 3, observations ", n1 + n2 + 1, ",...,", n1 + n2 + n3)) # fit the model and visualize the estimated graphs (out <- covdepGE(X, Z)) plot(out) # visualize the posterior inclusion probabilities for variables (1, 3) and (1, 2) inclusionCurve(out, 1, 2) inclusionCurve(out, 1, 3) ## End(Not run)
covdepGE
Create a list of the unique graphs estimated by covdepGE
## S3 method for class 'covdepGE' plot(x, graph_colors = NULL, title_sum = TRUE, ...)
## S3 method for class 'covdepGE' plot(x, graph_colors = NULL, title_sum = TRUE, ...)
x |
object of class |
graph_colors |
|
title_sum |
logical; if |
... |
additional arguments will be ignored |
Returns list of ggplot2
visualizations of unique graphs estimated
by covdepGE
## Not run: library(ggplot2) # get the data set.seed(12) data <- generateData() X <- data$X Z <- data$Z interval <- data$interval prec <- data$true_precision # get overall and within interval sample sizes n <- nrow(X) n1 <- sum(interval == 1) n2 <- sum(interval == 2) n3 <- sum(interval == 3) # visualize the distribution of the extraneous covariate ggplot(data.frame(Z = Z, interval = as.factor(interval))) + geom_histogram(aes(Z, fill = interval), color = "black", bins = n %/% 5) # visualize the true precision matrices in each of the intervals # interval 1 matViz(prec[[1]], incl_val = TRUE) + ggtitle(paste0("True precision matrix, interval 1, observations 1,...,", n1)) # interval 2 (varies continuously with Z) cat("\nInterval 2, observations ", n1 + 1, ",...,", n1 + n2, sep = "") int2_mats <- prec[interval == 2] int2_inds <- c(5, n2 %/% 2, n2 - 5) lapply(int2_inds, function(j) matViz(int2_mats[[j]], incl_val = TRUE) + ggtitle(paste("True precision matrix, interval 2, observation", j + n1))) # interval 3 matViz(prec[[length(prec)]], incl_val = TRUE) + ggtitle(paste0("True precision matrix, interval 3, observations ", n1 + n2 + 1, ",...,", n1 + n2 + n3)) # fit the model and visualize the estimated graphs (out <- covdepGE(X, Z)) plot(out) # visualize the posterior inclusion probabilities for variables (1, 3) and (1, 2) inclusionCurve(out, 1, 2) inclusionCurve(out, 1, 3) ## End(Not run)
## Not run: library(ggplot2) # get the data set.seed(12) data <- generateData() X <- data$X Z <- data$Z interval <- data$interval prec <- data$true_precision # get overall and within interval sample sizes n <- nrow(X) n1 <- sum(interval == 1) n2 <- sum(interval == 2) n3 <- sum(interval == 3) # visualize the distribution of the extraneous covariate ggplot(data.frame(Z = Z, interval = as.factor(interval))) + geom_histogram(aes(Z, fill = interval), color = "black", bins = n %/% 5) # visualize the true precision matrices in each of the intervals # interval 1 matViz(prec[[1]], incl_val = TRUE) + ggtitle(paste0("True precision matrix, interval 1, observations 1,...,", n1)) # interval 2 (varies continuously with Z) cat("\nInterval 2, observations ", n1 + 1, ",...,", n1 + n2, sep = "") int2_mats <- prec[interval == 2] int2_inds <- c(5, n2 %/% 2, n2 - 5) lapply(int2_inds, function(j) matViz(int2_mats[[j]], incl_val = TRUE) + ggtitle(paste("True precision matrix, interval 2, observation", j + n1))) # interval 3 matViz(prec[[length(prec)]], incl_val = TRUE) + ggtitle(paste0("True precision matrix, interval 3, observations ", n1 + n2 + 1, ",...,", n1 + n2 + n3)) # fit the model and visualize the estimated graphs (out <- covdepGE(X, Z)) plot(out) # visualize the posterior inclusion probabilities for variables (1, 3) and (1, 2) inclusionCurve(out, 1, 2) inclusionCurve(out, 1, 3) ## End(Not run)