irc_ggm {IRCcheck} | R Documentation |
Irrepresentable Condition: Gaussian Graphical Model
Description
Check the IRC (or Incoherence condition) in Gaussian graphical Models, following Equation (8) in (Ravikumar et al. 2008).
Usage
irc_ggm(true_network, cores = 2)
Arguments
true_network |
A matrix of dimensions p by p, assumed to be a partial correlation matrix. |
cores |
Integer. Number of cores for parallel computing (defaults to |
Value
infinity norm (greater than 1 the IRC is violated, with closer to zero better).
References
Ravikumar P, Raskutti G, Wainwright MJ, Yu B (2008). “Model Selection in Gaussian Graphical Models: High-Dimensional Consistency of l1-regularized MLE.” In NIPS, 1329–1336.
Examples
# generate network
net <- gen_net(p = 20, edge_prob = 0.3, lb = 0.05, ub = 0.3)
# check irc
irc_ggm(net$pcors)
# random adj
# 90 % sparsity (roughly)
p <- 20
adj <- matrix(sample(0:1, size = p^2, replace = TRUE,
prob = c(0.9, 0.1) ),
nrow = p, ncol = p)
adj <- symm_mat(adj)
diag(adj) <- 1
# random correlation matrix
set.seed(1)
cors <- cov2cor(
solve(
rWishart(1, p + 2, diag(p))[,,1])
)
# constrain to zero
net <- constrained(cors, adj = adj)
irc_ggm(net$wadj)
#' # random adj
# 50 % sparsity (roughly)
p <- 20
adj <- matrix(sample(0:1, size = p^2, replace = TRUE, prob = c(0.5, 0.5) ),
nrow = p, ncol = p)
adj <- symm_mat(adj)
diag(adj) <- 1
# random correlation matrix
set.seed(1)
cors <- cov2cor(
solve(
rWishart(1, p + 2, diag(p))[,,1])
)
# constrain to zero
net <- constrained(cors, adj = adj)
irc_ggm(net$wadj)
[Package IRCcheck version 1.0.0 Index]