constrained {IRCcheck} | R Documentation |
Constrained Precision Matrix
Description
Compute the maximum likelihood estimate, given certain elements are constrained to zero (e.g., an adjacency matrix). This approach is described in Hastie et al. (2009).
Usage
constrained(Sigma, adj)
Arguments
Sigma |
Covariance matrix |
adj |
Matrix with constraints. A zero indicates that element should be constrained to zero. |
Value
A list containing the inverse covariance matrix and the covariance matrix.
Note
The algorithm is written in c++
.
References
Hastie T, Tibshirani R, Friedman J (2009). The elements of statistical learning: data mining, inference, and prediction. Springer Science \& Business Media.
Examples
# 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)
[Package IRCcheck version 1.0.0 Index]