Description Usage Arguments Value References Examples
Check the IRC (or Incoherence condition) in Gaussian graphical Models, following Equation (8) in \insertCiteravikumar2008modelIRCcheck.
1 | irc_ggm(true_network, cores = 2)
|
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 |
infinity norm (greater than 1 the IRC is violated, with closer to zero better).
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | # 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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.