graph2prec: Graph to Precision matrix

Description Usage Arguments Value Examples

View source: R/sampling_ggm.R

Description

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.

Usage

1
2
3
4
5
6
7
8
graph2prec(
  graph,
  neg_prop = 0.5,
  cond_var = NULL,
  epsilon = 0.001,
  delta = 0.01,
  maxIter = 10000
)

Arguments

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

Value

a precision matrix with Matrix format

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
## 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)

jchiquet/rggm documentation built on April 5, 2020, 1:53 a.m.