rlca returns a data.frame with factor sampled from an lca model

rlca(N, pi, theta)

Arguments

N

The size of the graph to generate

pi

A numeric vector of length K with clusters proportions (will be normalized to sum up to 1).

theta

A list of size V

Value

A list with fields:

  • x: the multi-graph adjacency matrix as an array

  • K: number of generated clusters

  • N: number of vertex

  • cl: vector of clusters labels

  • pi: clusters proportions

  • theta:

Details

This function takes the desired graph size, cluster proportions and connectivity matrix as input and sample a graph accordingly together with the clusters labels.

Examples

theta <- list(
  matrix(c(0.1, 0.9, 0.9, 0.1, 0.5, 0.5, 0.3, 0.7), ncol = 2, byrow = TRUE),
  matrix(c(0.5, 0.5, 0.3, 0.7, 0.05, 0.95, 0.3, 0.7), ncol = 2, byrow = TRUE),
  matrix(c(0.5, 0.5, 0.9, 0.1, 0.5, 0.5, 0.1, 0.9), ncol = 2, byrow = TRUE)
)
lca.data <- rlca(100, rep(1 / 4, 4), theta)