From a (possibility weighted) igraph object, build a precision matrix from the Laplacian matrix of the graph, which is set strictly positive-definite by iteratively adding small constant to its diagonal, proportionally to the degree of each node.
graph2prec( graph, neg_prop = 0.5, cond_var = NULL, epsilon = 0.001, delta = 0.01, maxIter = 10000 )
graph | an igraph object |
---|---|
neg_prop | double, the proportion of negative signs in the target precision matrix. Default is 0.5 |
cond_var | a target vector of conditional variances (which equal the inverse of the diaognal in a precision matrix). When NULL (the default), approximately equal to 1/degrees(graph). |
epsilon | double, the minimal eigen values to reach in the precision matrix. Default to 1e-2. |
delta | double, the quantity by which the diagonal is increased at each iteration. Default to 1e-1 |
maxIter | integer for the maximal number of iteration to reach the target minimal eigen value. Default to 1e4 |
a precision matrix with Matrix format
## graph parameters nbNodes <- 90 blockProp <- c(.5, .25, .25) # group proportions nbBlock <- length(blockProp) # number of blocks connectParam <- diag(.4, nbBlock) + 0.05 # connectivity matrix: affiliation network ## Graph Sampling mySBM <- rSBM(nbNodes, connectParam, blockProp) ## Precision matrix Omega <- graph2prec(mySBM)